Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: ztcp -v



Default to easily-parsable.

Index: Src/Modules/tcp.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/tcp.c,v
retrieving revision 1.5
diff -u -r1.5 tcp.c
--- Src/Modules/tcp.c	2001/09/08 21:09:56	1.5
+++ Src/Modules/tcp.c	2001/09/08 21:35:30
@@ -381,13 +381,16 @@
 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 @@
 	    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);



Messages sorted by: Reverse Date, Date, Thread, Author