Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/tip get rid of equal(), use {s, g}etprogname().
details: https://anonhg.NetBSD.org/src/rev/29c9d32d476f
branches: trunk
changeset: 790796:29c9d32d476f
user: christos <christos%NetBSD.org@localhost>
date: Mon Oct 21 14:47:46 2013 +0000
description:
get rid of equal(), use {s,g}etprogname().
diffstat:
usr.bin/tip/remote.c | 6 +++---
usr.bin/tip/tip.c | 17 +++++++++--------
usr.bin/tip/tip.h | 4 +---
usr.bin/tip/value.c | 11 ++++++-----
4 files changed, 19 insertions(+), 19 deletions(-)
diffs (150 lines):
diff -r 2a2572d947d6 -r 29c9d32d476f usr.bin/tip/remote.c
--- a/usr.bin/tip/remote.c Mon Oct 21 14:25:14 2013 +0000
+++ b/usr.bin/tip/remote.c Mon Oct 21 14:47:46 2013 +0000
@@ -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 @@
#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 @@
* 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
diff -r 2a2572d947d6 -r 29c9d32d476f usr.bin/tip/tip.c
--- a/usr.bin/tip/tip.c Mon Oct 21 14:25:14 2013 +0000
+++ b/usr.bin/tip/tip.c Mon Oct 21 14:47:46 2013 +0000
@@ -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 @@
#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 @@
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 @@
value(PARITY) = curpar = strdup(defparity);
}
parity = value(PARITY);
- if (equal(parity, "none")) {
+ if (strcmp(parity, "none") == 0) {
bits8 = 1;
return;
}
@@ -553,13 +554,13 @@
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);
}
diff -r 2a2572d947d6 -r 29c9d32d476f usr.bin/tip/tip.h
--- a/usr.bin/tip/tip.h Mon Oct 21 14:25:14 2013 +0000
+++ b/usr.bin/tip/tip.h Mon Oct 21 14:47:46 2013 +0000
@@ -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 @@
}
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
diff -r 2a2572d947d6 -r 29c9d32d476f usr.bin/tip/value.c
--- a/usr.bin/tip/value.c Mon Oct 21 14:25:14 2013 +0000
+++ b/usr.bin/tip/value.c Mon Oct 21 14:47:46 2013 +0000
@@ -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 @@
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 @@
{
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 @@
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);
}
Home |
Main Index |
Thread Index |
Old Index