File:  [CSRG BSD Unix] / 43BSDReno / usr.bin / uucp / uuname.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:55 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43reno
BSD 4.3reno

#ifndef lint
static char sccsid[] = "@(#)uuname.c	5.4	(Berkeley) 4/5/88";
#endif

#include "uucp.h"

/*
 * return list of all remote systems recognized by uucp, or  (with -l) the
 * local  uucp name. 
 *
 * return codes: 0 | 1  (can't read) 
 */

struct timeb Now;

main(argc, argv)
char *argv[];
int argc;
{
	register FILE *np;
	register char *buf;
	char s[BUFSIZ];
	char prev[BUFSIZ];

	strcpy(Progname, "uuname");

	if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'l') {
		uucpname(s);
		puts(s);
		exit(0);
	}
	if (argc != 1) {
		fprintf(stderr, "Usage: uuname [-l]\n");
		exit(1);
	}
	if ((np = fopen(SYSFILE, "r")) == NULL) {
		syslog(LOG_WARNING, "fopen(%s) failed: %m", SYSFILE);
		exit(1);
	}
	buf = s;
	while (cfgets(buf, sizeof(s), np) != NULL) {
		register char *cp;
		cp = strpbrk(buf, " \t");
		if (cp)
			*cp = '\0';
		if (strcmp(s, prev) == SAME)
			continue;
		if (*buf == 'x' && buf[1] == 'x' && buf[2] == 'x')
			continue;
		puts(buf);
		if (buf == s)
			buf = prev;
		else
			buf = s;
	}
	exit(0);
}

cleanup(code)
int code;
{
	exit(code);
}

unix.superglobalmegacorp.com

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