Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/tn3270 Make the tn3270 host tools build on non-BSD s...



details:   https://anonhg.NetBSD.org/src/rev/5a0ebf494a41
branches:  trunk
changeset: 536410:5a0ebf494a41
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Sep 15 01:27:44 2002 +0000

description:
Make the tn3270 host tools build on non-BSD systems.  Slightly
kludgy, but saves a major overhaul.

diffstat:

 usr.bin/tn3270/api/asc_ebc.c             |   6 ++-
 usr.bin/tn3270/api/ebc_disp.c            |   6 ++-
 usr.bin/tn3270/tools/mkastods/Makefile   |   3 +-
 usr.bin/tn3270/tools/mkastods/mkastods.c |  12 ++++----
 usr.bin/tn3270/tools/mkastosc/Makefile   |   3 +-
 usr.bin/tn3270/tools/mkastosc/mkastosc.c |  18 +++++------
 usr.bin/tn3270/tools/mkdctype/Makefile   |   3 +-
 usr.bin/tn3270/tools/mkdstoas/Makefile   |   3 +-
 usr.bin/tn3270/tools/mkdstoas/mkdstoas.c |  13 ++++----
 usr.bin/tn3270/tools/mkhits/Makefile     |   3 +-
 usr.bin/tn3270/tools/mkhits/dohits.c     |  46 ++++++++++++++++++-------------
 usr.bin/tn3270/tools/mkhits/mkhits.c     |  12 ++++----
 12 files changed, 70 insertions(+), 58 deletions(-)

diffs (truncated from 403 to 300 lines):

diff -r 8d1e77ed92aa -r 5a0ebf494a41 usr.bin/tn3270/api/asc_ebc.c
--- a/usr.bin/tn3270/api/asc_ebc.c      Sun Sep 15 01:18:59 2002 +0000
+++ b/usr.bin/tn3270/api/asc_ebc.c      Sun Sep 15 01:27:44 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: asc_ebc.c,v 1.5 2002/01/31 19:36:50 tv Exp $   */
+/*     $NetBSD: asc_ebc.c,v 1.6 2002/09/15 01:27:44 thorpej Exp $      */
 
 /*-
  * Copyright (c) 1988 The Regents of the University of California.
@@ -33,14 +33,16 @@
  * SUCH DAMAGE.
  */
 
+#ifndef HOST_TOOL
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
 #if 0
 static char sccsid[] = "@(#)asc_ebc.c  4.2 (Berkeley) 4/26/91";
 #else
-__RCSID("$NetBSD: asc_ebc.c,v 1.5 2002/01/31 19:36:50 tv Exp $");
+__RCSID("$NetBSD: asc_ebc.c,v 1.6 2002/09/15 01:27:44 thorpej Exp $");
 #endif
 #endif /* not lint */
+#endif /* ! HOST_TOOL */
 
 /*
  * Ascii<->Ebcdic translation tables.
diff -r 8d1e77ed92aa -r 5a0ebf494a41 usr.bin/tn3270/api/ebc_disp.c
--- a/usr.bin/tn3270/api/ebc_disp.c     Sun Sep 15 01:18:59 2002 +0000
+++ b/usr.bin/tn3270/api/ebc_disp.c     Sun Sep 15 01:27:44 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ebc_disp.c,v 1.5 2002/01/31 19:36:50 tv Exp $  */
+/*     $NetBSD: ebc_disp.c,v 1.6 2002/09/15 01:27:44 thorpej Exp $     */
 
 /*-
  * Copyright (c) 1988 The Regents of the University of California.
@@ -33,14 +33,16 @@
  * SUCH DAMAGE.
  */
 
+#ifndef HOST_TOOL
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
 #if 0
 static char sccsid[] = "@(#)ebc_disp.c 4.2 (Berkeley) 4/26/91";
 #else
-__RCSID("$NetBSD: ebc_disp.c,v 1.5 2002/01/31 19:36:50 tv Exp $");
+__RCSID("$NetBSD: ebc_disp.c,v 1.6 2002/09/15 01:27:44 thorpej Exp $");
 #endif
 #endif /* not lint */
