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

Diff for /src/usr.bin/chpass/edit.c between version 1.10 and 1.11

version 1.10, 1996/09/01 13:06:51 version 1.11, 1996/09/23 09:41:02
Line 148 
Line 148 
         char *p;          char *p;
         struct stat sb;          struct stat sb;
         FILE *fp;          FILE *fp;
         int len, alen;          int len, alen, line;
         static char buf[LINE_MAX];          static char buf[LINE_MAX];
   
         if (!(fp = fopen(tempname, "r")))          if (!(fp = fopen(tempname, "r")))
Line 159 
Line 159 
                 warnx("corrupted temporary file");                  warnx("corrupted temporary file");
                 goto bad;                  goto bad;
         }          }
           line = 0;
         while (fgets(buf, sizeof(buf), fp)) {          while (fgets(buf, sizeof(buf), fp)) {
                   line++;
                 if (!buf[0] || buf[0] == '#')                  if (!buf[0] || buf[0] == '#')
                         continue;                          continue;
                 if (!(p = strchr(buf, '\n'))) {                  if (!(p = strchr(buf, '\n'))) {
                         warnx("line too long");                          warnx("line %d too long", line);
                         goto bad;                          goto bad;
                 }                  }
                 *p = '\0';                  *p = '\0';
                 for (ep = list;; ++ep) {                  for (ep = list;; ++ep) {
                         if (!ep->prompt) {                          if (!ep->prompt) {
                                 warnx("unrecognized field");                                  warnx("unrecognized field on line %d", line);
                                 goto bad;                                  goto bad;
                         }                          }
                         if (!strncasecmp(buf, ep->prompt, ep->len)) {                          if (!strncasecmp(buf, ep->prompt, ep->len)) {
Line 180 
Line 182 
                                         goto bad;                                          goto bad;
                                 }                                  }
                                 if (!(p = strchr(buf, ':'))) {                                  if (!(p = strchr(buf, ':'))) {
                                         warnx("line corrupted");                                          warnx("line %d corrupted", line);
                                         goto bad;                                          goto bad;
                                 }                                  }
                                 while (isspace(*++p));                                  while (isspace(*++p));

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11