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.
This commit is contained in:
chs 2004-09-01 01:46:28 +00:00
parent af4511cccc
commit dc8f6bbd12
3 changed files with 10 additions and 14 deletions

View File

@ -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 short ospeed;
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 *get_termcap_entry __P((const char *, char **, int));
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 *));

View File

@ -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 @@ reset_mode()
* 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 @@ set_control_chars()
* uppercase to internal lowercase.
*/
void
set_conversions(usingupper)
int usingupper;
set_conversions(int usingupper)
{
if (tgetflag("UC") || usingupper) {
#ifdef IUCLC

View File

@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1991, 1993\n\
#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 @@ void usage __P((void));
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 @@ main(argc, argv)
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 @@ main(argc, argv)
(void)ioctl(STDERR_FILENO, TIOCSWINSZ, &win);
}
#endif
set_control_chars();
set_control_chars(erasechar, intrchar, killchar);
set_conversions(usingupper);
if (!noinit)