+#endif /* ! HOST_TOOL */
 
 /*
  * Translate table to map EBCDIC into 3270 display codes.
diff -r 8d1e77ed92aa -r 5a0ebf494a41 usr.bin/tn3270/tools/mkastods/Makefile
--- a/usr.bin/tn3270/tools/mkastods/Makefile    Sun Sep 15 01:18:59 2002 +0000
+++ b/usr.bin/tn3270/tools/mkastods/Makefile    Sun Sep 15 01:27:44 2002 +0000
@@ -1,6 +1,7 @@
-#      $NetBSD: Makefile,v 1.9 1999/07/14 21:36:37 wrstuden Exp $
+#      $NetBSD: Makefile,v 1.10 2002/09/15 01:27:45 thorpej Exp $
 
 HOSTPROG=      mkastods
+HOST_CPPFLAGS+=        -DHOST_TOOL
 SRCS=  mkastods.c asc_ebc.c ebc_disp.c
 
 .include <bsd.hostprog.mk>
diff -r 8d1e77ed92aa -r 5a0ebf494a41 usr.bin/tn3270/tools/mkastods/mkastods.c
--- a/usr.bin/tn3270/tools/mkastods/mkastods.c  Sun Sep 15 01:18:59 2002 +0000
+++ b/usr.bin/tn3270/tools/mkastods/mkastods.c  Sun Sep 15 01:27:44 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mkastods.c,v 1.7 2002/06/13 23:41:21 wiz Exp $ */
+/*     $NetBSD: mkastods.c,v 1.8 2002/09/15 01:27:45 thorpej Exp $     */
 
 /*-
  * Copyright (c) 1988 The Regents of the University of California.
@@ -33,7 +33,10 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
 #if defined(__COPYRIGHT) && !defined(lint)
 __COPYRIGHT(
 "@(#) Copyright (c) 1988 The Regents of the University of California.\n\
@@ -44,13 +47,10 @@
 #if 0
 static char sccsid[] = "@(#)mkastods.c 4.2 (Berkeley) 4/26/91";
 #else
-__RCSID("$NetBSD: mkastods.c,v 1.7 2002/06/13 23:41:21 wiz Exp $");
+__RCSID("$NetBSD: mkastods.c,v 1.8 2002/09/15 01:27:45 thorpej Exp $");
 #endif
 #endif /* not lint */
 
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
 #include "../api/asc_ebc.h"
 #include "../api/ebc_disp.h"
 
diff -r 8d1e77ed92aa -r 5a0ebf494a41 usr.bin/tn3270/tools/mkastosc/Makefile
--- a/usr.bin/tn3270/tools/mkastosc/Makefile    Sun Sep 15 01:18:59 2002 +0000
+++ b/usr.bin/tn3270/tools/mkastosc/Makefile    Sun Sep 15 01:27:44 2002 +0000
@@ -1,6 +1,7 @@
-#      $NetBSD: Makefile,v 1.9 1999/07/14 21:36:37 wrstuden Exp $
+#      $NetBSD: Makefile,v 1.10 2002/09/15 01:27:46 thorpej Exp $
 
 HOSTPROG=      mkastosc
+HOST_CPPFLAGS+=        -DHOST_TOOL
 SRCS=  mkastosc.c dohits.c asc_ebc.c ebc_disp.c
 
 HOST_CPPFLAGS+=-I${.CURDIR}/../mkhits
diff -r 8d1e77ed92aa -r 5a0ebf494a41 usr.bin/tn3270/tools/mkastosc/mkastosc.c
--- a/usr.bin/tn3270/tools/mkastosc/mkastosc.c  Sun Sep 15 01:18:59 2002 +0000
+++ b/usr.bin/tn3270/tools/mkastosc/mkastosc.c  Sun Sep 15 01:27:44 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mkastosc.c,v 1.9 2002/06/13 23:41:21 wiz Exp $ */
+/*     $NetBSD: mkastosc.c,v 1.10 2002/09/15 01:27:46 thorpej Exp $    */
 
 /*-
  * Copyright (c) 1988 The Regents of the University of California.
@@ -33,7 +33,10 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
 #if defined(__COPYRIGHT) && !defined(lint)
 __COPYRIGHT(
 "@(#) Copyright (c) 1988 The Regents of the University of California.\n\
@@ -44,15 +47,10 @@
 #if 0
 static char sccsid[] = "@(#)mkastosc.c 4.2 (Berkeley) 4/26/91";
 #else
-__RCSID("$NetBS$");
+__RCSID("$NetBSD: mkastosc.c,v 1.10 2002/09/15 01:27:46 thorpej Exp $");
 #endif
 #endif /* not lint */
 
-#include <stdio.h>
-#include <string.h>
-#include <err.h>
-#include <ctype.h>
-
 #include "../general/general.h"
 #include "../ctlr/function.h"
 
