Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/tset pass data to a function via arguments instead o...



details:   https://anonhg.NetBSD.org/src/rev/e3e27eed1aaa
branches:  trunk
changeset: 569715:e3e27eed1aaa
user:      chs <chs%NetBSD.org@localhost>
date:      Wed Sep 01 01:46:28 2004 +0000

description:
pass data to a function via arguments instead of via global variables.
this avoids a name collision with libcurses functions when both are
present in a crunched static binary.  part of PR 26458.

diffstat:

 usr.bin/tset/extern.h |   5 ++---
 usr.bin/tset/set.c    |   9 ++++-----
 usr.bin/tset/tset.c   |  10 ++++------
 3 files changed, 10 insertions(+), 14 deletions(-)

diffs (109 lines):

diff -r bd3c714bcb01 -r e3e27eed1aaa usr.bin/tset/extern.h
--- a/usr.bin/tset/extern.h     Tue Aug 31 22:57:13 2004 +0000
+++ b/usr.bin/tset/extern.h     Wed Sep 01 01:46:28 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: extern.h,v 1.9 2003/08/07 11:16:48 agc Exp $   */
+/*     $NetBSD: extern.h,v 1.10 2004/09/01 01:46:28 chs Exp $  */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,6 @@
 
 extern struct termios mode, oldmode;
 extern int columns, isreset, lines;
-extern int erasechar, intrchar, killchar;
 
 void    add_mapping __P((const char *, char *));
 void    cat __P((char *));
@@ -45,7 +44,7 @@
 const   char *mapped __P((const char *));
 int     outc __P((int));
 void    reset_mode __P((void));
-void    set_control_chars __P((void));
+void    set_control_chars __P((int, int, int));
 void    set_conversions __P((int));
 void    set_init __P((void));
 void    wrtermcap __P((char *));
diff -r bd3c714bcb01 -r e3e27eed1aaa usr.bin/tset/set.c
--- a/usr.bin/tset/set.c        Tue Aug 31 22:57:13 2004 +0000
+++ b/usr.bin/tset/set.c        Wed Sep 01 01:46:28 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: set.c,v 1.9 2003/08/07 11:16:49 agc Exp $      */
+/*     $NetBSD: set.c,v 1.10 2004/09/01 01:46:28 chs Exp $     */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)set.c      8.2 (Berkeley) 2/28/94";
 #endif
-__RCSID("$NetBSD: set.c,v 1.9 2003/08/07 11:16:49 agc Exp $");
+__RCSID("$NetBSD: set.c,v 1.10 2004/09/01 01:46:28 chs Exp $");
 #endif /* not lint */
 
 #include <stdio.h>
@@ -153,7 +153,7 @@
  * entry and command line and update their values in 'mode'.
  */
 void
-set_control_chars()
+set_control_chars(int erasechar, int intrchar, int killchar)
 {
        char *bp, *p, bs_char, buf[1024];
 
@@ -192,8 +192,7 @@
  * uppercase to internal lowercase.
  */
 void
-set_conversions(usingupper)
-       int usingupper;
+set_conversions(int usingupper)
 {
        if (tgetflag("UC") || usingupper) {
 #ifdef IUCLC
diff -r bd3c714bcb01 -r e3e27eed1aaa usr.bin/tset/tset.c
--- a/usr.bin/tset/tset.c       Tue Aug 31 22:57:13 2004 +0000
+++ b/usr.bin/tset/tset.c       Wed Sep 01 01:46:28 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tset.c,v 1.14 2004/07/23 13:35:22 wiz Exp $    */
+/*     $NetBSD: tset.c,v 1.15 2004/09/01 01:46:28 chs Exp $    */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)tset.c     8.1 (Berkeley) 6/9/93";
 #endif
-__RCSID("$NetBSD: tset.c,v 1.14 2004/07/23 13:35:22 wiz Exp $");
+__RCSID("$NetBSD: tset.c,v 1.15 2004/09/01 01:46:28 chs Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -62,10 +62,7 @@
 
 struct termios mode, oldmode;
 
-int    erasechar;              /* new erase character */
-int    intrchar;               /* new interrupt character */
 int    isreset;                /* invoked as reset */
-int    killchar;               /* new kill character */
 int    lines, columns;         /* window size */
 
 int
@@ -77,6 +74,7 @@
        struct winsize win;
 #endif
        int ch, extended, noinit, noset, quiet, Sflag, sflag, showterm;
+       int erasechar = 0, intrchar = 0, killchar = 0;
        int usingupper;
        char savech, *p, *q, *t, *tcapbuf;
        const char *ttype;
@@ -181,7 +179,7 @@
                        (void)ioctl(STDERR_FILENO, TIOCSWINSZ, &win);
                }
 #endif
-               set_control_chars();
+               set_control_chars(erasechar, intrchar, killchar);
                set_conversions(usingupper);
 
                if (!noinit)



Home | Main Index | Thread Index | Old Index