version 1.4, 1999/08/06 20:41:07 |
version 1.5, 1999/12/04 00:16:52 |
|
|
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> |
|
|
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; |
|
|
|
|
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); |
|
|
/* |
/* |
* 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); |
|
|
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'); |
} |
} |