# HG changeset patch # User lbatlle@npdl268.bpo.hp.com # Date 1186669914 -7200 # Node ID 53b2466f1c2f9af3f92488e3dd4a9dc2518a382b # Parent c3156fd18d147ddb7fb0a9262fb0713bbe4c17b6# Parent e5fc2f4d0c5cb22a163317df68272a3d29a2d9d8 Merged heads diff -r c3156fd18d14 -r 53b2466f1c2f .hgtags --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgtags Thu Aug 09 16:31:54 2007 +0200 @@ -0,0 +1,1 @@ +6102b11bac4969e3212851caf3b1b95fca74f37f v0.1 diff -r c3156fd18d14 -r 53b2466f1c2f tcpscript.c --- a/tcpscript.c Thu Aug 09 16:13:17 2007 +0200 +++ b/tcpscript.c Thu Aug 09 16:31:54 2007 +0200 @@ -39,7 +39,7 @@ */ /* - * tcpscript - Modified from script - 2007 Lluis Batlle i Rossell + * tcpscript - Modified from 'script' - 2007 Lluis Batlle i Rossell */ #include #include @@ -97,6 +97,8 @@ enum { MAXCONNS = 10 }; +static int accept_socket; +const char version[] = "0.1"; int conns[MAXCONNS]; int nconns = 0; @@ -140,8 +142,9 @@ if (argc == 2) { if (!strcmp(argv[1], "-V") || !strcmp(argv[1], "--version")) { - printf("%s, modification of 'script', by %s\n", - progname, "Lluis Batlle i Rossell 2007"); + printf("%s %s, modification of 'script' by %s\n", + progname, version, + "Lluis Batlle i Rossell 2007"); return 0; } } @@ -176,6 +179,8 @@ getmaster(); fixtty(); + accept_socket = listen_tcp(); + (void) signal(SIGCHLD, finish); child = fork(); if (child < 0) { @@ -191,9 +196,15 @@ if (child) dooutput(); else + { + close(accept_socket); doshell(); + } } else + { + close(accept_socket); (void) signal(SIGWINCH, resize); + } doinput(); return 0; @@ -236,6 +247,7 @@ void fatal() { + done(); exit(-1); } @@ -331,7 +343,6 @@ fd_set should_read_set; fd_set tcp_set; - accept_socket = listen_tcp(); FD_ZERO(&should_read_set); FD_SET(accept_socket, &should_read_set); FD_SET(master, &should_read_set);