|
|
1.1 root 1: #include <stdio.h>
2: #include <signal.h>
3: FILE *fmp;
4: FILE *fp;
5: char bigargs[1024];
6: char exarg[BUFSIZ];
7: main(argc, argv)
8: int argc;
9: char **argv;
10: {
11: char *arg;
12: int retval;
13: int c;
14: int count;
15:
16: retval = atoi(argv[1]);
17: (void) signal(SIGPIPE, SIG_IGN);
18: strcpy(bigargs, "mail wgl ");
19: if ((fmp = popen(bigargs, "w")) == NULL)
20: exit(-1);
21: fprintf(fmp, "Ping says: ");
22: count = 1;
23: while ((arg = *argv++) != NULL) {
24: fprintf(fmp, "[%s]:\n ", arg);
25: if (count++ > 1) {
26: if ((fp = fopen(arg, "r")) == NULL)
27: fprintf(fmp, "unable to open %s\n", arg);
28: else {
29: while ((c = getc(fp)) != EOF)
30: putc(c, fmp);
31: fclose(fp);
32: }
33: } else
34: fprintf(fmp, "\n");
35: }
36: fprintf(fmp, "\n\n");
37: exit(pclose(fmp) | retval);
38: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.