Annotation of 43BSD/usr.bin/uucp/uulog.c, revision 1.1.1.1

1.1       root        1: #ifndef lint
                      2: static char sccsid[] = "@(#)uulog.c    5.4 (Berkeley) 6/23/85";
                      3: #endif
                      4: 
                      5: #include "uucp.h"
                      6: 
                      7: #ifndef        SYSBUF
                      8: static char SYSBUF[BUFSIZ];
                      9: #endif
                     10: 
                     11: main(argc, argv)
                     12: char *argv[];
                     13: {
                     14:        FILE *plogf;
                     15:        char *sys, *user;
                     16: 
                     17:        char buf[BUFSIZ], u[64], s[64];
                     18: 
                     19:        setbuf(stdout, SYSBUF);
                     20:        strcpy(Progname, "uulog");
                     21:        sys = user = NULL;
                     22: 
                     23: 
                     24:        while (argc>1 && argv[1][0] == '-') {
                     25:                switch (argv[1][1]) {
                     26:                case 's':
                     27:                        sys = &argv[1][2];
                     28:                        if (*sys == NULL && argc > 2 && argv[2][0] != '-') {
                     29:                                sys = &argv[2][0];
                     30:                                argv++;
                     31:                                argc--;
                     32:                        }
                     33:                        if (strlen(sys) > MAXBASENAME)
                     34:                                sys[MAXBASENAME] = '\0';
                     35:                        if (versys(&sys) != SUCCESS){
                     36:                                fprintf(stderr,"uulog: unknown system %s\n", sys);
                     37:                                sys = NULL;
                     38:                        }
                     39:                        break;
                     40:                case 'u':
                     41:                        user = &argv[1][2];
                     42:                        if (*user == NULL && argc > 2 && argv[2][0] != '-') {
                     43:                                user = &argv[2][0];
                     44:                                argv++;
                     45:                                argc--;
                     46:                        }
                     47:                        break;
                     48:                default:
                     49:                        printf("unknown flag %s\n", argv[1]); break;
                     50:                }
                     51:                --argc;  argv++;
                     52:        }
                     53: 
                     54: 
                     55:        if (user == NULL && sys == NULL) {
                     56:                fprintf(stderr, "usage: uulog [-u user] [-s sys]\n");
                     57:                exit(1);
                     58:        }
                     59: 
                     60: #ifdef LOGBYSITE
                     61:        if (chdir(SPOOL) < 0) {
                     62:                perror(SPOOL);
                     63:                exit(1);
                     64:        }
                     65:        /* this program is really obsolete, this is a rude backward compat */
                     66:        if (user) {
                     67:                sprintf(buf, "exec cat LOG/uu*/* | egrep '^%s '", user);
                     68:                system(buf);
                     69:        }
                     70:        if (sys) {
                     71:                sprintf(buf,"exec cat LOG/uu*/%s", sys);
                     72:                system(buf);
                     73:        }
                     74: #else !LOGBYSITE
                     75:        plogf = fopen(LOGFILE, "r");
                     76:        ASSERT(plogf != NULL, "CAN NOT OPEN", LOGFILE, 0);
                     77:        while (fgets(buf, BUFSIZ, plogf) != NULL) {
                     78:                sscanf(buf, "%s%s", u, s);
                     79:                if (user != NULL && !prefix(user, u))
                     80:                        continue;
                     81:                if (sys != NULL && !prefix(sys, s))
                     82:                        continue;
                     83:                fputs(buf, stdout);
                     84:                fflush(stdout);
                     85:        }
                     86: #endif !LOGBYSITE
                     87:        exit(0);
                     88: }
                     89: 
                     90: cleanup(code)
                     91: int code;
                     92: {
                     93:        exit(code);
                     94: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.