BSD 3 development
[unix-history] / usr / src / cmd / uucp / uuname.c
CommitLineData
d7fd0a63
BJ
1#include "uucp.h"
2#include <stdio.h>
3char Sysfile[1]; /* for compiler */
4
5
6/*******
7 * uuname - return list of all remote systems
8 * recognized by uucp, or (with -l) the local
9 * uucp name.
10 *
11 * return codes: 0 | 1 (can't read)
12 */
13
14main(argc,argv)
15 char *argv[];
16 int argc;
17{
18 int i;
19 FILE *np;
20 char s[128];
21 if(argv[1][0] == '-' && argv[1][1] == 'l') {
22 uucpname(s);
23 printf("%s\n",s);
24 exit(0);
25 }
26 if(argc != 1) {printf("Usage: uunames [-l]\n"); exit(1);}
27 if((np = fopen(SYSFILE,"r")) == NULL) {
28 printf("%s (name file) protected\n",SYSFILE);
29 exit(1);
30 }
31 while ( fgets(s,128,np) != NULL ) {
32 for(i=0; s[i]!=' '; i++);
33 s[i]='\0';
34 if(s[0]=='x' && s[1]=='x' && s[2]=='x') continue ;
35 printf("%s\n",s);
36 }
37
38 exit(0);
39}