head 1.2; access; symbols pkgsrc-2026Q1:1.2.0.108 pkgsrc-2026Q1-base:1.2 pkgsrc-2025Q4:1.2.0.106 pkgsrc-2025Q4-base:1.2 pkgsrc-2025Q3:1.2.0.104 pkgsrc-2025Q3-base:1.2 pkgsrc-2025Q2:1.2.0.102 pkgsrc-2025Q2-base:1.2 pkgsrc-2025Q1:1.2.0.100 pkgsrc-2025Q1-base:1.2 pkgsrc-2024Q4:1.2.0.98 pkgsrc-2024Q4-base:1.2 pkgsrc-2024Q3:1.2.0.96 pkgsrc-2024Q3-base:1.2 pkgsrc-2024Q2:1.2.0.94 pkgsrc-2024Q2-base:1.2 pkgsrc-2024Q1:1.2.0.92 pkgsrc-2024Q1-base:1.2 pkgsrc-2023Q4:1.2.0.90 pkgsrc-2023Q4-base:1.2 pkgsrc-2023Q3:1.2.0.88 pkgsrc-2023Q3-base:1.2 pkgsrc-2023Q2:1.2.0.86 pkgsrc-2023Q2-base:1.2 pkgsrc-2023Q1:1.2.0.84 pkgsrc-2023Q1-base:1.2 pkgsrc-2022Q4:1.2.0.82 pkgsrc-2022Q4-base:1.2 pkgsrc-2022Q3:1.2.0.80 pkgsrc-2022Q3-base:1.2 pkgsrc-2022Q2:1.2.0.78 pkgsrc-2022Q2-base:1.2 pkgsrc-2022Q1:1.2.0.76 pkgsrc-2022Q1-base:1.2 pkgsrc-2021Q4:1.2.0.74 pkgsrc-2021Q4-base:1.2 pkgsrc-2021Q3:1.2.0.72 pkgsrc-2021Q3-base:1.2 pkgsrc-2021Q2:1.2.0.70 pkgsrc-2021Q2-base:1.2 pkgsrc-2021Q1:1.2.0.68 pkgsrc-2021Q1-base:1.2 pkgsrc-2020Q4:1.2.0.66 pkgsrc-2020Q4-base:1.2 pkgsrc-2020Q3:1.2.0.64 pkgsrc-2020Q3-base:1.2 pkgsrc-2020Q2:1.2.0.60 pkgsrc-2020Q2-base:1.2 pkgsrc-2020Q1:1.2.0.40 pkgsrc-2020Q1-base:1.2 pkgsrc-2019Q4:1.2.0.62 pkgsrc-2019Q4-base:1.2 pkgsrc-2019Q3:1.2.0.58 pkgsrc-2019Q3-base:1.2 pkgsrc-2019Q2:1.2.0.56 pkgsrc-2019Q2-base:1.2 pkgsrc-2019Q1:1.2.0.54 pkgsrc-2019Q1-base:1.2 pkgsrc-2018Q4:1.2.0.52 pkgsrc-2018Q4-base:1.2 pkgsrc-2018Q3:1.2.0.50 pkgsrc-2018Q3-base:1.2 pkgsrc-2018Q2:1.2.0.48 pkgsrc-2018Q2-base:1.2 pkgsrc-2018Q1:1.2.0.46 pkgsrc-2018Q1-base:1.2 pkgsrc-2017Q4:1.2.0.44 pkgsrc-2017Q4-base:1.2 pkgsrc-2017Q3:1.2.0.42 pkgsrc-2017Q3-base:1.2 pkgsrc-2017Q2:1.2.0.38 pkgsrc-2017Q2-base:1.2 pkgsrc-2017Q1:1.2.0.36 pkgsrc-2017Q1-base:1.2 pkgsrc-2016Q4:1.2.0.34 pkgsrc-2016Q4-base:1.2 pkgsrc-2016Q3:1.2.0.32 pkgsrc-2016Q3-base:1.2 pkgsrc-2016Q2:1.2.0.30 pkgsrc-2016Q2-base:1.2 pkgsrc-2016Q1:1.2.0.28 pkgsrc-2016Q1-base:1.2 pkgsrc-2015Q4:1.2.0.26 pkgsrc-2015Q4-base:1.2 pkgsrc-2015Q3:1.2.0.24 pkgsrc-2015Q3-base:1.2 pkgsrc-2015Q2:1.2.0.22 pkgsrc-2015Q2-base:1.2 pkgsrc-2015Q1:1.2.0.20 pkgsrc-2015Q1-base:1.2 pkgsrc-2014Q4:1.2.0.18 pkgsrc-2014Q4-base:1.2 pkgsrc-2014Q3:1.2.0.16 pkgsrc-2014Q3-base:1.2 pkgsrc-2014Q2:1.2.0.14 pkgsrc-2014Q2-base:1.2 pkgsrc-2014Q1:1.2.0.12 pkgsrc-2014Q1-base:1.2 pkgsrc-2013Q4:1.2.0.10 pkgsrc-2013Q4-base:1.2 pkgsrc-2013Q3:1.2.0.8 pkgsrc-2013Q3-base:1.2 pkgsrc-2013Q2:1.2.0.6 pkgsrc-2013Q2-base:1.2 pkgsrc-2013Q1:1.2.0.4 pkgsrc-2013Q1-base:1.2 pkgsrc-2012Q4:1.2.0.2 pkgsrc-2012Q4-base:1.2 pkgsrc-2012Q3:1.1.0.58 pkgsrc-2012Q3-base:1.1 pkgsrc-2012Q2:1.1.0.56 pkgsrc-2012Q2-base:1.1 pkgsrc-2012Q1:1.1.0.54 pkgsrc-2012Q1-base:1.1 pkgsrc-2011Q4:1.1.0.52 pkgsrc-2011Q4-base:1.1 pkgsrc-2011Q3:1.1.0.50 pkgsrc-2011Q3-base:1.1 pkgsrc-2011Q2:1.1.0.48 pkgsrc-2011Q2-base:1.1 pkgsrc-2011Q1:1.1.0.46 pkgsrc-2011Q1-base:1.1 pkgsrc-2010Q4:1.1.0.44 pkgsrc-2010Q4-base:1.1 pkgsrc-2010Q3:1.1.0.42 pkgsrc-2010Q3-base:1.1 pkgsrc-2010Q2:1.1.0.40 pkgsrc-2010Q2-base:1.1 pkgsrc-2010Q1:1.1.0.38 pkgsrc-2010Q1-base:1.1 pkgsrc-2009Q4:1.1.0.36 pkgsrc-2009Q4-base:1.1 pkgsrc-2009Q3:1.1.0.34 pkgsrc-2009Q3-base:1.1 pkgsrc-2009Q2:1.1.0.32 pkgsrc-2009Q2-base:1.1 pkgsrc-2009Q1:1.1.0.30 pkgsrc-2009Q1-base:1.1 pkgsrc-2008Q4:1.1.0.28 pkgsrc-2008Q4-base:1.1 pkgsrc-2008Q3:1.1.0.26 pkgsrc-2008Q3-base:1.1 cube-native-xorg:1.1.0.24 cube-native-xorg-base:1.1 pkgsrc-2008Q2:1.1.0.22 pkgsrc-2008Q2-base:1.1 cwrapper:1.1.0.20 pkgsrc-2008Q1:1.1.0.18 pkgsrc-2008Q1-base:1.1 pkgsrc-2007Q4:1.1.0.16 pkgsrc-2007Q4-base:1.1 pkgsrc-2007Q3:1.1.0.14 pkgsrc-2007Q3-base:1.1 pkgsrc-2007Q2:1.1.0.12 pkgsrc-2007Q2-base:1.1 pkgsrc-2007Q1:1.1.0.10 pkgsrc-2007Q1-base:1.1 pkgsrc-2006Q4:1.1.0.8 pkgsrc-2006Q4-base:1.1 pkgsrc-2006Q3:1.1.0.6 pkgsrc-2006Q3-base:1.1 pkgsrc-2006Q2:1.1.0.4 pkgsrc-2006Q2-base:1.1 pkgsrc-2006Q1:1.1.0.2 pkgsrc-2006Q1-base:1.1; locks; strict; comment @# @; 1.2 date 2012.12.27.06.13.20; author dholland; state Exp; branches; next 1.1; 1.1 date 2006.01.05.19.27.50; author joerg; state Exp; branches; next ; desc @@ 1.2 log @Clean up legacy C. Now passes gcc -Wall -Wextra -Wmissing-declarations -Wwrite-strings on gcc45. May build with clang now too. Changes: - use standard headers - don't declare own errno, fopen(), getenv(), or malloc() - declare own functions - declare void functions void - avoid implicit int - use C89 - use some const - use some static - fix signed/unsigned mismatches - call execl() properly - don't cast return value of malloc - initialize struct sigaction correctly - use functions correctly - don't index arrays with (signed) char - don't put function declarations inside function bodies - patch up two uninitialized variables - silence some compiler warnings that are not bugs - remove some unused objects and: - add patch comments for preexisting patches - correct some minor pkglint As a couple of these things fixed bugs (e.g. the execl calls), bump PKGREVISION. @ text @$NetBSD: patch-ae,v 1.1 2006/01/05 19:27:50 joerg Exp $ - use standard headers - use some static - initialize struct sigaction correctly - declare own functions - don't declare own errno - restore missing close-comments - declare void functions void - use some c89 - don't index arrays with (signed) char --- te_chario.c.orig 1993-08-05 22:29:33.000000000 +0000 +++ te_chario.c @@@@ -28,6 +28,8 @@@@ #endif #include +#include +#include #if defined(USE_SELECT) && defined(_AIX) #include @@@@ -41,10 +43,10 @@@@ #include #ifndef DEBUG #include -extern SHRET int_handler(); -extern SHRET stp_handler(); -extern SHRET hup_handler(); -extern SHRET winch_handler(); +static SHRET int_handler(); +static SHRET stp_handler(); +static SHRET hup_handler(); +static SHRET winch_handler(); #define SIGINTMASK 2 #endif @@@@ -72,11 +74,11 @@@@ int bsdld; /* this is really for linux */ #define SA_INTERRUPT 0 #endif -struct sigaction intsigstruc = { int_handler, 0, SA_INTERRUPT } ; /* info structure for ^C interrupt */ -struct sigaction stpsigstruc = { stp_handler, 0, SA_INTERRUPT } ; /* info structure for "stop" signal */ -struct sigaction hupsigstruc = { hup_handler, 0, SA_INTERRUPT } ; /* info structure for "hangup" signal */ -struct sigaction nosigstr = { SIG_DFL, 0, 0 }; /* default structure for signal */ -struct sigaction sigwinchstruc = { winch_handler, 0, SA_INTERRUPT} ; +struct sigaction intsigstruc; /* info structure for ^C interrupt */ +struct sigaction stpsigstruc; /* info structure for "stop" signal */ +struct sigaction hupsigstruc; /* info structure for "hangup" signal */ +struct sigaction nosigstr; /* default structure for signal */ +struct sigaction sigwinchstruc; #else struct sigvec intsigstruc = { int_handler, 0, 0 } ; /* info structure for ^C interrupt */ struct sigvec stpsigstruc = { stp_handler, 0, 0 } ; /* info structure for "stop" signal */ @@@@ -96,12 +98,13 @@@@ int out_noterm; /* nonzero if standar char ldbuf[TTNAMEMAX]; #endif +static void qio_char(char c); + #ifndef POSIX_TECO setup_tty(arg) int arg; { - extern int errno; int ioerr; struct sgttyb tmpbuf; @@@@ -177,16 +180,15 @@@@ setup_tty(arg) } } } -#else /* POSIX_TECO +#else /* POSIX_TECO */ /* * set tty (stdin) mode. TECO mode is CBREAK, no ECHO, sep CR & LF * operation; normal mode is none of the above. TTY_OFF and TTY_ON do this * absolutely; TTY_SUSP and TTY_RESUME use saved signal status. */ -setup_tty(arg) +VOID setup_tty(arg) int arg; { - extern int errno; int ioerr; struct termios tmpbuf; @@@@ -227,6 +229,22 @@@@ int arg; tcdrain(fileno(stdin)); tcdrain(fileno(stdin)); tcsetattr(fileno(stdin), TCSANOW, &tty_new); #ifndef DEBUG + intsigstruc.sa_sigaction = int_handler; + sigemptyset(&intsigstruc.sa_mask); + intsigstruc.sa_flags = SA_INTERRUPT; + + stpsigstruc.sa_handler = stp_handler; + sigemptyset(&stpsigstruc.sa_mask); + stpsigstruc.sa_flags = SA_INTERRUPT; + + hupsigstruc.sa_handler = hup_handler; + sigemptyset(&hupsigstruc.sa_mask); + hupsigstruc.sa_flags = SA_INTERRUPT; + + sigwinchstruc.sa_handler = winch_handler; + sigemptyset(&sigwinchstruc.sa_mask); + sigwinchstruc.sa_flags = SA_INTERRUPT; + /* Handle signals */ if (sigaction(SIGTSTP, &stpsigstruc, NULL) < 0) { fprintf(stderr, "could not install signal handler for SIGTSTP\n"); @@@@ -249,6 +267,10 @@@@ int arg; /* Restore to original state */ tcdrain(fileno(stdin)); tcsetattr(fileno(stdin), TCSANOW, &tty_orig); #ifndef DEBUG + nosigstr.sa_handler = SIG_DFL; + sigemptyset(&nosigstr.sa_mask); + nosigstr.sa_flags = 0; + sigaction(SIGTSTP, &nosigstr, 0); sigaction(SIGINT, &nosigstr, 0); sigaction(SIGHUP, &nosigstr, 0); @@@@ -263,10 +285,10 @@@@ int arg; /* if lf_sw is nonzero, return the LF; else use the FNDELAY fcntl to inquire of the input */ /* if input is not a terminal don't switch modes */ -unsigned short get_kbd_enh(); +static unsigned short get_kbd_enh(void); #ifndef POSIX_TECO -int gettty_nowait() +int gettty_nowait(void) { int c; @@@@ -289,7 +311,7 @@@@ int gettty_nowait() * set if lf_sw is nonzero, return the LF; else use the FNDELAY fcntl to * inquire of the input */ -gettty_nowait() +int gettty_nowait(void) { char c; int err, cnt; @@@@ -424,7 +446,7 @@@@ static unsigned char ca[3] = {0,0,0}; #define c2 ca[1] #define c3 ca[2] -int zread(fd,c) +static int zread(fd,c) int fd; char *c; { @@@@ -435,7 +457,7 @@@@ char *c; } #if defined(USE_SELECT) -int timed_read(fd,c) +static int timed_read(fd,c) int fd; char *c; { @@@@ -459,7 +481,7 @@@@ char *c; #endif #if defined(USE_POLL) -int timed_read(fd,c) +static int timed_read(fd,c) int fd; char *c; { @@@@ -479,7 +501,7 @@@@ char *c; #endif #if defined(USE_POSIX_C_CC) -int timed_read(fd,c) +static int timed_read(fd,c) int fd; char *c; { @@@@ -503,7 +525,7 @@@@ char *c; } #endif -unsigned short get_kbd_enh() +static unsigned short get_kbd_enh() { unsigned short retval; struct trans_entry *pt; @@@@ -555,7 +577,7 @@@@ unsigned short get_kbd_enh() #ifndef DEBUG -SHRET winch_handler() +static SHRET winch_handler() { get_term_par(); window(WIN_INIT); @@@@ -566,7 +588,7 @@@@ SHRET winch_handler() } } -SHRET int_handler() +static SHRET int_handler() { if (exitflag <= 0) /* if executing commands */ @@@@ -594,7 +616,7 @@@@ SHRET int_handler() /* routine to disable (1), enable (0) ^C interrupt, used to block interrupts during display update */ #ifdef POSIX_TECO -block_inter(func) +VOID block_inter(func) int func; { sigset_t ss; @@@@ -608,7 +630,7 @@@@ int func; #else int old_mask; /* storage for previous signal mask */ #define INT_MASK 2 -block_inter(func) +VOID block_inter(func) int func; { #ifndef DEBUG @@@@ -624,7 +646,7 @@@@ block_inter(func) /* routine to handle "stop" signal (^Y) */ #ifdef POSIX_TECO -SHRET stp_handler() +static SHRET stp_handler() { sigset_t ss; sigemptyset(&ss); @@@@ -652,7 +674,7 @@@@ SHRET stp_handler() #else /* BSD style signals */ -SHRET stp_handler() +static SHRET stp_handler() { crlf(); window(WIN_SUSP); /* restore screen */ @@@@ -682,7 +704,7 @@@@ SHRET stp_handler() /* simulate a character's having been typed on the keyboard */ -qio_char(c) +static void qio_char(c) char c; { #ifdef POSIX_TECO @@@@ -694,7 +716,7 @@@@ qio_char(c) /* routine to handle "hangup" signal */ #ifndef DEBUG -SHRET hup_handler() +static SHRET hup_handler() { if (!exitflag) exitflag = -3; /* if executing, set flag to terminate */ else @@@@ -709,7 +731,7 @@@@ SHRET hup_handler() /* type a crlf */ -crlf() +void crlf(void) { type_char(CR); type_char(LF); @@@@ -721,7 +743,7 @@@@ crlf() int lflusho = LFLUSHO; int lfo; -reset_ctlo() +void reset_ctlo(void) { ioctl(fileno(stdin), TIOCLGET, &lfo); /* read flags */ if (lfo & LFLUSHO) /* if ^O was set */ @@@@ -731,18 +753,18 @@@@ reset_ctlo() } } #else -reset_ctlo() +void reset_ctlo(void) { } #endif /* routine to type one character */ -type_char(c) +VOID type_char(c) char c; { - if ((char_count >= WN_width) && (c != CR) && !(spec_chars[c] & A_L)) /* spacing char beyond end of line */ + if ((char_count >= WN_width) && (c != CR) && !(spec_chars[(unsigned char)c] & A_L)) /* spacing char beyond end of line */ { if (et_val & ET_TRUNC) return; /* truncate output to line width */ else crlf(); /* otherwise do automatic new line (note recursive call to type_char) */ @@@@ -759,7 +781,7 @@@@ type_char(c) case LF: putchar(c); -/* scroll_dly(); /* filler chars in case VT-100 scrolls */ +/* scroll_dly(); */ /* filler chars in case VT-100 scrolls */ break; case ESC: @ 1.1 log @Fix errno. @ text @d1 1 a1 1 $NetBSD$ d3 11 a13 1 --- te_chario.c.orig 2006-01-04 21:01:15.000000000 +0000 d15 49 a63 1 @@@@ -101,7 +101,6 @@@@ char ldbuf[TTNAMEMAX]; d71 13 a83 2 @@@@ -186,7 +185,6 @@@@ setup_tty(arg) setup_tty(arg) d90 222 @