[BACK]Return to fileio.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mg

Diff for /src/usr.bin/mg/fileio.c between version 1.36 and 1.37

version 1.36, 2003/05/08 12:37:13 version 1.37, 2003/08/15 23:09:57
Line 14 
Line 14 
 #include <string.h>  #include <string.h>
 #include <fcntl.h>  #include <fcntl.h>
 #include <unistd.h>  #include <unistd.h>
   #include <ctype.h>
   
 /*  /*
  * Open a file for reading.   * Open a file for reading.
Line 435 
Line 436 
 d_makename(LINE *lp, char *fn, int len)  d_makename(LINE *lp, char *fn, int len)
 {  {
         int i;          int i;
         char *p, *np;          char *p, *ep;
   
         strlcpy(fn, curbp->b_fname, len);          strlcpy(fn, curbp->b_fname, len);
         p = lp->l_text;          p = lp->l_text;
           ep = lp->l_text + llength(lp);
         for (i = 0; i < NAME_FIELD; i++) {          for (i = 0; i < NAME_FIELD; i++) {
                 np = strpbrk(p, "\t ");                  while (p < ep && isspace(*p))
                 if (np == NULL)  
                         return ABORT;  
                 p = np + 1;  
                 while (*p != '\0' && strchr("\t ", *p))  
                         p++;                          p++;
                   while (p < ep && !isspace(*p))
                           p++;
                   while (p < ep && isspace(*p))
                           p++;
                   if (p == ep)
                           return (ABORT);
         }          }
         strlcat(fn, p, len);          strlcat(fn, p, len);
         return lgetc(lp, 2) == 'd';          return lgetc(lp, 2) == 'd';

Legend:
Removed from v.1.36  
changed lines
  Added in v.1.37