--- ray/src/common/fgetline.c 1990/03/22 20:43:32 1.3 +++ ray/src/common/fgetline.c 2003/06/27 06:53:21 2.4 @@ -1,18 +1,17 @@ -/* Copyright (c) 1989 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: fgetline.c,v 2.4 2003/06/27 06:53:21 greg Exp $"; #endif - /* * fgetline.c - read line with escaped newlines. * - * 10/4/89 + * External symbols declared in rtio.h */ -#include +#include "copyright.h" +#include "rtio.h" + char * fgetline(s, n, fp) /* read in line with escapes, elide final newline */ char *s; @@ -23,6 +22,8 @@ register FILE *fp; register int c = EOF; while (--n > 0 && (c = getc(fp)) != EOF) { + if (c == '\r') + continue; if (c == '\n' && (cp == s || cp[-1] != '\\')) break; *cp++ = c;