httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Hartill <hart...@ooo.lanl.gov>
Subject Re: WWW Form Bug Report: "getline() function in util.c is (fwd)
Date Tue, 21 May 1996 13:41:50 GMT

Hmmm, looks like old code. Anyone see what bug he's trying to
squash and if it affects 1.1 ?

 
> > Here you go.
> > 
> int getline(char *s, int n, FILE *f) {
> /*
>   read line from specified file; returns nz=EOF
> 
>   Modified 05/96 by Mike Perry (mdperry@icorp.net) to correct a bug 
>   which truncates the last char read if max line size is reached.
> */
>   register int i=0;
>   n--;  /* you might want to remove n--, depending upon how you id string
> length */
>   while(i<n) {
>     s[i] = (char)fgetc(f);
>     if(s[i] == CR)
>       s[i] = fgetc(f);
>     if((s[i] == 0x4) || (s[i] == LF) ) {
>       s[i] = '\0';
>       return (feof(f) ? 1 : 0);
>     }
>     ++i;
>   }
>   s[n]='\0';
>   return (feof(f) ? 1 : 0);
> }
> 
 
 

Mime
View raw message