diff options
author | Clint Adams <clint@users.sourceforge.net> | 2001-09-10 19:19:15 +0000 |
---|---|---|
committer | Clint Adams <clint@users.sourceforge.net> | 2001-09-10 19:19:15 +0000 |
commit | ab205e5bb9e47f97f6dd6b25789e114d275334e8 (patch) | |
tree | 4b8bf2b04cb032b0b607ae1060430be32c8290b2 | |
parent | 2e174804c82e533c93ec90d14b366dfe3f0263d6 (diff) | |
download | zsh-ab205e5bb9e47f97f6dd6b25789e114d275334e8.tar.gz zsh-ab205e5bb9e47f97f6dd6b25789e114d275334e8.tar.xz zsh-ab205e5bb9e47f97f6dd6b25789e114d275334e8.zip |
15780: rename **arg to **dargs
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | Src/Modules/tcp.c | 38 |
2 files changed, 22 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog index e9ffabbd8..e9cdec3e1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2001-09-10 Clint Adams <clint@zsh.org> + * 15780: Src/Modules/tcp.c: tweak variable name. + * 15779: Src/Modules/tcp.c: add -d (specify fd) for ztcp. diff --git a/Src/Modules/tcp.c b/Src/Modules/tcp.c index a5796cfee..cde2c2374 100644 --- a/Src/Modules/tcp.c +++ b/Src/Modules/tcp.c @@ -386,7 +386,7 @@ static int bin_ztcp(char *nam, char **args, char *ops, int func) { int herrno, err=1, destport, force=0, verbose=0, test=0, targetfd=0, len; - char **addrp, *desthost, *localname, *remotename, **arg = args; + char **addrp, *desthost, *localname, *remotename, **dargs; struct hostent *zthost = NULL, *ztpeer = NULL; struct servent *srv; Tcp_session sess = NULL; @@ -401,25 +401,27 @@ bin_ztcp(char *nam, char **args, char *ops, int func) test = 1; if (ops['d']) { - targetfd = atoi(arg[0]); - arg++; + targetfd = atoi(args[0]); + dargs = args + 1; if (!targetfd) { zwarnnam(nam, "%s is an invalid argument to -d", args[0], 0); return 1; } } + else + dargs = args; if (ops['c']) { - if (!arg[0]) { + if (!dargs[0]) { tcp_cleanup(); } else { - targetfd = atoi(arg[0]); + targetfd = atoi(dargs[0]); sess = zts_byfd(targetfd); if(!targetfd) { - zwarnnam(nam, "%s is an invalid argument to -c", arg[0], 0); + zwarnnam(nam, "%s is an invalid argument to -c", dargs[0], 0); return 1; } @@ -435,7 +437,7 @@ bin_ztcp(char *nam, char **args, char *ops, int func) } else { - zwarnnam(nam, "fd %s not found in tcp table", arg[0], 0); + zwarnnam(nam, "fd %s not found in tcp table", dargs[0], 0); return 1; } } @@ -443,16 +445,16 @@ bin_ztcp(char *nam, char **args, char *ops, int func) else if (ops['l']) { int lport = 0; - if (!arg[0]) { + if (!dargs[0]) { zwarnnam(nam, "-l requires an argument", NULL, 0); return 1; } - srv = getservbyname(arg[0], "tcp"); + srv = getservbyname(dargs[0], "tcp"); if (srv) lport = srv->s_port; else - lport = htons(atoi(arg[0])); + lport = htons(atoi(dargs[0])); if (!lport) { zwarnnam(nam, "bad service name or port number", NULL, 0); return 1; } @@ -511,12 +513,12 @@ bin_ztcp(char *nam, char **args, char *ops, int func) { int lfd, rfd; - if (!arg[0]) { + if (!dargs[0]) { zwarnnam(nam, "-a requires an argument", NULL, 0); return 1; } - lfd = atoi(arg[0]); + lfd = atoi(dargs[0]); if (!lfd) { zwarnnam(nam, "invalid numerical argument", NULL, 0); @@ -525,7 +527,7 @@ bin_ztcp(char *nam, char **args, char *ops, int func) sess = zts_byfd(lfd); if (!sess) { - zwarnnam(nam, "fd %s is not registered as a tcp connection", arg[0], 0); + zwarnnam(nam, "fd %s is not registered as a tcp connection", dargs[0], 0); return 1; } @@ -575,7 +577,7 @@ bin_ztcp(char *nam, char **args, char *ops, int func) else { - if (!arg[0]) { + if (!dargs[0]) { for(sess = zts_head(); sess != NULL; sess = zts_next(sess)) { if (sess->fd != -1) @@ -595,19 +597,19 @@ bin_ztcp(char *nam, char **args, char *ops, int func) } return 0; } - else if (!arg[1]) { + else if (!dargs[1]) { destport = htons(23); } else { - srv = getservbyname(arg[1],"tcp"); + srv = getservbyname(dargs[1],"tcp"); if (srv) destport = srv->s_port; else - destport = htons(atoi(arg[1])); + destport = htons(atoi(dargs[1])); } - desthost = ztrdup(arg[0]); + desthost = ztrdup(dargs[0]); zthost = zsh_getipnodebyname(desthost, AF_INET, 0, &herrno); if (!zthost || errflag) { |