#ident "$URL: svn://elmer/devel/SVN/SDDAS/trunk/libant/mfgets.c $ %D% SwRI" /* mfgets.c -- mangling fgets (removes newline if present) */ #include #include "ant.h" #define NUL '\0' /* NUL marks end of string */ #define NEWLINE '\n' /* the new line character */ char * mfgets(char *s,int n,FILE *stream) { char *last; /* points to last char in string */ char *strlast(char *s); if (!fgets(s,n,stream)) return NULL; if ((last = strlast(s)) && *last == NEWLINE) *last = NUL; return s; }