@@ -124,8 +122,8 @@
     for (Pt = tbl, asciicode = 0; Pt <= tbl+highestof(tbl); Pt++, asciicode++) {
        if (Pt->used == 0) {
            if (isprint(asciicode) && (asciicode != ' ')) {
-               warnx("Unable to produce scancode sequence for"
-                   " ASCII character [%c]!", asciicode);
+               fprintf(stderr, "mkastosc: Unable to produce scancode sequence"
+                   " for ASCII character [%c]!", asciicode);
            }
            printf("\t{ 0, 0, undefined, 0 },\t");
        } else {
diff -r 8d1e77ed92aa -r 5a0ebf494a41 usr.bin/tn3270/tools/mkdctype/Makefile
--- a/usr.bin/tn3270/tools/mkdctype/Makefile    Sun Sep 15 01:18:59 2002 +0000
+++ b/usr.bin/tn3270/tools/mkdctype/Makefile    Sun Sep 15 01:27:44 2002 +0000
@@ -1,6 +1,7 @@
-#      $NetBSD: Makefile,v 1.10 1999/07/14 21:36:38 wrstuden Exp $
+#      $NetBSD: Makefile,v 1.11 2002/09/15 01:27:46 thorpej Exp $
 
 HOSTPROG=      mkdctype
+HOST_CPPFLAGS+=        -DHOST_TOOL
 SRCS=  mkdctype.c asc_ebc.c ebc_disp.c ectype.c
 
 .include <bsd.hostprog.mk>
diff -r 8d1e77ed92aa -r 5a0ebf494a41 usr.bin/tn3270/tools/mkdstoas/Makefile
--- a/usr.bin/tn3270/tools/mkdstoas/Makefile    Sun Sep 15 01:18:59 2002 +0000
+++ b/usr.bin/tn3270/tools/mkdstoas/Makefile    Sun Sep 15 01:27:44 2002 +0000
@@ -1,6 +1,7 @@
-#      $NetBSD: Makefile,v 1.9 1999/07/14 21:36:38 wrstuden Exp $
+#      $NetBSD: Makefile,v 1.10 2002/09/15 01:27:47 thorpej Exp $
 
 HOSTPROG=      mkdstoas
+HOST_CPPFLAGS+=        -DHOST_TOOL
 SRCS=  mkdstoas.c asc_ebc.c ebc_disp.c
 
 .include <bsd.hostprog.mk>
diff -r 8d1e77ed92aa -r 5a0ebf494a41 usr.bin/tn3270/tools/mkdstoas/mkdstoas.c
--- a/usr.bin/tn3270/tools/mkdstoas/mkdstoas.c  Sun Sep 15 01:18:59 2002 +0000
+++ b/usr.bin/tn3270/tools/mkdstoas/mkdstoas.c  Sun Sep 15 01:27:44 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mkdstoas.c,v 1.7 2002/06/13 23:41:22 wiz Exp $ */
+/*     $NetBSD: mkdstoas.c,v 1.8 2002/09/15 01:27:47 thorpej Exp $     */
 
 /*-
  * Copyright (c) 1988 The Regents of the University of California.
@@ -33,7 +33,10 @@
  * SUCH DAMAGE.
  */
 
-#include <sys/cdefs.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
 #if defined(__COPYRIGHT) && !defined(lint)
 __COPYRIGHT(
 "@(#) Copyright (c) 1988 The Regents of the University of California.\n\
@@ -44,17 +47,13 @@
 #if 0
 static char sccsid[] = "@(#)mkdstoas.c 4.2 (Berkeley) 4/26/91";
 #else
-__RCSID("$NetBSD: mkdstoas.c,v 1.7 2002/06/13 23:41:22 wiz Exp $");
+__RCSID("$NetBSD: mkdstoas.c,v 1.8 2002/09/15 01:27:47 thorpej Exp $");
 #endif
 #endif /* not lint */
 
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
 #include "../api/asc_ebc.h"
 #include "../api/ebc_disp.h"
 
-
 int main(int, char *[]);
 
 int
diff -r 8d1e77ed92aa -r 5a0ebf494a41 usr.bin/tn3270/tools/mkhits/Makefile
--- a/usr.bin/tn3270/tools/mkhits/Makefile      Sun Sep 15 01:18:59 2002 +0000
+++ b/usr.bin/tn3270/tools/mkhits/Makefile      Sun Sep 15 01:27:44 2002 +0000
@@ -1,6 +1,7 @@
-#      $NetBSD: Makefile,v 1.9 1999/07/14 21:36:38 wrstuden Exp $
+#      $NetBSD: Makefile,v 1.10 2002/09/15 01:27:47 thorpej Exp $
 
 HOSTPROG=      mkhits
+HOST_CPPFLAGS+=        -DHOST_TOOL
 SRCS=  mkhits.c dohits.c asc_ebc.c ebc_disp.c
 
 .include <bsd.hostprog.mk>
diff -r 8d1e77ed92aa -r 5a0ebf494a41 usr.bin/tn3270/tools/mkhits/dohits.c
--- a/usr.bin/tn3270/tools/mkhits/dohits.c      Sun Sep 15 01:18:59 2002 +0000
+++ b/usr.bin/tn3270/tools/mkhits/dohits.c      Sun Sep 15 01:27:44 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dohits.c,v 1.11 2002/06/13 23:41:22 wiz Exp $  */
+/*     $NetBSD: dohits.c,v 1.12 2002/09/15 01:27:48 thorpej 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.11 2002/06/13 23:41:22 wiz Exp $");
+__RCSID("$NetBSD: dohits.c,v 1.12 2002/09/15 01:27:48 thorpej Exp $");
 #endif
 #endif /* not lint */
 
@@ -60,12 +65,6 @@
  * all fields are separated by a single space.
  */
 
-#include <ctype.h>
-#include <err.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
 #include "../general/general.h"
 #include "../api/asc_ebc.h"
 #include "../api/ebc_disp.h"
@@ -130,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);
@@ -139,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));



Home | Main Index | Thread Index | Old Index