diff options
author | Moritz Jodeit <moritz@cvs.openbsd.org> | 2007-05-15 19:42:06 +0000 |
---|---|---|
committer | Moritz Jodeit <moritz@cvs.openbsd.org> | 2007-05-15 19:42:06 +0000 |
commit | 411c924837277917adc0e6333223ae43187d4f16 (patch) | |
tree | b73d45176e15af75c506a06b0f51bdd7113153b7 /usr.bin | |
parent | b20a27a5d8705aab699f34d88e11460c2f5794f7 (diff) |
Remove useless NOxxx defines and use NULL instead.
No binary change.
OK ray@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tip/acu.c | 28 | ||||
-rw-r--r-- | usr.bin/tip/cmds.c | 26 | ||||
-rw-r--r-- | usr.bin/tip/cu.c | 6 | ||||
-rw-r--r-- | usr.bin/tip/log.c | 8 | ||||
-rw-r--r-- | usr.bin/tip/remote.c | 34 | ||||
-rw-r--r-- | usr.bin/tip/tip.c | 12 | ||||
-rw-r--r-- | usr.bin/tip/tip.h | 8 | ||||
-rw-r--r-- | usr.bin/tip/value.c | 8 | ||||
-rw-r--r-- | usr.bin/tip/vars.c | 18 |
9 files changed, 71 insertions, 77 deletions
diff --git a/usr.bin/tip/acu.c b/usr.bin/tip/acu.c index d116e83c0fe..b8e3858484c 100644 --- a/usr.bin/tip/acu.c +++ b/usr.bin/tip/acu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acu.c,v 1.14 2007/05/12 21:20:40 ray Exp $ */ +/* $OpenBSD: acu.c,v 1.15 2007/05/15 19:42:05 moritz Exp $ */ /* $NetBSD: acu.c,v 1.4 1996/12/29 10:34:03 cgd Exp $ */ /* @@ -34,12 +34,12 @@ #if 0 static char sccsid[] = "@(#)acu.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: acu.c,v 1.14 2007/05/12 21:20:40 ray Exp $"; +static const char rcsid[] = "$OpenBSD: acu.c,v 1.15 2007/05/15 19:42:05 moritz Exp $"; #endif /* not lint */ #include "tip.h" -static acu_t *acu = NOACU; +static acu_t *acu = NULL; static int conflag; static void acuabort(int); static acu_t *acutype(char *); @@ -69,10 +69,10 @@ con(void) volatile int tried = 0; if (!DU) { /* regular connect message */ - if (CM != NOSTR) + if (CM != NULL) parwrite(FD, CM, size(CM)); logent(value(HOST), "", DV, "call completed"); - return (NOSTR); + return (NULL); } /* * @ =>'s use data base in PHONES environment variable @@ -85,16 +85,16 @@ con(void) signal(SIGQUIT, SIG_IGN); printf("\ncall aborted\n"); logent(value(HOST), "", "", "call aborted"); - if (acu != NOACU) { + if (acu != NULL) { setboolean(value(VERBOSE), FALSE); if (conflag) - disconnect(NOSTR); + disconnect(NULL); else (*acu->acu_abort)(); } return ("interrupt"); } - if ((acu = acutype(AT)) == NOACU) + if ((acu = acutype(AT)) == NULL) return ("unknown ACU type"); if (*cp != '@') { while (*cp) { @@ -114,11 +114,11 @@ con(void) tried++; } } else { - if ((fp = fopen(PH, "r")) == NOFILE) { + if ((fp = fopen(PH, "r")) == NULL) { printf("%s: ", PH); return ("can't open phone number file"); } - while (fgets(string, sizeof(string), fp) != NOSTR) { + while (fgets(string, sizeof(string), fp) != NULL) { cp = &string[strcspn(string, " \t\n")]; if (*cp != '\0') *cp++ = '\0'; @@ -143,10 +143,10 @@ con(void) fclose(fp); } if (conflag) { - if (CM != NOSTR) + if (CM != NULL) parwrite(FD, CM, size(CM)); logent(value(HOST), phnum, acu->acu_name, "call completed"); - return (NOSTR); + return (NULL); } else if (!tried) { logent(value(HOST), "", acu->acu_name, "missing phone number"); return ("missing phone number"); @@ -163,7 +163,7 @@ disconnect(char *reason) logent(value(HOST), "", DV, "call terminated"); return; } - if (reason == NOSTR) { + if (reason == NULL) { logent(value(HOST), "", acu->acu_name, "call terminated"); if (boolean(value(VERBOSE))) printf("\r\ndisconnecting..."); @@ -188,5 +188,5 @@ acutype(char *s) for (p = acutable; p->acu_name != '\0'; p++) if (!strcmp(s, p->acu_name)) return (p); - return (NOACU); + return (NULL); } diff --git a/usr.bin/tip/cmds.c b/usr.bin/tip/cmds.c index c03934689a3..73e46a5a6b1 100644 --- a/usr.bin/tip/cmds.c +++ b/usr.bin/tip/cmds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmds.c,v 1.26 2006/06/06 23:24:52 deraadt Exp $ */ +/* $OpenBSD: cmds.c,v 1.27 2007/05/15 19:42:05 moritz Exp $ */ /* $NetBSD: cmds.c,v 1.7 1997/02/11 09:24:03 mrg Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)cmds.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: cmds.c,v 1.26 2006/06/06 23:24:52 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: cmds.c,v 1.27 2007/05/15 19:42:05 moritz Exp $"; #endif /* not lint */ #include "tip.h" @@ -654,7 +654,7 @@ tipabort(char *msg) signal(SIGTERM, SIG_IGN); kill(tipout_pid, SIGTERM); disconnect(msg); - if (msg != NOSTR) + if (msg != NULL) printf("\r\n%s", msg); printf("\r\n[EOT]\r\n"); daemon_uid(); @@ -669,11 +669,11 @@ finish(int c) { char *dismsg; - if ((dismsg = value(DISCONNECT)) != NOSTR) { + if ((dismsg = value(DISCONNECT)) != NULL) { write(FD, dismsg, strlen(dismsg)); sleep(5); } - tipabort(NOSTR); + tipabort(NULL); } /*ARGSUSED*/ @@ -781,7 +781,7 @@ variable(int c) } if (vtable[PARITY].v_access&CHANGED) { vtable[PARITY].v_access &= ~CHANGED; - setparity(NOSTR); + setparity(NULL); } if (vtable[HARDWAREFLOW].v_access&CHANGED) { vtable[HARDWAREFLOW].v_access &= ~CHANGED; @@ -792,7 +792,7 @@ variable(int c) } if (vtable[LINEDISC].v_access&CHANGED) { vtable[LINEDISC].v_access &= ~CHANGED; - linedisc(NOSTR); + linedisc(NULL); } } @@ -925,7 +925,7 @@ expand(char name[]) (void)snprintf(cmdbuf, sizeof(cmdbuf), "echo %s", name); if ((pid = vfork()) == 0) { Shell = value(SHELL); - if (Shell == NOSTR) + if (Shell == NULL) Shell = _PATH_BSHELL; close(pivec[0]); close(1); @@ -940,7 +940,7 @@ expand(char name[]) perror("fork"); close(pivec[0]); close(pivec[1]); - return(NOSTR); + return(NULL); } close(pivec[1]); l = read(pivec[0], xname, BUFSIZ); @@ -950,19 +950,19 @@ expand(char name[]) s &= 0377; if (s != 0 && s != SIGPIPE) { fprintf(stderr, "\"Echo\" failed\n"); - return(NOSTR); + return(NULL); } if (l < 0) { perror("read"); - return(NOSTR); + return(NULL); } if (l == 0) { fprintf(stderr, "\"%s\": No match\n", name); - return(NOSTR); + return(NULL); } if (l == BUFSIZ) { fprintf(stderr, "Buffer overflow expanding \"%s\"\n", name); - return(NOSTR); + return(NULL); } xname[l] = 0; for (cp = &xname[l-1]; *cp == '\n' && cp > xname; cp--) diff --git a/usr.bin/tip/cu.c b/usr.bin/tip/cu.c index e5dbd97a8a2..2ad7cb59da9 100644 --- a/usr.bin/tip/cu.c +++ b/usr.bin/tip/cu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cu.c,v 1.21 2006/11/07 07:16:15 ray Exp $ */ +/* $OpenBSD: cu.c,v 1.22 2007/05/15 19:42:05 moritz Exp $ */ /* $NetBSD: cu.c,v 1.5 1997/02/11 09:24:05 mrg Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)cu.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: cu.c,v 1.21 2006/11/07 07:16:15 ray Exp $"; +static const char rcsid[] = "$OpenBSD: cu.c,v 1.22 2007/05/15 19:42:05 moritz Exp $"; #endif /* not lint */ #include <err.h> @@ -56,7 +56,7 @@ cumain(int argc, char *argv[]) if (argc < 2) cuusage(); - CU = DV = NOSTR; + CU = DV = NULL; BR = DEFBR; parity = 0; /* none */ diff --git a/usr.bin/tip/log.c b/usr.bin/tip/log.c index bb899d896a4..2b485d59941 100644 --- a/usr.bin/tip/log.c +++ b/usr.bin/tip/log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.8 2006/03/16 19:32:46 deraadt Exp $ */ +/* $OpenBSD: log.c,v 1.9 2007/05/15 19:42:05 moritz Exp $ */ /* $NetBSD: log.c,v 1.4 1994/12/24 17:56:28 cgd Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)log.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: log.c,v 1.8 2006/03/16 19:32:46 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: log.c,v 1.9 2007/05/15 19:42:05 moritz Exp $"; #endif /* not lint */ #include "tip.h" @@ -58,8 +58,8 @@ logent(char *group, char *num, char *acu, char *message) perror("flock"); return; } - if ((user = getlogin()) == NOSTR) { - if ((pwd = getpwuid(getuid())) == NOPWD) + if ((user = getlogin()) == NULL) { + if ((pwd = getpwuid(getuid())) == NULL) user = "???"; else user = pwd->pw_name; diff --git a/usr.bin/tip/remote.c b/usr.bin/tip/remote.c index 249b315fe05..2312a05388c 100644 --- a/usr.bin/tip/remote.c +++ b/usr.bin/tip/remote.c @@ -1,4 +1,4 @@ -/* $OpenBSD: remote.c,v 1.16 2006/06/06 23:24:52 deraadt Exp $ */ +/* $OpenBSD: remote.c,v 1.17 2007/05/15 19:42:05 moritz Exp $ */ /* $NetBSD: remote.c,v 1.5 1997/04/20 00:02:45 mellon Exp $ */ /* @@ -41,7 +41,7 @@ static const char copyright[] = #if 0 static char sccsid[] = "@(#)remote.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: remote.c,v 1.16 2006/06/06 23:24:52 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: remote.c,v 1.17 2007/05/15 19:42:05 moritz Exp $"; #endif /* not lint */ #include <stdio.h> @@ -130,17 +130,17 @@ getremcap(char *host) DU = 0; else DU = cgetflag("du"); - if (DV == NOSTR) { + if (DV == NULL) { fprintf(stderr, "%s: missing device spec\n", host); exit(3); } - if (DU && CU == NOSTR) + if (DU && CU == NULL) CU = DV; - if (DU && PN == NOSTR) { + if (DU && PN == NULL) { fprintf(stderr, "%s: missing phone number\n", host); exit(3); } - if (DU && AT == NOSTR) { + if (DU && AT == NULL) { fprintf(stderr, "%s: missing acu type\n", host); exit(3); } @@ -152,7 +152,7 @@ getremcap(char *host) * from the description file */ if (!HW) - HW = (CU == NOSTR) || (DU && equal(DV, CU)); + HW = (CU == NULL) || (DU && equal(DV, CU)); HO = host; /* * see if uppercase mode should be turned on initially @@ -185,17 +185,17 @@ getremcap(char *host) setboolean(value(DC), 1); if (cgetflag("hf")) setboolean(value(HARDWAREFLOW), 1); - if (RE == NOSTR) + if (RE == NULL) RE = (char *)"tip.record"; - if (EX == NOSTR) + if (EX == NULL) EX = (char *)"\t\n\b\f"; - if (ES != NOSTR) + if (ES != NULL) vstring("es", ES); - if (FO != NOSTR) + if (FO != NULL) vstring("fo", FO); - if (PR != NOSTR) + if (PR != NULL) vstring("pr", PR); - if (RC != NOSTR) + if (RC != NULL) vstring("rc", RC); if (cgetnum(bp, "dl", &DL) == -1) DL = 0; @@ -213,7 +213,7 @@ getremote(char *host) static int lookedup = 0; if (!lookedup) { - if (host == NOSTR && (host = getenv("HOST")) == NOSTR) { + if (host == NULL && (host = getenv("HOST")) == NULL) { fprintf(stderr, "%s: no host specified\n", __progname); exit(3); } @@ -225,11 +225,11 @@ getremote(char *host) * We return a new device each time we're called (to allow * a rotary action to be simulated) */ - if (next == NOSTR) - return (NOSTR); + if (next == NULL) + return (NULL); if ((cp = strchr(next, ',')) == NULL) { DV = next; - next = NOSTR; + next = NULL; } else { *cp++ = '\0'; DV = next; diff --git a/usr.bin/tip/tip.c b/usr.bin/tip/tip.c index c04eb9a70ef..715e131e862 100644 --- a/usr.bin/tip/tip.c +++ b/usr.bin/tip/tip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tip.c,v 1.32 2006/11/27 23:19:41 mcbride Exp $ */ +/* $OpenBSD: tip.c,v 1.33 2007/05/15 19:42:05 moritz Exp $ */ /* $NetBSD: tip.c,v 1.13 1997/04/20 00:03:05 mellon Exp $ */ /* @@ -40,7 +40,7 @@ static const char copyright[] = #if 0 static char sccsid[] = "@(#)tip.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: tip.c,v 1.32 2006/11/27 23:19:41 mcbride Exp $"; +static const char rcsid[] = "$OpenBSD: tip.c,v 1.33 2007/05/15 19:42:05 moritz Exp $"; #endif /* not lint */ /* @@ -62,7 +62,7 @@ static int escape(void); int main(int argc, char *argv[]) { - char *sys = NOSTR, sbuf[12], *p; + char *sys = NULL, sbuf[12], *p; int i; /* XXX preserve previous braindamaged behavior */ @@ -112,7 +112,7 @@ main(int argc, char *argv[]) } } - if (sys == NOSTR) + if (sys == NULL) goto notnumber; if (isalpha(*sys)) goto notnumber; @@ -165,7 +165,7 @@ notnumber: * Kludge, their's no easy way to get the initialization * in the right order, so force it here */ - if ((PH = getenv("PHONES")) == NOSTR) + if ((PH = getenv("PHONES")) == NULL) PH = _PATH_PHONES; vinit(); /* init variables */ setparity("none"); /* set the parity table */ @@ -589,7 +589,7 @@ setparity(char *defparity) char *parity; extern const unsigned char evenpartab[]; - if (value(PARITY) == NOSTR) + if (value(PARITY) == NULL) value(PARITY) = defparity; parity = value(PARITY); if (equal(parity, "none")) { diff --git a/usr.bin/tip/tip.h b/usr.bin/tip/tip.h index dc42310f251..22ed0718374 100644 --- a/usr.bin/tip/tip.h +++ b/usr.bin/tip/tip.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tip.h,v 1.28 2006/11/06 19:37:21 millert Exp $ */ +/* $OpenBSD: tip.h,v 1.29 2007/05/15 19:42:05 moritz Exp $ */ /* $NetBSD: tip.h,v 1.7 1997/04/20 00:02:46 mellon Exp $ */ /* @@ -229,12 +229,6 @@ extern value_t vtable[]; /* variable table */ #define LINEDISC 34 #define DC 35 -#define NOVAL ((value_t *)NULL) -#define NOACU ((acu_t *)NULL) -#define NOSTR ((char *)NULL) -#define NOFILE ((FILE *)NULL) -#define NOPWD ((struct passwd *)0) - struct termios term; /* current mode of terminal */ struct termios defterm; /* initial mode of terminal */ struct termios defchars; /* current mode with initial chars */ diff --git a/usr.bin/tip/value.c b/usr.bin/tip/value.c index 451d99a8ea1..325485b5bf0 100644 --- a/usr.bin/tip/value.c +++ b/usr.bin/tip/value.c @@ -1,4 +1,4 @@ -/* $OpenBSD: value.c,v 1.16 2007/02/20 16:59:24 moritz Exp $ */ +/* $OpenBSD: value.c,v 1.17 2007/05/15 19:42:05 moritz Exp $ */ /* $NetBSD: value.c,v 1.6 1997/02/11 09:24:09 mrg Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)value.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: value.c,v 1.16 2007/02/20 16:59:24 moritz Exp $"; +static const char rcsid[] = "$OpenBSD: value.c,v 1.17 2007/05/15 19:42:05 moritz Exp $"; #endif /* not lint */ #include "tip.h" @@ -111,7 +111,7 @@ vassign(value_t *p, char *v) return; if (!(p->v_type&(ENVIRON|INIT))) free(p->v_value); - if ((p->v_value = strdup(v)) == NOSTR) { + if ((p->v_value = strdup(v)) == NULL) { printf("out of core\r\n"); return; } @@ -189,7 +189,7 @@ vtoken(char *s) p = vlookup(s); else p = vlookup(s+1); - if (p != NOVAL) { + if (p != NULL) { vassign(p, s); return; } diff --git a/usr.bin/tip/vars.c b/usr.bin/tip/vars.c index 56027ca2011..8c973684bf2 100644 --- a/usr.bin/tip/vars.c +++ b/usr.bin/tip/vars.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vars.c,v 1.8 2006/08/18 03:06:18 jason Exp $ */ +/* $OpenBSD: vars.c,v 1.9 2007/05/15 19:42:05 moritz Exp $ */ /* $NetBSD: vars.c,v 1.3 1994/12/08 09:31:19 jtc Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)vars.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: vars.c,v 1.8 2006/08/18 03:06:18 jason Exp $"; +static const char rcsid[] = "$OpenBSD: vars.c,v 1.9 2007/05/15 19:42:05 moritz Exp $"; #endif /* not lint */ #include "tip.h" @@ -55,7 +55,7 @@ value_t vtable[] = { { "eofwrite", STRING|IREMOTE|INIT, (READ|WRITE)<<PUBLIC, "eofw", (char *)&OE }, { "eol", STRING|IREMOTE|INIT, (READ|WRITE)<<PUBLIC, - NOSTR, (char *)&EL }, + NULL, (char *)&EL }, { "escape", CHAR, (READ|WRITE)<<PUBLIC, "es", (char *)'~' }, { "exceptions", STRING|INIT|IREMOTE, (READ|WRITE)<<PUBLIC, @@ -67,19 +67,19 @@ value_t vtable[] = { { "host", STRING|IREMOTE|INIT, READ<<PUBLIC, "ho", (char *)&HO }, { "log", STRING|INIT, (READ|WRITE)<<ROOT, - NOSTR, _PATH_ACULOG }, + NULL, _PATH_ACULOG }, { "phones", STRING|INIT|IREMOTE, READ<<PUBLIC, - NOSTR, (char *)&PH }, + NULL, (char *)&PH }, { "prompt", CHAR, (READ|WRITE)<<PUBLIC, "pr", (char *)'\n' }, { "raise", BOOL, (READ|WRITE)<<PUBLIC, "ra", (char *)FALSE }, { "raisechar", CHAR, (READ|WRITE)<<PUBLIC, - "rc", NOSTR }, + "rc", NULL }, { "record", STRING|INIT|IREMOTE, (READ|WRITE)<<PUBLIC, "rec", (char *)&RE }, { "remote", STRING|INIT|IREMOTE, READ<<PUBLIC, - NOSTR, (char *)&RM }, + NULL, (char *)&RM }, { "script", BOOL, (READ|WRITE)<<PUBLIC, "sc", (char *)FALSE }, { "tabexpand", BOOL, (READ|WRITE)<<PUBLIC, @@ -89,7 +89,7 @@ value_t vtable[] = { { "SHELL", STRING|ENVIRON|INIT, (READ|WRITE)<<PUBLIC, NULL, _PATH_BSHELL }, { "HOME", STRING|ENVIRON, (READ|WRITE)<<PUBLIC, - NOSTR, NOSTR }, + NULL, NULL }, { "echocheck", BOOL, (READ|WRITE)<<PUBLIC, "ec", (char *)FALSE }, { "disconnect", STRING|IREMOTE|INIT, (READ|WRITE)<<PUBLIC, @@ -116,5 +116,5 @@ value_t vtable[] = { "ld", (char *)&LD }, { "direct", BOOL, (READ<<PUBLIC)|(WRITE<<ROOT), "dc", (char *)FALSE }, - { NOSTR, NULL, NULL, NOSTR, NOSTR } + { NULL, NULL, NULL, NULL, NULL } }; |