version 1.15, 1998/12/28 06:28:15 |
version 1.16, 1999/01/04 19:24:17 |
|
|
int monitor = 0; /* Don't do monitoring by default */ |
int monitor = 0; /* Don't do monitoring by default */ |
char *conf = CONF; /* Configuration file to use */ |
char *conf = CONF; /* Configuration file to use */ |
time_t timenow; |
time_t timenow; |
#define MIN_PID 3 |
#define MIN_PID 4 |
#define MAX_PID 99999 |
#define MAX_PID 99999 |
char hostname[MAXHOSTNAMELEN]; /* hostname */ |
char hostname[MAXHOSTNAMELEN]; /* hostname */ |
char *daytime; /* timenow in human readable form */ |
char *daytime; /* timenow in human readable form */ |
|
|
void domonitor __P((char *, char *)); |
void domonitor __P((char *, char *)); |
FILE *openmail __P((void)); |
FILE *openmail __P((void)); |
void closemail __P((FILE *)); |
void closemail __P((FILE *)); |
|
void child_killer __P((int)); |
|
|
int main(argc, argv) |
int main(argc, argv) |
int argc; |
int argc; |
char **argv; |
char **argv; |
{ |
{ |
struct conf_entry *p, *q; |
struct conf_entry *p, *q; |
|
int status; |
|
|
PRS(argc,argv); |
PRS(argc,argv); |
if (needroot && getuid() && geteuid()) |
if (needroot && getuid() && geteuid()) |
errx(1, "You must be root."); |
errx(1, "You must be root."); |
p = q = parse_file(); |
p = q = parse_file(); |
|
signal(SIGCHLD, child_killer); |
while (p) { |
while (p) { |
do_entry(p); |
do_entry(p); |
p=p->next; |
p=p->next; |
free(q); |
free(q); |
q=p; |
q=p; |
} |
} |
|
|
|
/* Wait for children to finish, then exit */ |
|
while (waitpid(-1, &status, 0) != -1) |
|
; |
exit(0); |
exit(0); |
} |
} |
|
|
|
|
return(0); |
return(0); |
} |
} |
|
|
/* Fork of /usr/ucb/compress to compress the old log file */ |
/* Fork off compress or gzip to compress the old log file */ |
void compress_log(log) |
void compress_log(log) |
char *log; |
char *log; |
{ |
{ |
|
|
err(1, "fork"); |
err(1, "fork"); |
} else if (!pid) { |
} else if (!pid) { |
(void) execl(COMPRESS,"compress","-f",tmp,0); |
(void) execl(COMPRESS,"compress","-f",tmp,0); |
err(1, COMPRESS); |
warn(COMPRESS); |
|
_exit(1); |
} |
} |
} |
} |
|
|
|
|
FILE *pfp; |
FILE *pfp; |
{ |
{ |
pclose(pfp); |
pclose(pfp); |
|
} |
|
|
|
void child_killer(signum) |
|
int signum; |
|
{ |
|
int status; |
|
|
|
while (waitpid(-1, &status, WNOHANG) > 0) |
|
; |
} |
} |