1*48643Sbostic /* 2*48643Sbostic * UNET (3Com) TCP-IP server for uucico. 3*48643Sbostic * uucico's UNET channel causes this server to be run at the remote end. 4*48643Sbostic * An argument, if present, is the local port number. 5*48643Sbostic * This server does a tcpopen(III) to establish the connection, 6*48643Sbostic * renames file descriptors 0,1, and 2 to be the UNET connection, 7*48643Sbostic * and then exec(II)s uucico. 8*48643Sbostic */ 9*48643Sbostic 10*48643Sbostic #include <stdio.h> 11*48643Sbostic #include <UNET/unetio.h> 12*48643Sbostic #include <UNET/tcp.h> 13*48643Sbostic 14*48643Sbostic /* Default port of uucico server */ 15*48643Sbostic #define DFLTPORT 33 16*48643Sbostic 17*48643Sbostic main(argc, argv) 18*48643Sbostic int argc; 19*48643Sbostic char **argv; 20*48643Sbostic { 21*48643Sbostic register int lport, fd; 22*48643Sbostic register FILE *fp; 23*48643Sbostic extern int errno; 24*48643Sbostic 25*48643Sbostic lport = DFLTPORT; 26*48643Sbostic if (argc >= 2) 27*48643Sbostic lport = atoi(argv[1]); 28*48643Sbostic if (lport <= 0 || lport > 255) 29*48643Sbostic lport = DFLTPORT; 30*48643Sbostic 31*48643Sbostic fd = tcpopen((char *)0, 0, lport, TO_PASSIVE, "rw"); 32*48643Sbostic if (fd == -1) { 33*48643Sbostic perror("uucico server: tcpopen"); 34*48643Sbostic exit(1); 35*48643Sbostic } 36*48643Sbostic close(0); close(1); 37*48643Sbostic dup(fd); dup(fd); 38*48643Sbostic execl("/usr/lib/uucp/uucico", "uucico", (char *)0); 39*48643Sbostic perror("uucico server: execl"); 40*48643Sbostic exit(1); 41*48643Sbostic } 42