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