Source-Changes-HG archive

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

[src/trunk]: src/bin/sh host program portability: set infp to stdin at runtim...



details:   https://anonhg.NetBSD.org/src/rev/fa7fb5025a91
branches:  trunk
changeset: 495381:fa7fb5025a91
user:      cgd <cgd%NetBSD.org@localhost>
date:      Thu Jul 27 04:06:49 2000 +0000

description:
host program portability: set infp to stdin at runtime, since apparently
some systems (e.g. linux) define stdin in such a way that it can't
be used to initialize values at compile time.

diffstat:

 bin/sh/mknodes.c |  13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diffs (41 lines):

diff -r 96d700d8d638 -r fa7fb5025a91 bin/sh/mknodes.c
--- a/bin/sh/mknodes.c  Thu Jul 27 03:57:50 2000 +0000
+++ b/bin/sh/mknodes.c  Thu Jul 27 04:06:49 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mknodes.c,v 1.17 2000/07/18 19:13:20 cgd Exp $ */
+/*     $NetBSD: mknodes.c,v 1.18 2000/07/27 04:06:49 cgd Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -47,7 +47,7 @@
 static char sccsid[] = "@(#)mknodes.c  8.2 (Berkeley) 5/4/95";
 #else
 static const char rcsid[] =
-    "$NetBSD: mknodes.c,v 1.17 2000/07/18 19:13:20 cgd Exp $";
+    "$NetBSD: mknodes.c,v 1.18 2000/07/27 04:06:49 cgd Exp $";
 #endif
 #endif /* not lint */
 
@@ -100,7 +100,7 @@
 static int nstr;                       /* number of structures */
 static struct str str[MAXTYPES];       /* the structures */
 static struct str *curstr;             /* current structure */
-static FILE *infp = stdin;
+static FILE *infp;
 static char line[1024];
 static int linno;
 static char *linep;
@@ -124,6 +124,13 @@
        int argc;
        char **argv;
 {
+
+       /*
+        * some versions of linux complain: initializer element is not
+        * constant if this is done at compile time.
+        */
+       infp = stdin;
+
        if (argc != 3)
                error("usage: mknodes file");
        if ((infp = fopen(argv[1], "r")) == NULL)



Home | Main Index | Thread Index | Old Index