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

Defined functions

intrEXIT defined in line 66; used 13 times
main defined in line 16; never used

Defined variables

sccsid defined in line 2; never used
Last modified: 1983-07-03
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 840
Valid CSS Valid XHTML 1.0 Strict