Annotation of researchv10dc/cmd/uucp/uuname.c, revision 1.1.1.1

1.1       root        1: /*     /sccs/src/cmd/uucp/s.uuname.c
                      2:        uuname.c        1.1     8/30/84 17:38:10
                      3: */
                      4: #include "uucp.h"
                      5: VERSION(@(#)uuname.c   1.1);
                      6:  
                      7: /*
                      8:  * returns a list of all remote systems.
                      9:  * option:
                     10:  *     -l      -> returns only the local system name.
                     11:  */
                     12: main(argc,argv, envp)
                     13: int argc;
                     14: char **argv, **envp;
                     15: {
                     16:        FILE *np;
                     17:        register int nexpl = 0;
                     18:        register int err = 0;
                     19:        char s[BUFSIZ], prev[BUFSIZ], name[BUFSIZ];
                     20: #ifdef MANYSYS
                     21:        FILE *sysopen();
                     22: #endif
                     23: 
                     24:        while (--argc > 0) {
                     25:                if (strcmp(*++argv, "-l") == 0) {
                     26:                        nexpl++;
                     27:                        uucpname(name);
                     28:                        /* initialize to null string */
                     29:                        (void) printf("%s",name);
                     30:                        (void) printf("\n");
                     31:                }
                     32:                else {
                     33:                        nexpl++;
                     34:                        if (versys(*argv, 0) != FAIL)
                     35:                                printf("%s\n", argv[0]);
                     36:                        else
                     37:                                err++;
                     38:                }
                     39:        }
                     40:        if (nexpl)
                     41:                exit(err);
                     42: #ifndef MANYSYS
                     43: #define        SYSCLOSE        fclose
                     44:        np=fopen(SYSFILE, "r");
                     45: #else
                     46: #define        SYSCLOSE        pclose
                     47:        np = sysopen("---");
                     48: #endif
                     49:        if ((np) == NULL) {
                     50:                (void) fprintf(stderr, "Can't read Systems files");
                     51:                exit(1);
                     52:        }
                     53:        while (fgets(s, BUFSIZ, np) != NULL) {
                     54:                if((s[0] == '#') || (s[0] == ' ') || (s[0] == '\t') || 
                     55:                    (s[0] == '\n'))
                     56:                        continue;
                     57:                (void) sscanf(s, "%s", name);
                     58:                if (EQUALS(name, prev))
                     59:                    continue;
                     60:                (void) printf("%s", name);
                     61:                (void) printf("\n");
                     62:                (void) strcpy(prev, name);
                     63:        }
                     64:        SYSCLOSE(np);
                     65:        exit(err);
                     66: }

unix.superglobalmegacorp.com

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