diff options
Diffstat (limited to 'Src/Modules')
-rw-r--r-- | Src/Modules/cap.c | 8 | ||||
-rw-r--r-- | Src/Modules/clone.c | 10 | ||||
-rw-r--r-- | Src/Modules/datetime.c | 4 | ||||
-rw-r--r-- | Src/Modules/files.c | 14 | ||||
-rw-r--r-- | Src/Modules/langinfo.c | 2 | ||||
-rw-r--r-- | Src/Modules/mathfunc.c | 2 | ||||
-rw-r--r-- | Src/Modules/parameter.c | 22 | ||||
-rw-r--r-- | Src/Modules/pcre.c | 13 | ||||
-rw-r--r-- | Src/Modules/socket.c | 28 | ||||
-rw-r--r-- | Src/Modules/stat.c | 26 | ||||
-rw-r--r-- | Src/Modules/system.c | 12 | ||||
-rw-r--r-- | Src/Modules/tcp.c | 47 | ||||
-rw-r--r-- | Src/Modules/termcap.c | 6 | ||||
-rw-r--r-- | Src/Modules/terminfo.c | 6 | ||||
-rw-r--r-- | Src/Modules/zftp.c | 88 | ||||
-rw-r--r-- | Src/Modules/zpty.c | 28 | ||||
-rw-r--r-- | Src/Modules/zselect.c | 21 | ||||
-rw-r--r-- | Src/Modules/zutil.c | 42 |
18 files changed, 185 insertions, 194 deletions
diff --git a/Src/Modules/cap.c b/Src/Modules/cap.c index a84e4d246..875b8c4e5 100644 --- a/Src/Modules/cap.c +++ b/Src/Modules/cap.c @@ -40,11 +40,11 @@ bin_cap(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func)) if(*argv) { caps = cap_from_text(*argv); if(!caps) { - zwarnnam(nam, "invalid capability string", NULL, 0); + zwarnnam(nam, "invalid capability string"); return 1; } if(cap_set_proc(caps)) { - zwarnnam(nam, "can't change capabilites: %e", NULL, errno); + zwarnnam(nam, "can't change capabilites: %e", errno); ret = 1; } } else { @@ -54,7 +54,7 @@ bin_cap(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func)) if(caps) result = cap_to_text(caps, &length); if(!caps || !result) { - zwarnnam(nam, "can't get capabilites: %e", NULL, errno); + zwarnnam(nam, "can't get capabilites: %e", errno); ret = 1; } else puts(result); @@ -92,7 +92,7 @@ bin_setcap(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func)) caps = cap_from_text(*argv++); if(!caps) { - zwarnnam(nam, "invalid capability string", NULL, 0); + zwarnnam(nam, "invalid capability string"); return 1; } diff --git a/Src/Modules/clone.c b/Src/Modules/clone.c index 60a21182b..cc303d063 100644 --- a/Src/Modules/clone.c +++ b/Src/Modules/clone.c @@ -58,10 +58,10 @@ bin_clone(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) mypid = getpid(); #ifdef HAVE_SETSID if (setsid() != mypid) - zwarnnam(nam, "failed to create new session: %e", NULL, errno); + zwarnnam(nam, "failed to create new session: %e", errno); #elif defined(TIOCNOTTY) if (ioctl(SHTTY, TIOCNOTTY, 0)) - zwarnnam(*args, "%e", NULL, errno); + zwarnnam(*args, "%e", errno); setpgrp(0L, mypid); #endif dup2(ttyfd,0); @@ -75,7 +75,7 @@ bin_clone(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) /* Acquire a controlling terminal */ cttyfd = open(*args, O_RDWR); if (cttyfd == -1) - zwarnnam(nam, "%e", NULL, errno); + zwarnnam(nam, "%e", errno); else { #ifdef TIOCSCTTY ioctl(cttyfd, TIOCSCTTY, 0); @@ -86,7 +86,7 @@ bin_clone(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) cttyfd = open("/dev/tty", O_RDWR); if (cttyfd == -1) zwarnnam(nam, "could not make %s my controlling tty, job control " - "disabled", *args, 0); + "disabled", *args); else close(cttyfd); @@ -98,7 +98,7 @@ bin_clone(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) } close(ttyfd); if (pid < 0) { - zerrnam(nam, "fork failed: %e", NULL, errno); + zerrnam(nam, "fork failed: %e", errno); return 1; } lastpid = pid; diff --git a/Src/Modules/datetime.c b/Src/Modules/datetime.c index 80090a65b..8b5ff5d68 100644 --- a/Src/Modules/datetime.c +++ b/Src/Modules/datetime.c @@ -42,7 +42,7 @@ bin_strftime(char *nam, char **argv, Options ops, UNUSED(int func)) if (OPT_ISSET(ops,'s')) { scalar = OPT_ARG(ops, 's'); if (!isident(scalar)) { - zwarnnam(nam, "not an identifier: %s", scalar, 0); + zwarnnam(nam, "not an identifier: %s", scalar); return 1; } } @@ -52,7 +52,7 @@ bin_strftime(char *nam, char **argv, Options ops, UNUSED(int func)) zwarnnam(nam, "%s: %e", argv[1], errno); return 1; } else if (*endptr != '\0') { - zwarnnam(nam, "%s: invalid decimal number", argv[1], 0); + zwarnnam(nam, "%s: invalid decimal number", argv[1]); return 1; } diff --git a/Src/Modules/files.c b/Src/Modules/files.c index 331507c64..079aeac4d 100644 --- a/Src/Modules/files.c +++ b/Src/Modules/files.c @@ -78,7 +78,7 @@ bin_mkdir(char *nam, char **args, Options ops, UNUSED(int func)) mode = zstrtol(str, &ptr, 8); if(!*str || *ptr) { - zwarnnam(nam, "invalid mode `%s'", str, 0); + zwarnnam(nam, "invalid mode `%s'", str); return 1; } } @@ -214,7 +214,7 @@ bin_ln(char *nam, char **args, Options ops, int func) goto havedir; } if(a > args+1) { - zwarnnam(nam, "last of many arguments must be a directory", NULL, 0); + zwarnnam(nam, "last of many arguments must be a directory"); return 1; } if(!args[1]) { @@ -266,7 +266,7 @@ domove(char *nam, MoveFunc move, char *p, char *q, int flags) if(!lstat(qbuf, &st)) { int doit = flags & MV_FORCE; if(S_ISDIR(st.st_mode)) { - zwarnnam(nam, "%s: cannot overwrite directory", q, 0); + zwarnnam(nam, "%s: cannot overwrite directory", q); zsfree(pbuf); return 1; } else if(flags & MV_INTER) { @@ -469,7 +469,7 @@ recursivecmd_dorec(struct recursivecmd const *reccmd, if (restoredir(ds)) { if(!reccmd->opt_noerr) zwarnnam(reccmd->nam, "failed to return to previous directory: %e", - NULL, errno); + errno); return 2; } return err | reccmd->dirpost_func(arg, rp, sp, reccmd->magic); @@ -647,7 +647,7 @@ bin_chown(char *nam, char **args, Options ops, int func) int err; chm.uid = getnumeric(p, &err); if(err) { - zwarnnam(nam, "%s: no such user", p, 0); + zwarnnam(nam, "%s: no such user", p); free(uspec); return 1; } @@ -656,7 +656,7 @@ bin_chown(char *nam, char **args, Options ops, int func) p = end+1; if(!*p) { if(!pwd && !(pwd = getpwuid(chm.uid))) { - zwarnnam(nam, "%s: no such user", uspec, 0); + zwarnnam(nam, "%s: no such user", uspec); free(uspec); return 1; } @@ -673,7 +673,7 @@ bin_chown(char *nam, char **args, Options ops, int func) int err; chm.gid = getnumeric(p, &err); if(err) { - zwarnnam(nam, "%s: no such group", p, 0); + zwarnnam(nam, "%s: no such group", p); free(uspec); return 1; } diff --git a/Src/Modules/langinfo.c b/Src/Modules/langinfo.c index d927358ed..a09c1a0bb 100644 --- a/Src/Modules/langinfo.c +++ b/Src/Modules/langinfo.c @@ -460,7 +460,7 @@ getlanginfo(UNUSED(HashTable ht), char *name) } else { - /* zwarn("no such lang info: %s", name, 0); */ + /* zwarn("no such lang info: %s", name); */ pm->u.str = dupstring(""); pm->node.flags |= PM_UNSET; } diff --git a/Src/Modules/mathfunc.c b/Src/Modules/mathfunc.c index 7b9b10fab..4d58745e8 100644 --- a/Src/Modules/mathfunc.c +++ b/Src/Modules/mathfunc.c @@ -249,7 +249,7 @@ math_func(char *name, int argc, mnumber *argv, int id) } if (rtst) { - zerr("math: argument to %s out of range", name, 0); + zerr("math: argument to %s out of range", name); return ret; } } diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c index 2f9f574e0..c3ec441f8 100644 --- a/Src/Modules/parameter.c +++ b/Src/Modules/parameter.c @@ -183,7 +183,7 @@ static void setpmcommand(Param pm, char *value) { if (isset(RESTRICTED)) { - zwarn("restricted: %s", value, 0); + zwarn("restricted: %s", value); zsfree(value); } else { Cmdnam cn = zshcalloc(sizeof(*cn)); @@ -322,7 +322,7 @@ setfunction(char *name, char *val, int dis) prog = parse_string(val); if (!prog || prog == &dummy_eprog) { - zwarn("invalid function definition", value, 0); + zwarn("invalid function definition", value); zsfree(val); return; } @@ -679,11 +679,11 @@ setpmoption(Param pm, char *value) int n; if (!value || (strcmp(value, "on") && strcmp(value, "off"))) - zwarn("invalid value: %s", value, 0); + zwarn("invalid value: %s", value); else if (!(n = optlookup(pm->node.nam))) - zwarn("no such option: %s", pm->node.nam, 0); + zwarn("no such option: %s", pm->node.nam); else if (dosetopt(n, (value && strcmp(value, "off")), 0)) - zwarn("can't change option: %s", pm->node.nam, 0); + zwarn("can't change option: %s", pm->node.nam); zsfree(value); } @@ -694,9 +694,9 @@ unsetpmoption(Param pm, UNUSED(int exp)) int n; if (!(n = optlookup(pm->node.nam))) - zwarn("no such option: %s", pm->node.nam, 0); + zwarn("no such option: %s", pm->node.nam); else if (dosetopt(n, 0, 0)) - zwarn("can't change option: %s", pm->node.nam, 0); + zwarn("can't change option: %s", pm->node.nam); } /**/ @@ -721,10 +721,10 @@ setpmoptions(UNUSED(Param pm), HashTable ht) val = getstrvalue(&v); if (!val || (strcmp(val, "on") && strcmp(val, "off"))) - zwarn("invalid value: %s", val, 0); + zwarn("invalid value: %s", val); else if (dosetopt(optlookup(hn->nam), (val && strcmp(val, "off")), 0)) - zwarn("can't change option: %s", hn->nam, 0); + zwarn("can't change option: %s", hn->nam); } deleteparamtable(ht); } @@ -1295,7 +1295,7 @@ static void setpmnameddir(Param pm, char *value) { if (!value) - zwarn("invalid value: ''", NULL, 0); + zwarn("invalid value: ''"); else { Nameddir nd = (Nameddir) zshcalloc(sizeof(*nd)); @@ -1344,7 +1344,7 @@ setpmnameddirs(UNUSED(Param pm), HashTable ht) v.pm = (Param) hn; if (!(val = getstrvalue(&v))) - zwarn("invalid value: ''", NULL, 0); + zwarn("invalid value: ''"); else { Nameddir nd = (Nameddir) zshcalloc(sizeof(*nd)); diff --git a/Src/Modules/pcre.c b/Src/Modules/pcre.c index 2336b27d7..3ed536671 100644 --- a/Src/Modules/pcre.c +++ b/Src/Modules/pcre.c @@ -58,7 +58,7 @@ bin_pcre_compile(char *nam, char **args, Options ops, UNUSED(int func)) if (pcre_pattern == NULL) { - zwarnnam(nam, "error in regex: %s", pcre_error, 0); + zwarnnam(nam, "error in regex: %s", pcre_error); return 1; } @@ -76,15 +76,14 @@ bin_pcre_study(char *nam, UNUSED(char **args), UNUSED(Options ops), UNUSED(int f if (pcre_pattern == NULL) { - zwarnnam(nam, "no pattern has been compiled for study", - NULL, 0); + zwarnnam(nam, "no pattern has been compiled for study"); return 1; } pcre_hints = pcre_study(pcre_pattern, 0, &pcre_error); if (pcre_error != NULL) { - zwarnnam(nam, "error while studying regex: %s", pcre_error, 0); + zwarnnam(nam, "error while studying regex: %s", pcre_error); return 1; } @@ -129,14 +128,14 @@ bin_pcre_match(char *nam, char **args, Options ops, UNUSED(int func)) if(OPT_ISSET(ops,'a')) { receptacle = *args++; if(!*args) { - zwarnnam(nam, "not enough arguments", NULL, 0); + zwarnnam(nam, "not enough arguments"); return 1; } } if ((ret = pcre_fullinfo(pcre_pattern, pcre_hints, PCRE_INFO_CAPTURECOUNT, &capcount))) { - zwarnnam(nam, "error %d in fullinfo", NULL, ret); + zwarnnam(nam, "error %d in fullinfo", ret); return 1; } @@ -152,7 +151,7 @@ bin_pcre_match(char *nam, char **args, Options ops, UNUSED(int func)) return 0; } else { - zwarnnam(nam, "error in pcre_exec", NULL, 0); + zwarnnam(nam, "error in pcre_exec"); return 1; } diff --git a/Src/Modules/socket.c b/Src/Modules/socket.c index 2f95a84d5..7ca56b4e7 100644 --- a/Src/Modules/socket.c +++ b/Src/Modules/socket.c @@ -75,12 +75,12 @@ bin_zsocket(char *nam, char **args, Options ops, UNUSED(int func)) targetfd = atoi(OPT_ARG(ops,'d')); if (!targetfd) { zwarnnam(nam, "%s is an invalid argument to -d", - OPT_ARG(ops, 'd'), 0); + OPT_ARG(ops, 'd')); return 1; } if (targetfd <= max_zsh_fd && fdtable[targetfd] != FDT_UNUSED) { zwarnnam(nam, "file descriptor %d is in use by the shell", - NULL, targetfd); + targetfd); return 1; } } @@ -89,7 +89,7 @@ bin_zsocket(char *nam, char **args, Options ops, UNUSED(int func)) char *localfn; if (!args[0]) { - zwarnnam(nam, "-l requires an argument", NULL, 0); + zwarnnam(nam, "-l requires an argument"); return 1; } @@ -98,7 +98,7 @@ bin_zsocket(char *nam, char **args, Options ops, UNUSED(int func)) sfd = socket(PF_UNIX, SOCK_STREAM, 0); if (sfd == -1) { - zwarnnam(nam, "socket error: %e ", NULL, errno); + zwarnnam(nam, "socket error: %e ", errno); return 1; } @@ -114,7 +114,7 @@ bin_zsocket(char *nam, char **args, Options ops, UNUSED(int func)) if (listen(sfd, 1)) { - zwarnnam(nam, "could not listen on socket: %e", NULL, errno); + zwarnnam(nam, "could not listen on socket: %e", errno); close(sfd); return 1; } @@ -141,14 +141,14 @@ bin_zsocket(char *nam, char **args, Options ops, UNUSED(int func)) int lfd, rfd; if (!args[0]) { - zwarnnam(nam, "-a requires an argument", NULL, 0); + zwarnnam(nam, "-a requires an argument"); return 1; } lfd = atoi(args[0]); if (!lfd) { - zwarnnam(nam, "invalid numerical argument", NULL, 0); + zwarnnam(nam, "invalid numerical argument"); return 1; } @@ -163,7 +163,7 @@ bin_zsocket(char *nam, char **args, Options ops, UNUSED(int func)) if ((ret = poll(&pfd, 1, 0)) == 0) return 1; else if (ret == -1) { - zwarnnam(nam, "poll error: %e", NULL, errno); + zwarnnam(nam, "poll error: %e", errno); return 1; } # else @@ -179,14 +179,14 @@ bin_zsocket(char *nam, char **args, Options ops, UNUSED(int func)) if ((ret = select(lfd+1, &rfds, NULL, NULL, &tv))) return 1; else if (ret == -1) { - zwarnnam(nam, "select error: %e", NULL, errno); + zwarnnam(nam, "select error: %e", errno); return 1; } # endif #else - zwarnnam(nam, "not currently supported", NULL, 0); + zwarnnam(nam, "not currently supported"); return 1; #endif } @@ -194,7 +194,7 @@ bin_zsocket(char *nam, char **args, Options ops, UNUSED(int func)) len = sizeof(soun); if ((rfd = accept(lfd, (struct sockaddr *)&soun, &len)) == -1) { - zwarnnam(nam, "could not accept connection: %e", NULL, errno); + zwarnnam(nam, "could not accept connection: %e", errno); return 1; } @@ -214,14 +214,14 @@ bin_zsocket(char *nam, char **args, Options ops, UNUSED(int func)) else { if (!args[0]) { - zwarnnam(nam, "zsocket requires an argument", NULL, 0); + zwarnnam(nam, "zsocket requires an argument"); return 1; } sfd = socket(PF_UNIX, SOCK_STREAM, 0); if (sfd == -1) { - zwarnnam(nam, "socket creation failed: %e", NULL, errno); + zwarnnam(nam, "socket creation failed: %e", errno); return 1; } @@ -229,7 +229,7 @@ bin_zsocket(char *nam, char **args, Options ops, UNUSED(int func)) strncpy(soun.sun_path, args[0], UNIX_PATH_MAX); if ((err = connect(sfd, (struct sockaddr *)&soun, sizeof(struct sockaddr_un)))) { - zwarnnam(nam, "connection failed: %e", NULL, errno); + zwarnnam(nam, "connection failed: %e", errno); close(sfd); return 1; } diff --git a/Src/Modules/stat.c b/Src/Modules/stat.c index 20a09e671..3ffaf9d4d 100644 --- a/Src/Modules/stat.c +++ b/Src/Modules/stat.c @@ -380,10 +380,10 @@ bin_stat(char *name, char **args, Options ops, UNUSED(int func)) iwhich = aptr - statelts; } if (found > 1) { - zwarnnam(name, "%s: ambiguous stat element", arg, 0); + zwarnnam(name, "%s: ambiguous stat element", arg); return 1; } else if (found == 0) { - zwarnnam(name, "%s: no such stat element", arg, 0); + zwarnnam(name, "%s: no such stat element", arg); return 1; } /* if name of link requested, turn on lstat */ @@ -398,8 +398,7 @@ bin_stat(char *name, char **args, Options ops, UNUSED(int func)) if (arg[1]) { arrnam = arg+1; } else if (!(arrnam = *++args)) { - zwarnnam(name, "missing parameter name", - NULL, 0); + zwarnnam(name, "missing parameter name"); return 1; } flags |= STF_ARRAY; @@ -408,8 +407,7 @@ bin_stat(char *name, char **args, Options ops, UNUSED(int func)) if (arg[1]) { hashnam = arg+1; } else if (!(hashnam = *++args)) { - zwarnnam(name, "missing parameter name", - NULL, 0); + zwarnnam(name, "missing parameter name"); return 1; } flags |= STF_HASH; @@ -420,12 +418,12 @@ bin_stat(char *name, char **args, Options ops, UNUSED(int func)) if (arg[1]) { sfd = arg+1; } else if (!(sfd = *++args)) { - zwarnnam(name, "missing file descriptor", NULL, 0); + zwarnnam(name, "missing file descriptor"); return 1; } fd = zstrtol(sfd, &sfd, 10); if (*sfd) { - zwarnnam(name, "bad file descriptor", NULL, 0); + zwarnnam(name, "bad file descriptor"); return 1; } break; @@ -433,14 +431,14 @@ bin_stat(char *name, char **args, Options ops, UNUSED(int func)) if (arg[1]) { timefmt = arg+1; } else if (!(timefmt = *++args)) { - zwarnnam(name, "missing time format", NULL, 0); + zwarnnam(name, "missing time format"); return 1; } /* force string format in order to use time format */ ops->ind['s'] = 1; break; } else { - zwarnnam(name, "bad option: -%c", NULL, *arg); + zwarnnam(name, "bad option: -%c", *arg); return 1; } } @@ -449,7 +447,7 @@ bin_stat(char *name, char **args, Options ops, UNUSED(int func)) if ((flags & STF_ARRAY) && (flags & STF_HASH)) { /* We don't implement setting multiple variables at once */ - zwarnnam(name, "both array and hash requested", NULL, 0); + zwarnnam(name, "both array and hash requested"); return 1; /* Alternate method would be to make -H blank arrnam etc etc * * and so get 'silent loss' of earlier choice, which would * @@ -481,10 +479,10 @@ bin_stat(char *name, char **args, Options ops, UNUSED(int func)) } if (!*args && !OPT_ISSET(ops,'f')) { - zwarnnam(name, "no files given", NULL, 0); + zwarnnam(name, "no files given"); return 1; } else if (*args && OPT_ISSET(ops,'f')) { - zwarnnam(name, "no files allowed with -f", NULL, 0); + zwarnnam(name, "no files allowed with -f"); return 1; } @@ -524,7 +522,7 @@ bin_stat(char *name, char **args, Options ops, UNUSED(int func)) if (hashnam) { if (nargs > 1) { - zwarnnam(name, "only one file allowed with -H", NULL, 0); + zwarnnam(name, "only one file allowed with -H"); return 1; } arrsize = (flags & STF_PICK) ? 1 : ST_COUNT; diff --git a/Src/Modules/system.c b/Src/Modules/system.c index 7b1c08a95..dfdf094b9 100644 --- a/Src/Modules/system.c +++ b/Src/Modules/system.c @@ -48,7 +48,7 @@ getposint(char *instr, char *nam) ret = (int)zstrtol(instr, &eptr, 10); if (*eptr || ret < 0) { - zwarnnam(nam, "integer expected: %s", instr, 0); + zwarnnam(nam, "integer expected: %s", instr); return -1; } @@ -83,7 +83,7 @@ bin_sysread(char *nam, char **args, Options ops, UNUSED(int func)) /* -o: output file descriptor, else store in REPLY */ if (OPT_ISSET(ops, 'o')) { if (*args) { - zwarnnam(nam, "no argument allowed with -o", NULL, 0); + zwarnnam(nam, "no argument allowed with -o"); return 1; } outfd = getposint(OPT_ARG(ops, 'o'), nam); @@ -102,7 +102,7 @@ bin_sysread(char *nam, char **args, Options ops, UNUSED(int func)) if (OPT_ISSET(ops, 'c')) { countvar = OPT_ARG(ops, 'c'); if (!isident(countvar)) { - zwarnnam(nam, "not an identifier: %s", countvar, 0); + zwarnnam(nam, "not an identifier: %s", countvar); return 1; } } @@ -116,7 +116,7 @@ bin_sysread(char *nam, char **args, Options ops, UNUSED(int func)) */ outvar = *args; if (!isident(outvar)) { - zwarnnam(nam, "not an identifier: %s", outvar, 0); + zwarnnam(nam, "not an identifier: %s", outvar); return 1; } } @@ -252,7 +252,7 @@ bin_syswrite(char *nam, char **args, Options ops, UNUSED(int func)) if (OPT_ISSET(ops, 'c')) { countvar = OPT_ARG(ops, 'c'); if (!isident(countvar)) { - zwarnnam(nam, "not an identifier: %s", countvar, 0); + zwarnnam(nam, "not an identifier: %s", countvar); return 1; } } @@ -299,7 +299,7 @@ bin_syserror(char *nam, char **args, Options ops, UNUSED(int func)) if (OPT_ISSET(ops, 'e')) { errvar = OPT_ARG(ops, 'e'); if (!isident(errvar)) { - zwarnnam(nam, "not an identifier: %s", errvar, 0); + zwarnnam(nam, "not an identifier: %s", errvar); return 1; } } diff --git a/Src/Modules/tcp.c b/Src/Modules/tcp.c index 2120ba833..232cc31bc 100644 --- a/Src/Modules/tcp.c +++ b/Src/Modules/tcp.c @@ -300,7 +300,7 @@ tcp_close(Tcp_session sess) { err = close(sess->fd); if (err) - zwarn("connection close failed: %e", NULL, errno); + zwarn("connection close failed: %e", errno); } zts_delete(sess); return 0; @@ -358,8 +358,7 @@ bin_ztcp(char *nam, char **args, Options ops, UNUSED(int func)) if (OPT_ISSET(ops,'d')) { targetfd = atoi(OPT_ARG(ops,'d')); if (!targetfd) { - zwarnnam(nam, "%s is an invalid argument to -d", - OPT_ARG(ops,'d'), 0); + zwarnnam(nam, "%s is an invalid argument to -d", OPT_ARG(ops,'d')); return 1; } } @@ -373,7 +372,7 @@ bin_ztcp(char *nam, char **args, Options ops, UNUSED(int func)) targetfd = atoi(args[0]); sess = zts_byfd(targetfd); if(!targetfd) { - zwarnnam(nam, "%s is an invalid argument to -c", args[0], 0); + zwarnnam(nam, "%s is an invalid argument to -c", args[0]); return 1; } @@ -381,7 +380,7 @@ bin_ztcp(char *nam, char **args, Options ops, UNUSED(int func)) { if ((sess->flags & ZTCP_ZFTP) && !force) { - zwarnnam(nam, "use -f to force closure of a zftp control connection", NULL, 0); + zwarnnam(nam, "use -f to force closure of a zftp control connection"); return 1; } tcp_close(sess); @@ -389,7 +388,7 @@ bin_ztcp(char *nam, char **args, Options ops, UNUSED(int func)) } else { - zwarnnam(nam, "fd %s not found in tcp table", args[0], 0); + zwarnnam(nam, "fd %s not found in tcp table", args[0]); return 1; } } @@ -398,7 +397,7 @@ bin_ztcp(char *nam, char **args, Options ops, UNUSED(int func)) int lport = 0; if (!args[0]) { - zwarnnam(nam, "-l requires an argument", NULL, 0); + zwarnnam(nam, "-l requires an argument"); return 1; } @@ -407,13 +406,13 @@ bin_ztcp(char *nam, char **args, Options ops, UNUSED(int func)) lport = srv->s_port; else lport = htons(atoi(args[0])); - if (!lport) { zwarnnam(nam, "bad service name or port number", NULL, 0); + if (!lport) { zwarnnam(nam, "bad service name or port number"); return 1; } sess = tcp_socket(PF_INET, SOCK_STREAM, 0, ZTCP_LISTEN); if (!sess) { - zwarnnam(nam, "unable to allocate a TCP session slot", NULL, 0); + zwarnnam(nam, "unable to allocate a TCP session slot"); return 1; } #ifdef SO_OOBINLINE @@ -422,7 +421,7 @@ bin_ztcp(char *nam, char **args, Options ops, UNUSED(int func)) #endif if (!zsh_inet_aton("0.0.0.0", &(sess->sock.in.sin_addr))) { - zwarnnam(nam, "bad address: %s", "0.0.0.0", 0); + zwarnnam(nam, "bad address: %s", "0.0.0.0"); return 1; } @@ -441,7 +440,7 @@ bin_ztcp(char *nam, char **args, Options ops, UNUSED(int func)) if (listen(sess->fd, 1)) { - zwarnnam(nam, "could not listen on socket: %e", NULL, errno); + zwarnnam(nam, "could not listen on socket: %e", errno); tcp_close(sess); return 1; } @@ -468,26 +467,26 @@ bin_ztcp(char *nam, char **args, Options ops, UNUSED(int func)) int lfd, rfd; if (!args[0]) { - zwarnnam(nam, "-a requires an argument", NULL, 0); + zwarnnam(nam, "-a requires an argument"); return 1; } lfd = atoi(args[0]); if (!lfd) { - zwarnnam(nam, "invalid numerical argument", NULL, 0); + zwarnnam(nam, "invalid numerical argument"); return 1; } sess = zts_byfd(lfd); if (!sess) { - zwarnnam(nam, "fd %s is not registered as a tcp connection", args[0], 0); + zwarnnam(nam, "fd %s is not registered as a tcp connection", args[0]); return 1; } if (!(sess->flags & ZTCP_LISTEN)) { - zwarnnam(nam, "tcp connection not a listener", NULL, 0); + zwarnnam(nam, "tcp connection not a listener"); return 1; } @@ -502,7 +501,7 @@ bin_ztcp(char *nam, char **args, Options ops, UNUSED(int func)) if ((ret = poll(&pfd, 1, 0)) == 0) return 1; else if (ret == -1) { - zwarnnam(nam, "poll error: %e", NULL, errno); + zwarnnam(nam, "poll error: %e", errno); return 1; } # else @@ -518,14 +517,14 @@ bin_ztcp(char *nam, char **args, Options ops, UNUSED(int func)) if ((ret = select(lfd+1, &rfds, NULL, NULL, &tv))) return 1; else if (ret == -1) { - zwarnnam(nam, "select error: %e", NULL, errno); + zwarnnam(nam, "select error: %e", errno); return 1; } # endif #else - zwarnnam(nam, "not currently supported", NULL, 0); + zwarnnam(nam, "not currently supported"); return 1; #endif } @@ -534,7 +533,7 @@ bin_ztcp(char *nam, char **args, Options ops, UNUSED(int func)) len = sizeof(sess->peer.in); if ((rfd = accept(lfd, (struct sockaddr *)&sess->peer.in, &len)) == -1) { - zwarnnam(nam, "could not accept connection: %e", NULL, errno); + zwarnnam(nam, "could not accept connection: %e", errno); tcp_close(sess); return 1; } @@ -615,14 +614,14 @@ bin_ztcp(char *nam, char **args, Options ops, UNUSED(int func)) zthost = zsh_getipnodebyname(desthost, AF_INET, 0, &herrno); if (!zthost || errflag) { - zwarnnam(nam, "host resolution failure: %s", desthost, 0); + zwarnnam(nam, "host resolution failure: %s", desthost); return 1; } sess = tcp_socket(PF_INET, SOCK_STREAM, 0, 0); if (!sess) { - zwarnnam(nam, "unable to allocate a TCP session slot", NULL, 0); + zwarnnam(nam, "unable to allocate a TCP session slot"); return 1; } @@ -632,7 +631,7 @@ bin_ztcp(char *nam, char **args, Options ops, UNUSED(int func)) #endif if (sess->fd < 0) { - zwarnnam(nam, "socket creation failed: %e", NULL, errno); + zwarnnam(nam, "socket creation failed: %e", errno); zsfree(desthost); zts_delete(sess); return 1; @@ -640,14 +639,14 @@ bin_ztcp(char *nam, char **args, Options ops, UNUSED(int func)) for (addrp = zthost->h_addr_list; err && *addrp; addrp++) { if (zthost->h_length != 4) - zwarnnam(nam, "address length mismatch", NULL, 0); + zwarnnam(nam, "address length mismatch"); do { err = tcp_connect(sess, *addrp, zthost, destport); } while (err && errno == EINTR && !errflag); } if (err) { - zwarnnam(nam, "connection failed: %e", NULL, errno); + zwarnnam(nam, "connection failed: %e", errno); tcp_close(sess); zsfree(desthost); return 1; diff --git a/Src/Modules/termcap.c b/Src/Modules/termcap.c index 9e7ee57ae..e29b2bf74 100644 --- a/Src/Modules/termcap.c +++ b/Src/Modules/termcap.c @@ -134,7 +134,7 @@ bin_echotc(char *name, char **argv, UNUSED(Options ops), UNUSED(int func)) t = tgetstr(s, &u); if (t == (char *)-1 || !t || !*t) { /* capability doesn't exist, or (if boolean) is off */ - zwarnnam(name, "no such capability: %s", s, 0); + zwarnnam(name, "no such capability: %s", s); return 1; } /* count the number of arguments required */ @@ -147,7 +147,7 @@ bin_echotc(char *name, char **argv, UNUSED(Options ops), UNUSED(int func)) /* check that the number of arguments provided is correct */ if (arrlen(argv) != argct) { zwarnnam(name, (arrlen(argv) < argct) ? "not enough arguments" : - "too many arguments", NULL, 0); + "too many arguments"); return 1; } /* output string, through the proper termcap functions */ @@ -263,7 +263,7 @@ gettermcap(UNUSED(HashTable ht), char *name) pm->u.str = dupstring(tcstr); pm->node.flags |= PM_SCALAR; } else { - /* zwarn("no such capability: %s", name, 0); */ + /* zwarn("no such capability: %s", name); */ pm->u.str = dupstring(""); pm->node.flags |= PM_UNSET; } diff --git a/Src/Modules/terminfo.c b/Src/Modules/terminfo.c index 4c8dce3ce..b4a1c599b 100644 --- a/Src/Modules/terminfo.c +++ b/Src/Modules/terminfo.c @@ -95,12 +95,12 @@ bin_echoti(char *name, char **argv, UNUSED(Options ops), UNUSED(int func)) t = (char *)tigetstr(s); if (!t || t == (char *)-1 || !*t) { /* capability doesn't exist, or (if boolean) is off */ - zwarnnam(name, "no such terminfo capability: %s", s, 0); + zwarnnam(name, "no such terminfo capability: %s", s); return 1; } /* check that the number of arguments provided is not too high */ if (arrlen(argv) > 9) { - zwarnnam(name, "too many arguments", NULL, 0); + zwarnnam(name, "too many arguments"); return 1; } @@ -216,7 +216,7 @@ getterminfo(UNUSED(HashTable ht), char *name) pm->node.flags |= PM_SCALAR; pm->gsu.s = &nullsetscalar_gsu; } else { - /* zwarn("no such capability: %s", name, 0); */ + /* zwarn("no such capability: %s", name); */ pm->u.str = dupstring(""); pm->node.flags |= PM_UNSET; pm->gsu.s = &nullsetscalar_gsu; diff --git a/Src/Modules/zftp.c b/Src/Modules/zftp.c index 45e04d4f8..c150f8b62 100644 --- a/Src/Modules/zftp.c +++ b/Src/Modules/zftp.c @@ -582,7 +582,7 @@ zfgetline(char *ln, int lnsize, int tmout) if (setjmp(zfalrmbuf)) { alarm(0); - zwarnnam("zftp", "timeout getting response", NULL, 0); + zwarnnam("zftp", "timeout getting response"); return 6; } zfalarm(tmout); @@ -792,7 +792,7 @@ zfgetmsg(void) zcfinish = 2; /* don't need to tell server */ zfclose(0); /* unexpected, so tell user */ - zwarnnam("zftp", "remote server has closed connection", NULL, 0); + zwarnnam("zftp", "remote server has closed connection"); return 6; } if (lastcode == 530) { @@ -805,7 +805,7 @@ zfgetmsg(void) * It means we just hang around waiting for another reply. */ if (lastcode == 120) { - zwarnnam("zftp", "delay expected, waiting: %s", lastmsg, 0); + zwarnnam("zftp", "delay expected, waiting: %s", lastmsg); return zfgetmsg(); } @@ -836,7 +836,7 @@ zfsendcmd(char *cmd) tmout = getiparam("ZFTP_TMOUT"); if (setjmp(zfalrmbuf)) { alarm(0); - zwarnnam("zftp", "timeout sending message", NULL, 0); + zwarnnam("zftp", "timeout sending message"); return 6; } zfalarm(tmout); @@ -844,8 +844,7 @@ zfsendcmd(char *cmd) alarm(0); if (ret <= 0) { - zwarnnam("zftp send", "failure sending control message: %e", - NULL, errno); + zwarnnam("zftp send", "failure sending control message: %e", errno); return 6; } @@ -860,12 +859,12 @@ static int zfopendata(char *name, union tcp_sockaddr *zdsockp, int *is_passivep) { if (!(zfprefs & (ZFPF_SNDP|ZFPF_PASV))) { - zwarnnam(name, "Must set preference S or P to transfer data", NULL, 0); + zwarnnam(name, "Must set preference S or P to transfer data"); return 1; } zfsess->dfd = socket(zfsess->control->peer.a.sa_family, SOCK_STREAM, 0); if (zfsess->dfd < 0) { - zwarnnam(name, "can't get data socket: %e", NULL, errno); + zwarnnam(name, "can't get data socket: %e", errno); return 1; } @@ -900,7 +899,7 @@ zfopendata(char *name, union tcp_sockaddr *zdsockp, int *is_passivep) ptr = strchr(lastmsg, '('); if(!ptr) { bad_epsv: - zwarnnam(name, "bad response to EPSV: %s", lastmsg, 0); + zwarnnam(name, "bad response to EPSV: %s", lastmsg); zfclosedata(); return 1; } @@ -940,7 +939,7 @@ zfopendata(char *name, union tcp_sockaddr *zdsockp, int *is_passivep) break; if (sscanf(ptr, "%d,%d,%d,%d,%d,%d", nums, nums+1, nums+2, nums+3, nums+4, nums+5) != 6) { - zwarnnam(name, "bad response to PASV: %s", lastmsg, 0); + zwarnnam(name, "bad response to PASV: %s", lastmsg); zfclosedata(); return 1; } @@ -960,7 +959,7 @@ zfopendata(char *name, union tcp_sockaddr *zdsockp, int *is_passivep) } while (err && errno == EINTR && !errflag); if (err) { - zwarnnam(name, "connect failed: %e", NULL, errno); + zwarnnam(name, "connect failed: %e", errno); zfclosedata(); return 1; } @@ -976,7 +975,7 @@ zfopendata(char *name, union tcp_sockaddr *zdsockp, int *is_passivep) int ret; if (!(zfprefs & ZFPF_SNDP)) { - zwarnnam(name, "only sendport mode available for data", NULL, 0); + zwarnnam(name, "only sendport mode available for data"); return 1; } @@ -1027,7 +1026,7 @@ zfopendata(char *name, union tcp_sockaddr *zdsockp, int *is_passivep) addr[0],addr[1],addr[2],addr[3],port[0],port[1]); } if (zfsendcmd(portcmd) >= 5) { - zwarnnam(name, "port command failed", NULL, 0); + zwarnnam(name, "port command failed"); zfclosedata(); return 1; } @@ -1129,7 +1128,7 @@ zfgetdata(char *name, char *rest, char *cmd, int getsize) newfd = zfmovefd(accept(zfsess->dfd, (struct sockaddr *)&zdsock, &len)); if (newfd < 0) - zwarnnam(name, "unable to accept data: %e", NULL, errno); + zwarnnam(name, "unable to accept data: %e", errno); zfclosedata(); if (newfd < 0) return 1; @@ -1320,7 +1319,7 @@ zfread(int fd, char *bf, off_t sz, int tmout) if (setjmp(zfalrmbuf)) { alarm(0); - zwarnnam("zftp", "timeout on network read", NULL, 0); + zwarnnam("zftp", "timeout on network read"); return -1; } zfalarm(tmout); @@ -1345,7 +1344,7 @@ zfwrite(int fd, char *bf, off_t sz, int tmout) if (setjmp(zfalrmbuf)) { alarm(0); - zwarnnam("zftp", "timeout on network write", NULL, 0); + zwarnnam("zftp", "timeout on network write"); return -1; } zfalarm(tmout); @@ -1375,7 +1374,7 @@ zfread_block(int fd, char *bf, off_t sz, int tmout) n = zfread(fd, (char *)&hdr, sizeof(hdr), tmout); } while (n < 0 && errno == EINTR); if (n != 3 && !zfdrrrring) { - zwarnnam("zftp", "failure reading FTP block header", NULL, 0); + zwarnnam("zftp", "failure reading FTP block header"); return n; } /* size is stored in network byte order */ @@ -1386,7 +1385,7 @@ zfread_block(int fd, char *bf, off_t sz, int tmout) /* * See comments in file headers */ - zwarnnam("zftp", "block too large to handle", NULL, 0); + zwarnnam("zftp", "block too large to handle"); errno = EIO; return -1; } @@ -1403,7 +1402,7 @@ zfread_block(int fd, char *bf, off_t sz, int tmout) break; } if (cnt) { - zwarnnam("zftp", "short data block", NULL, 0); + zwarnnam("zftp", "short data block"); errno = EIO; return -1; } @@ -1429,7 +1428,7 @@ zfwrite_block(int fd, char *bf, off_t sz, int tmout) n = zfwrite(fd, (char *)&hdr, sizeof(hdr), tmout); } while (n < 0 && errno == EINTR); if (n != 3 && !zfdrrrring) { - zwarnnam("zftp", "failure writing FTP block header", NULL, 0); + zwarnnam("zftp", "failure writing FTP block header"); return n; } bfptr = bf; @@ -1586,7 +1585,7 @@ zfsenddata(char *name, int recv, int progress, off_t startat) if (!zfdrrrring && (!interact || (!errflag && errno != EPIPE))) { ret = recv ? 2 : 1; - zwarnnam(name, "write failed: %e", NULL, errno); + zwarnnam(name, "write failed: %e", errno); } else ret = recv ? 3 : 1; break; @@ -1601,7 +1600,7 @@ zfsenddata(char *name, int recv, int progress, off_t startat) if (!zfdrrrring && (!interact || (!errflag && errno != EPIPE))) { ret = recv ? 1 : 2; - zwarnnam(name, "read failed: %e", NULL, errno); + zwarnnam(name, "read failed: %e", errno); } else ret = recv ? 1 : 3; break; @@ -1649,7 +1648,7 @@ zfsenddata(char *name, int recv, int progress, off_t startat) unsigned char msg[4] = { IAC, IP, IAC, SYNCH }; if (ret == 2) - zwarnnam(name, "aborting data transfer...", NULL, 0); + zwarnnam(name, "aborting data transfer..."); holdintr(); @@ -1709,7 +1708,7 @@ zftp_open(char *name, char **args, int flags) if (zfsess->userparams) args = zfsess->userparams; else { - zwarnnam(name, "no host specified", NULL, 0); + zwarnnam(name, "no host specified"); return 1; } } @@ -1731,7 +1730,7 @@ zftp_open(char *name, char **args, int flags) hostnam++; hostsuffix = strchr(hostnam, ']'); if (!hostsuffix || (hostsuffix[1] && hostsuffix[1] != ':')) { - zwarnnam(name, "Invalid host format: %s", hostnam, 0); + zwarnnam(name, "Invalid host format: %s", hostnam); return 1; } *hostsuffix++ = '\0'; @@ -1761,8 +1760,7 @@ zftp_open(char *name, char **args, int flags) /* this is going to give 0. why bother? */ zprotop = getprotobyname("tcp"); if (!zprotop) { - zwarnnam(name, "Can't find protocol TCP (is your network functional)?", - NULL, 0); + zwarnnam(name, "Can't find protocol TCP (is your network functional)?"); return 1; } if (port < 0) @@ -1771,7 +1769,7 @@ zftp_open(char *name, char **args, int flags) zservp = getservbyport(port, "tcp"); if (!zprotop || !zservp) { - zwarnnam(name, "Can't find port for service `%s'", portnam, 0); + zwarnnam(name, "Can't find port for service `%s'", portnam); return 1; } @@ -1788,9 +1786,9 @@ zftp_open(char *name, char **args, int flags) alarm(0); queue_signals(); if ((hname = getsparam("ZFTP_HOST")) && *hname) - zwarnnam(name, "timeout connecting to %s", hname, 0); + zwarnnam(name, "timeout connecting to %s", hname); else - zwarnnam(name, "timeout on host name lookup", NULL, 0); + zwarnnam(name, "timeout on host name lookup"); unqueue_signals(); zfclose(0); return 1; @@ -1818,7 +1816,7 @@ zftp_open(char *name, char **args, int flags) * on the other hand, herror() is obsolete */ FAILED(); - zwarnnam(name, "host not found: %s", hostnam, 0); + zwarnnam(name, "host not found: %s", hostnam); alarm(0); return 1; } @@ -1851,7 +1849,7 @@ zftp_open(char *name, char **args, int flags) zfunsetparam("ZFTP_HOST"); zfunsetparam("ZFTP_PORT"); FAILED(); - zwarnnam(name, "socket failed: %e", NULL, errno); + zwarnnam(name, "socket failed: %e", errno); alarm(0); return 1; } @@ -1868,7 +1866,7 @@ zftp_open(char *name, char **args, int flags) /* try all possible IP's */ for (addrp = zhostp->h_addr_list; err && *addrp; addrp++) { if(hlen != zhostp->h_length) - zwarnnam(name, "address length mismatch", NULL, 0); + zwarnnam(name, "address length mismatch"); do { err = tcp_connect(zfsess->control, *addrp, zhostp, zservp->s_port); } while (err && errno == EINTR && !errflag); @@ -1879,7 +1877,7 @@ zftp_open(char *name, char **args, int flags) freehostent(zhostp); zfclose(0); FAILED(); - zwarnnam(name, "connect failed: %e", NULL, errno); + zwarnnam(name, "connect failed: %e", errno); alarm(0); return 1; } @@ -1914,7 +1912,7 @@ zftp_open(char *name, char **args, int flags) len = sizeof(zfsess->control->sock); if (getsockname(zfsess->control->fd, (struct sockaddr *)&zfsess->control->sock, &len) < 0) { - zwarnnam(name, "getsockname failed: %e", NULL, errno); + zwarnnam(name, "getsockname failed: %e", errno); zfclose(0); return 1; } @@ -1941,7 +1939,7 @@ zftp_open(char *name, char **args, int flags) zfsess->cin = fdopen(zfsess->control->fd, "r"); if (!zfsess->cin) { - zwarnnam(name, "file handling error", NULL, 0); + zwarnnam(name, "file handling error"); zfclose(0); return 1; } @@ -2190,7 +2188,7 @@ zftp_login(char *name, char **args, UNUSED(int flags)) if (!zfsess->control) return 1; if (stopit == 2 || (lastcode != 230 && lastcode != 202)) { - zwarnnam(name, "login failed", NULL, 0); + zwarnnam(name, "login failed"); return 1; } @@ -2198,7 +2196,7 @@ zftp_login(char *name, char **args, UNUSED(int flags)) int cnt; for (cnt = 0; *args; args++) cnt++; - zwarnnam(name, "warning: %d comand arguments not used\n", NULL, cnt); + zwarnnam(name, "warning: %d comand arguments not used\n", cnt); } zfstatusp[zfsessno] |= ZFST_LOGI; zfsetparam("ZFTP_USER", ztrdup(user), ZFPM_READONLY); @@ -2299,7 +2297,7 @@ zftp_test(UNUSED(char *name), UNUSED(char **args), UNUSED(int flags)) /* if we have no zfsess->control, then we've just been dumped out. */ return zfsess->control ? 0 : 2; #else - zfwarnnam(name, "not supported on this system.", NULL, 0); + zfwarnnam(name, "not supported on this system."); return 3; #endif /* defined(HAVE_POLL) || defined(HAVE_SELECT) */ } @@ -2451,7 +2449,7 @@ zftp_type(char *name, char **args, int flags) * ones we know what to do with. */ if (str[1] || (nt != 'A' && nt != 'B' && nt != 'I')) { - zwarnnam(name, "transfer type %s not recognised", str, 0); + zwarnnam(name, "transfer type %s not recognised", str); return 1; } @@ -2481,7 +2479,7 @@ zftp_mode(char *name, char **args, UNUSED(int flags)) } nt = str[0] = toupper(STOUC(*str)); if (str[1] || (nt != 'S' && nt != 'B')) { - zwarnnam(name, "transfer mode %s not recognised", str, 0); + zwarnnam(name, "transfer mode %s not recognised", str); return 1; } cmd[5] = (char) nt; @@ -3017,7 +3015,7 @@ bin_zftp(char *name, char **args, UNUSED(Options ops), UNUSED(int func)) break; if (!zptr->nam) { - zwarnnam(name, "no such subcommand: %s", cnam, 0); + zwarnnam(name, "no such subcommand: %s", cnam); return 1; } @@ -3025,7 +3023,7 @@ bin_zftp(char *name, char **args, UNUSED(Options ops), UNUSED(int func)) for (n = 0; args[n]; n++) ; if (n < zptr->min || (zptr->max != -1 && n > zptr->max)) { - zwarnnam(name, "wrong no. of arguments for %s", cnam, 0); + zwarnnam(name, "wrong no. of arguments for %s", cnam); return 1; } @@ -3072,7 +3070,7 @@ bin_zftp(char *name, char **args, UNUSED(Options ops), UNUSED(int func)) * with ret == 2, we just got dumped out in the test, * so enough messages already. */ - zwarnnam(fullname, "not connected.", NULL, 0); + zwarnnam(fullname, "not connected."); } return 1; } @@ -3103,7 +3101,7 @@ bin_zftp(char *name, char **args, UNUSED(Options ops), UNUSED(int func)) break; default: - zwarnnam(name, "preference %c not recognized", NULL, *ptr); + zwarnnam(name, "preference %c not recognized", *ptr); break; } } diff --git a/Src/Modules/zpty.c b/Src/Modules/zpty.c index 637d3e62f..744548f50 100644 --- a/Src/Modules/zpty.c +++ b/Src/Modules/zpty.c @@ -128,7 +128,7 @@ ptysettyinfo(int fd, struct ttyinfo *ti) ioctl(fd, TCSETS, &ti->tio); /* if (ioctl(SHTTY, TCSETS, &ti->tio) == -1) */ # endif - /* zerr("settyinfo: %e",NULL,errno)*/ ; + /* zerr("settyinfo: %e",errno)*/ ; #else # ifdef HAVE_TERMIO_H ioctl(fd, TCSETA, &ti->tio); @@ -300,7 +300,7 @@ newptycmd(char *nam, char *pname, char **args, int echo, int nblock) } if (get_pty(1, &master)) { - zwarnnam(nam, "can't open pseudo terminal: %e", NULL, errno); + zwarnnam(nam, "can't open pseudo terminal: %e", errno); return 1; } if ((pid = fork()) == -1) { @@ -316,11 +316,11 @@ newptycmd(char *nam, char *pname, char **args, int echo, int nblock) mypid = getpid(); #ifdef HAVE_SETSID if (setsid() != mypid) { - zwarnnam(nam, "failed to create new session: %e", NULL, errno); + zwarnnam(nam, "failed to create new session: %e", errno); #endif #ifdef TIOCNOTTY if (ioctl(SHTTY, TIOCNOTTY, 0)) - zwarnnam(nam, "%e", NULL, errno); + zwarnnam(nam, "%e", errno); setpgrp(0L, mypid); #endif #ifdef HAVE_SETSID @@ -478,14 +478,14 @@ ptyread(char *nam, Ptycmd cmd, char **args) char *p; if (args[2]) { - zwarnnam(nam, "too many arguments", NULL, 0); + zwarnnam(nam, "too many arguments"); return 1; } p = dupstring(args[1]); tokenize(p); remnulargs(p); if (!(prog = patcompile(p, PAT_STATIC, NULL))) { - zwarnnam(nam, "bad pattern: %s", args[1], 0); + zwarnnam(nam, "bad pattern: %s", args[1]); return 1; } } else @@ -633,17 +633,17 @@ bin_zpty(char *nam, char **args, Options ops, UNUSED(int func)) (OPT_ISSET(ops,'d') && (OPT_ISSET(ops,'b') || OPT_ISSET(ops,'e') || OPT_ISSET(ops,'L') || OPT_ISSET(ops,'t'))) || (OPT_ISSET(ops,'L') && (OPT_ISSET(ops,'b') || OPT_ISSET(ops,'e')))) { - zwarnnam(nam, "illegal option combination", NULL, 0); + zwarnnam(nam, "illegal option combination"); return 1; } if (OPT_ISSET(ops,'r') || OPT_ISSET(ops,'w')) { Ptycmd p; if (!*args) { - zwarnnam(nam, "missing pty command name", NULL, 0); + zwarnnam(nam, "missing pty command name"); return 1; } else if (!(p = getptycmd(*args))) { - zwarnnam(nam, "no such pty command: %s", *args, 0); + zwarnnam(nam, "no such pty command: %s", *args); return 1; } if (p->fin) @@ -664,7 +664,7 @@ bin_zpty(char *nam, char **args, Options ops, UNUSED(int func)) if ((p = getptycmd(*args++))) deleteptycmd(p); else { - zwarnnam(nam, "no such pty command: %s", args[-1], 0); + zwarnnam(nam, "no such pty command: %s", args[-1]); ret = 1; } } else @@ -675,21 +675,21 @@ bin_zpty(char *nam, char **args, Options ops, UNUSED(int func)) Ptycmd p; if (!*args) { - zwarnnam(nam, "missing pty command name", NULL, 0); + zwarnnam(nam, "missing pty command name"); return 1; } else if (!(p = getptycmd(*args))) { - zwarnnam(nam, "no such pty command: %s", *args, 0); + zwarnnam(nam, "no such pty command: %s", *args); return 1; } checkptycmd(p); return p->fin; } else if (*args) { if (!args[1]) { - zwarnnam(nam, "missing command", NULL, 0); + zwarnnam(nam, "missing command"); return 1; } if (getptycmd(*args)) { - zwarnnam(nam, "pty command name already used: %s", *args, 0); + zwarnnam(nam, "pty command name already used: %s", *args); return 1; } return newptycmd(nam, *args, args + 1, OPT_ISSET(ops,'e'), diff --git a/Src/Modules/zselect.c b/Src/Modules/zselect.c index 71a0d7e76..4e547a47e 100644 --- a/Src/Modules/zselect.c +++ b/Src/Modules/zselect.c @@ -43,12 +43,12 @@ handle_digits(char *nam, char *argptr, fd_set *fdset, int *fdmax) char *endptr; if (!idigit(*argptr)) { - zwarnnam(nam, "expecting file descriptor: %s", argptr, 0); + zwarnnam(nam, "expecting file descriptor: %s", argptr); return 1; } fd = (int)zstrtol(argptr, &endptr, 10); if (*endptr) { - zwarnnam(nam, "garbage after file descriptor: %s", endptr, 0); + zwarnnam(nam, "garbage after file descriptor: %s", endptr); return 1; } @@ -95,12 +95,11 @@ bin_zselect(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) else if (args[1]) { argptr = *++args; } else { - zwarnnam(nam, "argument expected after -%c", NULL, - *argptr); + zwarnnam(nam, "argument expected after -%c", *argptr); return 1; } if (idigit(*argptr) || !isident(argptr)) { - zwarnnam(nam, "invalid array name: %s", argptr, 0); + zwarnnam(nam, "invalid array name: %s", argptr); return 1; } if (i == 'a') @@ -138,18 +137,17 @@ bin_zselect(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) else if (args[1]) { argptr = *++args; } else { - zwarnnam(nam, "argument expected after -%c", NULL, - *argptr); + zwarnnam(nam, "argument expected after -%c", *argptr); return 1; } if (!idigit(*argptr)) { - zwarnnam(nam, "number expected after -t", NULL, 0); + zwarnnam(nam, "number expected after -t"); return 1; } tempnum = zstrtol(argptr, &endptr, 10); if (*endptr) { zwarnnam(nam, "garbage after -t argument: %s", - endptr, 0); + endptr); return 1; } /* timevalue now active */ @@ -180,7 +178,7 @@ bin_zselect(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) if (i <= 0) { if (i < 0) - zwarnnam(nam, "error on select: %e", NULL, errno); + zwarnnam(nam, "error on select: %e", errno); /* else no fd's set. Presumably a timeout. */ return 1; } @@ -264,8 +262,7 @@ bin_zselect(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) return 0; #else /* TODO: use poll */ - zerrnam(nam, "your system does not implement the select system call.", - NULL, 0); + zerrnam(nam, "your system does not implement the select system call."); return 2; #endif } diff --git a/Src/Modules/zutil.c b/Src/Modules/zutil.c index c88e66288..c2298a782 100644 --- a/Src/Modules/zutil.c +++ b/Src/Modules/zutil.c @@ -265,7 +265,7 @@ bin_zstyle(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) if ((oc = args[0][1]) && oc != '-') { if (args[0][2]) { - zwarnnam(nam, "invalid argument: %s", args[0], 0); + zwarnnam(nam, "invalid argument: %s", args[0]); return 1; } if (oc == 'L') @@ -287,14 +287,14 @@ bin_zstyle(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) char *pat; if (arrlen(args) < 2) { - zwarnnam(nam, "not enough arguments", NULL, 0); + zwarnnam(nam, "not enough arguments"); return 1; } pat = dupstring(args[0]); tokenize(pat); if (!(prog = patcompile(pat, PAT_ZDUP, NULL))) { - zwarnnam(nam, "invalid pattern: %s", args[0], 0); + zwarnnam(nam, "invalid pattern: %s", args[0]); return 1; } if (!(s = getstyle(args[1]))) @@ -338,15 +338,15 @@ bin_zstyle(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) case 'm': min = 3; max = 3; break; case 'g': min = 1; max = 3; break; default: - zwarnnam(nam, "invalid option: %s", args[0], 0); + zwarnnam(nam, "invalid option: %s", args[0]); return 1; } n = arrlen(args) - 1; if (n < min) { - zwarnnam(nam, "not enough arguments", NULL, 0); + zwarnnam(nam, "not enough arguments"); return 1; } else if (max >= 0 && n > max) { - zwarnnam(nam, "too many arguments", NULL, 0); + zwarnnam(nam, "too many arguments"); return 1; } switch (args[0][1]) { @@ -697,7 +697,7 @@ bin_zformat(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) char opt; if (args[0][0] != '-' || !(opt = args[0][1]) || args[0][2]) { - zwarnnam(nam, "invalid argument: %s", args[0], 0); + zwarnnam(nam, "invalid argument: %s", args[0]); return 1; } args++; @@ -715,7 +715,7 @@ bin_zformat(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) for (ap = args + 2; *ap; ap++) { if (!ap[0][0] || ap[0][0] == '-' || ap[0][0] == '.' || idigit(ap[0][0]) || ap[0][1] != ':') { - zwarnnam(nam, "invalid argument: %s", *ap, 0); + zwarnnam(nam, "invalid argument: %s", *ap); return 1; } specs[STOUC(ap[0][0])] = ap[0] + 2; @@ -784,7 +784,7 @@ bin_zformat(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) } break; } - zwarnnam(nam, "invalid option: -%c", 0, opt); + zwarnnam(nam, "invalid option: -%c", opt); return 1; } @@ -1249,9 +1249,9 @@ bin_zregexparse(char *nam, char **args, Options ops, UNUSED(int func)) rparsestates = newlinklist(); if (setjmp(rparseerr) || rparsealt(&result, &rparseerr) || *rparseargs) { if (*rparseargs) - zwarnnam(nam, "invalid regex : %s", *rparseargs, 0); + zwarnnam(nam, "invalid regex : %s", *rparseargs); else - zwarnnam(nam, "not enough regex arguments", NULL, 0); + zwarnnam(nam, "not enough regex arguments"); ret = 3; } else ret = 0; @@ -1434,7 +1434,7 @@ bin_zparseopts(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) break; case 'a': if (defarr) { - zwarnnam(nam, "default array given more than once", NULL, 0); + zwarnnam(nam, "default array given more than once"); return 1; } if (o[2]) @@ -1442,7 +1442,7 @@ bin_zparseopts(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) else if (*args) n = *args++; else { - zwarnnam(nam, "missing array name", NULL, 0); + zwarnnam(nam, "missing array name"); return 1; } defarr = (Zoptarr) zhalloc(sizeof(*defarr)); @@ -1458,7 +1458,7 @@ bin_zparseopts(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) else if (*args) assoc = *args++; else { - zwarnnam(nam, "missing array name", NULL, 0); + zwarnnam(nam, "missing array name"); return 1; } break; @@ -1473,12 +1473,12 @@ bin_zparseopts(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) } } if (!o) { - zwarnnam(nam, "missing option descriptions", NULL, 0); + zwarnnam(nam, "missing option descriptions"); return 1; } while ((o = dupstring(*args++))) { if (!*o) { - zwarnnam(nam, "invalid option description: %s", o, 0); + zwarnnam(nam, "invalid option description: %s", o); return 1; } f = 0; @@ -1517,10 +1517,10 @@ bin_zparseopts(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) opt_arrs = a; } } else if (*p) { - zwarnnam(nam, "invalid option description: %s", args[-1], 0); + zwarnnam(nam, "invalid option description: %s", args[-1]); return 1; } else if (!(a = defarr) && !assoc) { - zwarnnam(nam, "no default array defined: %s", args[-1], 0); + zwarnnam(nam, "no default array defined: %s", args[-1]); return 1; } for (p = n = o; *p; p++) { @@ -1529,7 +1529,7 @@ bin_zparseopts(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) *n++ = *p; } if (get_opt_desc(o)) { - zwarnnam(nam, "option defined more than once: %s", o, 0); + zwarnnam(nam, "option defined more than once: %s", o); return 1; } d = (Zoptdesc) zhalloc(sizeof(*d)); @@ -1571,7 +1571,7 @@ bin_zparseopts(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) } else if (!(d->flags & ZOF_OPT)) { if (!pp[1]) { zwarnnam(nam, "missing argument for option: %s", - d->name, 0); + d->name); return 1; } add_opt_val(d, *++pp); @@ -1597,7 +1597,7 @@ bin_zparseopts(char *nam, char **args, UNUSED(Options ops), UNUSED(int func)) else if (!(d->flags & ZOF_OPT)) { if (!pp[1]) { zwarnnam(nam, "missing argument for option: %s", - d->name, 0); + d->name); return 1; } add_opt_val(d, *++pp); |