Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-6]: src/usr.bin/tn3270/tools/mkhits Pull up revisions 1.11-1.12...
details: https://anonhg.NetBSD.org/src/rev/1aba7a1948d6
branches: netbsd-1-6
changeset: 529609:1aba7a1948d6
user: he <he%NetBSD.org@localhost>
date: Sun Dec 01 12:20:49 2002 +0000
description:
Pull up revisions 1.11-1.12 (requested by thorpej in ticket #821):
Make the tn3270 host tools build on non-BSD systems.
Also, remove some non-__STDC__ handling.
diffstat:
usr.bin/tn3270/tools/mkhits/dohits.c | 59 ++++++++++++++++++-----------------
1 files changed, 31 insertions(+), 28 deletions(-)
diffs (144 lines):
diff -r b69abd679f3c -r 1aba7a1948d6 usr.bin/tn3270/tools/mkhits/dohits.c
--- a/usr.bin/tn3270/tools/mkhits/dohits.c Sun Dec 01 12:20:28 2002 +0000
+++ b/usr.bin/tn3270/tools/mkhits/dohits.c Sun Dec 01 12:20:49 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dohits.c,v 1.10 2002/01/31 19:36:52 tv Exp $ */
+/* $NetBSD: dohits.c,v 1.10.2.1 2002/12/01 12:20:49 he Exp $ */
/*-
* Copyright (c) 1988 The Regents of the University of California.
@@ -33,12 +33,17 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
+#include <ctype.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
#if defined(__RCSID) && !defined(lint)
#if 0
static char sccsid[] = "@(#)dohits.c 4.2 (Berkeley) 4/26/91";
#else
-__RCSID("$NetBSD: dohits.c,v 1.10 2002/01/31 19:36:52 tv Exp $");
+__RCSID("$NetBSD: dohits.c,v 1.10.2.1 2002/12/01 12:20:49 he Exp $");
#endif
#endif /* not lint */
@@ -60,15 +65,6 @@
* all fields are separated by a single space.
*/
-#include <stdio.h>
-#include <string.h>
-#include <err.h>
-#include <ctype.h>
-#ifdef __STDC__
-#include <stdlib.h>
-#else
-extern char *malloc();
-#endif
#include "../general/general.h"
#include "../api/asc_ebc.h"
#include "../api/ebc_disp.h"
@@ -80,11 +76,11 @@
struct thing *table[100];
-static void add __P((const char *, const char *, int));
-static void scanwhite __P((const char *, const char *));
-static void scandefine __P((const char *, const char *));
-static char *savechr __P((unsigned int));
-static char *doit __P((struct hit *, unsigned char *, struct Hits *));
+static void add(const char *, const char *, int);
+static void scanwhite(const char *, const char *);
+static void scandefine(const char *, const char *);
+static char *savechr(unsigned int);
+static char *doit(struct hit *, unsigned char *, struct Hits *);
unsigned int
dohash(seed, string)
@@ -133,8 +129,10 @@
char line[200];
(void) snprintf(compare, sizeof(compare), " %s%%[^,\t \n]", prefix);
- if ((ourfile = fopen(file, "r")) == NULL)
- err(1, "Cannot open `%s'", file);
+ if ((ourfile = fopen(file, "r")) == NULL) {
+ fprintf(stderr, "Cannot open `%s': %s\n", file, strerror(errno));
+ exit(1);
+ }
while (!feof(ourfile)) {
if (fscanf(ourfile, compare, what) == 1) {
add(prefix, what, 0);
@@ -142,7 +140,7 @@
do {
if (fgets(line, sizeof line, ourfile) == NULL) {
if (!feof(ourfile)) {
- warn("fgets failed");
+ fprintf(stderr, "fgets failed: %s\n", strerror(errno));
}
break;
}
@@ -162,8 +160,10 @@
int whatitis;
snprintf(compare, sizeof(compare), "#define %s%%s %%s", prefix);
- if ((ourfile = fopen(file, "r")) == NULL)
- err(1, "Cannot open `%s'", file);
+ if ((ourfile = fopen(file, "r")) == NULL) {
+ fprintf(stderr, "Cannot open `%s': %s\n", file, strerror(errno));
+ exit(1);
+ }
while (!feof(ourfile)) {
if (fscanf(ourfile, compare, what, value) == 2) {
@@ -181,7 +181,8 @@
do {
if (fgets(line, sizeof line, ourfile) == NULL) {
if (!feof(ourfile)) {
- warn("End of file with error");
+ fprintf(stderr, "End of file with error: %s\n",
+ strerror(errno));
}
break;
}
@@ -193,8 +194,10 @@
unsigned int c;
{
char *foo = malloc(sizeof(unsigned char));
- if (foo == NULL)
- err(1, "No room for ascii characters");
+ if (foo == NULL) {
+ fprintf(stderr, "No room for ascii characters\n");
+ exit(1);
+ }
*foo = c;
return foo;
}
@@ -228,7 +231,7 @@
return this->name;
}
}
- warnx("Unknown type %s.", type);
+ fprintf(stderr, "Unknown type %s.\n", type);
return 0;
}
}
@@ -279,12 +282,12 @@
continue;
}
if (scancode >= 256) {
- warnx("Scancode 0x%02x for keynumber %d", scancode,
+ fprintf(stderr, "Scancode 0x%02x for keynumber %d\n", scancode,
keynumber);
break;
}
if (Hits[scancode].hits.hit[0].ctlrfcn != undefined) {
- warnx("Duplicate scancode 0x%02x for keynumber %d",
+ fprintf(stderr, "Duplicate scancode 0x%02x for keynumber %d\n",
scancode, keynumber);
break;
}
Home |
Main Index |
Thread Index |
Old Index