1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-11-01 18:30:55 +01:00

1596x: ztcp -v

This commit is contained in:
Clint Adams 2001-09-08 22:08:04 +00:00
parent b554563ece
commit 9a31296b3e
2 changed files with 11 additions and 2 deletions

View file

@ -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.

View file

@ -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);