get rid of equal(), use {s,g}etprogname().

This commit is contained in:
christos 2013-10-21 14:47:46 +00:00
parent ffd934089d
commit a64eb75968
4 changed files with 19 additions and 19 deletions

View File

@ -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, 1993\
#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

View File

@ -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, 1993\
#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);
}

View File

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

View File

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