Module Name: src Committed By: christos Date: Mon Oct 21 14:47:46 UTC 2013
Modified Files: src/usr.bin/tip: remote.c tip.c tip.h value.c Log Message: get rid of equal(), use {s,g}etprogname(). To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/usr.bin/tip/remote.c cvs rdiff -u -r1.52 -r1.53 src/usr.bin/tip/tip.c cvs rdiff -u -r1.32 -r1.33 src/usr.bin/tip/tip.h cvs rdiff -u -r1.14 -r1.15 src/usr.bin/tip/value.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/tip/remote.c diff -u src/usr.bin/tip/remote.c:1.18 src/usr.bin/tip/remote.c:1.19 --- src/usr.bin/tip/remote.c:1.18 Mon Jul 21 10:19:26 2008 +++ src/usr.bin/tip/remote.c Mon Oct 21 10:47:46 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: remote.c,v 1.18 2008/07/21 14:19:26 lukem Exp $ */ +/* $NetBSD: remote.c,v 1.19 2013/10/21 14:47:46 christos Exp $ */ /* * Copyright (c) 1992, 1993 @@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 19 #if 0 static char sccsid[] = "@(#)remote.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: remote.c,v 1.18 2008/07/21 14:19:26 lukem Exp $"); +__RCSID("$NetBSD: remote.c,v 1.19 2013/10/21 14:47:46 christos Exp $"); #endif /* not lint */ #include "pathnames.h" @@ -143,7 +143,7 @@ getremcap(char *host) * from the description file */ if (!HW) - HW = (CU == NULL) || (DU && equal(DV, CU)); + HW = (CU == NULL) || (DU && strcmp(DV, CU) == 0); HO = host; /* * see if uppercase mode should be turned on initially Index: src/usr.bin/tip/tip.c diff -u src/usr.bin/tip/tip.c:1.52 src/usr.bin/tip/tip.c:1.53 --- src/usr.bin/tip/tip.c:1.52 Sun Jun 2 09:18:12 2013 +++ src/usr.bin/tip/tip.c Mon Oct 21 10:47:46 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: tip.c,v 1.52 2013/06/02 13:18:12 christos Exp $ */ +/* $NetBSD: tip.c,v 1.53 2013/10/21 14:47:46 christos Exp $ */ /* * Copyright (c) 1983, 1993 @@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19 #if 0 static char sccsid[] = "@(#)tip.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: tip.c,v 1.52 2013/06/02 13:18:12 christos Exp $"); +__RCSID("$NetBSD: tip.c,v 1.53 2013/10/21 14:47:46 christos Exp $"); #endif /* not lint */ /* @@ -76,11 +76,12 @@ main(int argc, char *argv[]) static char brbuf[16]; int fcarg; + setprogname(argv[0]); gid = getgid(); egid = getegid(); uid = getuid(); euid = geteuid(); - if (equal(basename(argv[0]), "cu")) { + if (strcmp(getprogname(), "cu") == 0) { cumode = 1; cumain(argc, argv); goto cucommon; @@ -545,7 +546,7 @@ setparity(const char *defparity) value(PARITY) = curpar = strdup(defparity); } parity = value(PARITY); - if (equal(parity, "none")) { + if (strcmp(parity, "none") == 0) { bits8 = 1; return; } @@ -553,13 +554,13 @@ setparity(const char *defparity) flip = 0; clr = 0377; set = 0; - if (equal(parity, "odd")) + if (strcmp(parity, "odd") == 0) flip = 0200; /* reverse bit 7 */ - else if (equal(parity, "zero")) + else if (strcmp(parity, "zero") == 0) clr = 0177; /* turn off bit 7 */ - else if (equal(parity, "one")) + else if (strcmp(parity, "one") == 0) set = 0200; /* turn on bit 7 */ - else if (!equal(parity, "even")) { + else if (strcmp(parity, "even") != 0) { (void)fprintf(stderr, "%s: unknown parity value\r\n", parity); (void)fflush(stderr); } Index: src/usr.bin/tip/tip.h diff -u src/usr.bin/tip/tip.h:1.32 src/usr.bin/tip/tip.h:1.33 --- src/usr.bin/tip/tip.h:1.32 Tue Sep 6 14:33:01 2011 +++ src/usr.bin/tip/tip.h Mon Oct 21 10:47:46 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: tip.h,v 1.32 2011/09/06 18:33:01 joerg Exp $ */ +/* $NetBSD: tip.h,v 1.33 2013/10/21 14:47:46 christos Exp $ */ /* * Copyright (c) 1989, 1993 @@ -141,8 +141,6 @@ typedef } acu_t; -#define equal(a, b) (strcmp(a,b)==0)/* A nice function to string compare */ - /* * variable manipulation stuff -- * if we defined the value entry in value_t, then we couldn't Index: src/usr.bin/tip/value.c diff -u src/usr.bin/tip/value.c:1.14 src/usr.bin/tip/value.c:1.15 --- src/usr.bin/tip/value.c:1.14 Thu Dec 14 12:09:43 2006 +++ src/usr.bin/tip/value.c Mon Oct 21 10:47:46 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: value.c,v 1.14 2006/12/14 17:09:43 christos Exp $ */ +/* $NetBSD: value.c,v 1.15 2013/10/21 14:47:46 christos Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)value.c 8.1 (Berkeley) 6/6/93"; #endif -__RCSID("$NetBSD: value.c,v 1.14 2006/12/14 17:09:43 christos Exp $"); +__RCSID("$NetBSD: value.c,v 1.15 2013/10/21 14:47:46 christos Exp $"); #endif /* not lint */ #include "tip.h" @@ -101,7 +101,7 @@ vassign(value_t *p, char *v) switch (p->v_type&TMASK) { case STRING: - if (p->v_value && equal(p->v_value, v)) + if (p->v_value && strcmp(p->v_value, v) == 0) return; if (!(p->v_type&(ENVIRON|INIT))) free(p->v_value); @@ -137,7 +137,7 @@ vlex(char *s) { value_t *p; - if (equal(s, "all")) { + if (strcmp(s, "all") == 0) { for (p = vtable; p->v_name; p++) if (vaccess(p->v_access, READ)) vprint(p); @@ -264,7 +264,8 @@ vlookup(const char *s) value_t *p; for (p = vtable; p->v_name; p++) - if (equal(p->v_name, s) || (p->v_abrev && equal(p->v_abrev, s))) + if (strcmp(p->v_name, s) == 0 || + (p->v_abrev && strcmp(p->v_abrev, s) == 0)) return (p); return (NULL); }