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

Diff for /src/usr.bin/error/Attic/filter.c between version 1.4 and 1.5

version 1.4, 1999/08/06 20:41:07 version 1.5, 1999/12/04 00:16:52
Line 41 
Line 41 
 static char rcsid[] = "$OpenBSD$";  static char rcsid[] = "$OpenBSD$";
 #endif /* not lint */  #endif /* not lint */
   
 #include <sys/types.h>  #include <sys/param.h>
 #include <pwd.h>  #include <pwd.h>
 #include <unistd.h>  #include <unistd.h>
 #include <stdio.h>  #include <stdio.h>
Line 70 
Line 70 
         FILE    *fyle;          FILE    *fyle;
         char    inbuffer[256];          char    inbuffer[256];
         uid_t   uid;          uid_t   uid;
         char    filename[128];          char    filename[MAXPATHLEN];
         char    *username;          char    *username;
         struct  passwd *passwdentry;          struct  passwd *passwdentry;
   
Line 86 
Line 86 
                         if ( (passwdentry = (struct passwd *)getpwnam(username)) == NULL)                          if ( (passwdentry = (struct passwd *)getpwnam(username)) == NULL)
                                 return;                                  return;
                 }                  }
                 strcpy(filename, passwdentry->pw_dir);                  strlcpy(filename, passwdentry->pw_dir, sizeof(filename));
                 (void)strcat(filename, ERRORNAME);                  (void)strlcat(filename, ERRORNAME, sizeof(filename));
         } else          } else
                 (void)strcpy(filename, auxname);                  (void)strlcpy(filename, auxname, sizeof filename);
 #ifdef FULLDEBUG  #ifdef FULLDEBUG
         printf("Opening file \"%s\" to read names to ignore.\n",          printf("Opening file \"%s\" to read names to ignore.\n",
                 filename);                  filename);
Line 103 
Line 103 
         /*          /*
          *      Make the first pass through the file, counting lines           *      Make the first pass through the file, counting lines
          */           */
         for (nignored = 0; fgets(inbuffer, 255, fyle) != NULL; nignored++)          for (nignored = 0;
               fgets(inbuffer, sizeof(inbuffer)-1, fyle) != NULL; nignored++)
                 continue;                  continue;
         names_ignored = (char **)Calloc(nignored+1, sizeof (char *));          names_ignored = (char **)Calloc(nignored+1, sizeof (char *));
         fclose(fyle);          fclose(fyle);
Line 114 
Line 115 
                 nignored = 0;                  nignored = 0;
                 return;                  return;
         }          }
         for (i=0; i < nignored && (fgets (inbuffer, 255, fyle) != NULL); i++){          for (i=0; i < nignored &&
               (fgets (inbuffer, sizeof(inbuffer)-1, fyle) != NULL); i++){
                 names_ignored[i] = strsave(inbuffer);                  names_ignored[i] = strsave(inbuffer);
                 (void)substitute(names_ignored[i], '\n', '\0');                  (void)substitute(names_ignored[i], '\n', '\0');
         }          }

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5