# 2.11BSD#431 - /usr/src/usr.bin/uucp/uuname.c

##### Functions

    cleanup           X
    intrEXIT          X
    main              X

##### Variables

    Now               X

       1: #ifndef lint
       2: static char sccsid[] = "@(#)uuname.c	5.3 (Berkeley) 10/9/85";
       3: #endif
       4:
       5: #include "uucp.h"
       6: #include <signal.h>
       7:
       8: /*
       9:  *      return list of all remote systems
      10:  *	recognized by uucp, or  (with -l) the local  uucp name.
      11:  *
      12:  *      return codes: 0 | 1  (can't read)
      13:  */
      14:
      15: struct timeb Now;
      16:
      17: main(argc,argv)
      18: char *argv[];
      19: int argc;
      20: {
      21:     int ret;
      22:     int i;
      23:     int intrEXIT();
      24:     FILE *np;
      25: /* Increase buffers for s and prev.  cornell!pavel */
      26:     char prev[1000];
      27:     char s[1000];
      28:
      29:     ret = chdir(Spool);
      30:     ASSERT(ret >= 0, "CHDIR FAILED", Spool, ret);
      31:     strcpy(Progname, "uuname");
      32:     signal(SIGILL, intrEXIT);
      33:     signal(SIGTRAP, intrEXIT);
      34:     signal(SIGIOT, intrEXIT);
      35:     signal(SIGEMT, intrEXIT);
      36:     signal(SIGFPE, intrEXIT);
      37:     signal(SIGBUS, intrEXIT);
      38:     signal(SIGSEGV, intrEXIT);
      39:     signal(SIGSYS, intrEXIT);
      40:     signal(SIGINT, intrEXIT);
      41:     signal(SIGHUP, intrEXIT);
      42:     signal(SIGQUIT, intrEXIT);
      43:     signal(SIGTERM, intrEXIT);
      44:
      45:     if(argc > 1 && argv[1][0] == '-' && argv[1][1] == 'l') {
      46:         uucpname(s);
      47:         printf("%s\n",s);
      48:         exit(0);
      49:     }
      50:         if(argc != 1) {printf("Usage: uuname [-l]\n"); exit(1);}
      51:     if((np = fopen(SYSFILE,"r")) == NULL) {
      52:         printf("%s (name file) protected\n",SYSFILE);
      53:         exit(1);
      54:     }
      55:     while ( cfgets(s,sizeof(s),np) != NULL ) {
      56:         for(i=0; s[i]!=' ' && s[i]!='\t'; i++)
      57:             ;
      58:         s[i]='\0';
      59:         if (strcmp(s, prev) == SAME)
      60:             continue;
      61:         if(s[0]=='x' && s[1]=='x' && s[2]=='x')
      62:             continue;
      63:         printf("%s\n",s);
      64:         strcpy(prev, s);
      65:     }
      66:
      67:     exit(0);
      68: }
      69: intrEXIT(inter)
      70: {
      71:     exit(inter);
      72: }
      73:
      74: cleanup(code)
      75: int code;
      76: {
      77:     exit(code);
      78: }

#### Defined functions

cleanup defined in line 74; never used
intrEXIT defined in line 69; used 13 times

- in line 23, 32-43(12)

main defined in line 17; never used

#### Defined variables

Now defined in line 15; never used
sccsid defined in line 2; never used

Last modified: 1987-02-17 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 622 |