--- /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
--- 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 <stdio.h>
#include <stdlib.h>
@@ -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);