about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Src/Modules/tcp.c10
2 files changed, 11 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 93af34f88..f6f2e72b6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2001-09-08  Clint Adams  <clint@zsh.org>
 
+	* 1576x: Src/Modules/tcp.c: add -v (verbose)
+	for ztcp.
+
 	* 15762: Src/Modules/tcp.c, Src/Modules/tcp.h,
 	Src/Modules/tcp.mdd, Src/Modules/zftp.c:
 	introduce ztcp builtin.
diff --git a/Src/Modules/tcp.c b/Src/Modules/tcp.c
index eb2d49f0b..ab87a98c0 100644
--- a/Src/Modules/tcp.c
+++ b/Src/Modules/tcp.c
@@ -381,13 +381,16 @@ tcp_connect(Tcp_session sess, char *addrp, struct hostent *zhost, int d_port)
 static int
 bin_ztcp(char *nam, char **args, char *ops, int func)
 {
-    int herrno, err=1, destport, force=0, len;
+    int herrno, err=1, destport, force=0, verbose=0, len;
     char **addrp, *desthost;
     struct hostent *zthost = NULL;
     Tcp_session sess;
 
     if (ops['f'])
 	force=1;
+
+    if (ops['v'])
+	verbose=1;
     
     if (ops['c']) {
 	if (!args[0]) {
@@ -473,7 +476,10 @@ bin_ztcp(char *nam, char **args, char *ops, int func)
 	    zwarnnam(nam, "connection failed: %e", NULL, errno);
 	else
 	{
-	    fprintf(shout, "%s:%d is now on fd %d\n", desthost, destport, sess->fd);
+	    if(verbose)
+		fprintf(shout, "%s:%d is now on fd %d\n", desthost, destport, sess->fd);
+	    else
+		fprintf(shout, "%d\n", sess->fd);
 	}
 	
 	zsfree(desthost);