xref: /csrg-svn/libexec/uucpd/uucpd.c (revision 17144)
1*17144Sralph #ifndef lint
2*17144Sralph static char sccsid[] = "@(#)uucpd.c	5.1 (BERKELEY) 08/31/84";
3*17144Sralph #endif
4*17144Sralph 
5*17144Sralph /*
6*17144Sralph  * UUCP server daemon
7*17144Sralph  * 	Looks for attempts to connect on our uucp socket.  When it
8*17144Sralph  *	finds one it execs uucico to handle it.
9*17144Sralph  *
10*17144Sralph  * Invoked by inetd.
11*17144Sralph  */
12*17144Sralph 
13*17144Sralph #include <stdio.h>
14*17144Sralph #include <syslog.h>
15*17144Sralph #include <errno.h>
16*17144Sralph #include <sys/types.h>
17*17144Sralph #include <sys/socket.h>
18*17144Sralph #include <netinet/in.h>
19*17144Sralph 
20*17144Sralph #define	UUCICO	"/usr/lib/uucp/uucico"
21*17144Sralph 
22*17144Sralph extern int errno;
23*17144Sralph 
24*17144Sralph main(argc, argv)
25*17144Sralph 	int argc;
26*17144Sralph 	char **argv;
27*17144Sralph {
28*17144Sralph 	int status, fromlen;
29*17144Sralph 	struct sockaddr_in from;
30*17144Sralph 
31*17144Sralph 	fromlen = sizeof(from);
32*17144Sralph 	if (getpeername(0, &from, &fromlen) < 0) {
33*17144Sralph 		fprintf(stderr, "%s: ", argv[0]);
34*17144Sralph 		perror("getpeername");
35*17144Sralph 		_exit(1);
36*17144Sralph 	}
37*17144Sralph 
38*17144Sralph 	execl(UUCICO, "UUCICO", "-r0", "-v", 0);
39*17144Sralph 	openlog("uucpd", 0, 0);
40*17144Sralph 	syslog(LOG_ERR, "%s: %m", UUCICO);
41*17144Sralph 	exit(1);
42*17144Sralph }
43