head 1.1; access; symbols pkgsrc-2026Q1:1.1.0.108 pkgsrc-2026Q1-base:1.1 pkgsrc-2025Q4:1.1.0.106 pkgsrc-2025Q4-base:1.1 pkgsrc-2025Q3:1.1.0.104 pkgsrc-2025Q3-base:1.1 pkgsrc-2025Q2:1.1.0.102 pkgsrc-2025Q2-base:1.1 pkgsrc-2025Q1:1.1.0.100 pkgsrc-2025Q1-base:1.1 pkgsrc-2024Q4:1.1.0.98 pkgsrc-2024Q4-base:1.1 pkgsrc-2024Q3:1.1.0.96 pkgsrc-2024Q3-base:1.1 pkgsrc-2024Q2:1.1.0.94 pkgsrc-2024Q2-base:1.1 pkgsrc-2024Q1:1.1.0.92 pkgsrc-2024Q1-base:1.1 pkgsrc-2023Q4:1.1.0.90 pkgsrc-2023Q4-base:1.1 pkgsrc-2023Q3:1.1.0.88 pkgsrc-2023Q3-base:1.1 pkgsrc-2023Q2:1.1.0.86 pkgsrc-2023Q2-base:1.1 pkgsrc-2023Q1:1.1.0.84 pkgsrc-2023Q1-base:1.1 pkgsrc-2022Q4:1.1.0.82 pkgsrc-2022Q4-base:1.1 pkgsrc-2022Q3:1.1.0.80 pkgsrc-2022Q3-base:1.1 pkgsrc-2022Q2:1.1.0.78 pkgsrc-2022Q2-base:1.1 pkgsrc-2022Q1:1.1.0.76 pkgsrc-2022Q1-base:1.1 pkgsrc-2021Q4:1.1.0.74 pkgsrc-2021Q4-base:1.1 pkgsrc-2021Q3:1.1.0.72 pkgsrc-2021Q3-base:1.1 pkgsrc-2021Q2:1.1.0.70 pkgsrc-2021Q2-base:1.1 pkgsrc-2021Q1:1.1.0.68 pkgsrc-2021Q1-base:1.1 pkgsrc-2020Q4:1.1.0.66 pkgsrc-2020Q4-base:1.1 pkgsrc-2020Q3:1.1.0.64 pkgsrc-2020Q3-base:1.1 pkgsrc-2020Q2:1.1.0.60 pkgsrc-2020Q2-base:1.1 pkgsrc-2020Q1:1.1.0.40 pkgsrc-2020Q1-base:1.1 pkgsrc-2019Q4:1.1.0.62 pkgsrc-2019Q4-base:1.1 pkgsrc-2019Q3:1.1.0.58 pkgsrc-2019Q3-base:1.1 pkgsrc-2019Q2:1.1.0.56 pkgsrc-2019Q2-base:1.1 pkgsrc-2019Q1:1.1.0.54 pkgsrc-2019Q1-base:1.1 pkgsrc-2018Q4:1.1.0.52 pkgsrc-2018Q4-base:1.1 pkgsrc-2018Q3:1.1.0.50 pkgsrc-2018Q3-base:1.1 pkgsrc-2018Q2:1.1.0.48 pkgsrc-2018Q2-base:1.1 pkgsrc-2018Q1:1.1.0.46 pkgsrc-2018Q1-base:1.1 pkgsrc-2017Q4:1.1.0.44 pkgsrc-2017Q4-base:1.1 pkgsrc-2017Q3:1.1.0.42 pkgsrc-2017Q3-base:1.1 pkgsrc-2017Q2:1.1.0.38 pkgsrc-2017Q2-base:1.1 pkgsrc-2017Q1:1.1.0.36 pkgsrc-2017Q1-base:1.1 pkgsrc-2016Q4:1.1.0.34 pkgsrc-2016Q4-base:1.1 pkgsrc-2016Q3:1.1.0.32 pkgsrc-2016Q3-base:1.1 pkgsrc-2016Q2:1.1.0.30 pkgsrc-2016Q2-base:1.1 pkgsrc-2016Q1:1.1.0.28 pkgsrc-2016Q1-base:1.1 pkgsrc-2015Q4:1.1.0.26 pkgsrc-2015Q4-base:1.1 pkgsrc-2015Q3:1.1.0.24 pkgsrc-2015Q3-base:1.1 pkgsrc-2015Q2:1.1.0.22 pkgsrc-2015Q2-base:1.1 pkgsrc-2015Q1:1.1.0.20 pkgsrc-2015Q1-base:1.1 pkgsrc-2014Q4:1.1.0.18 pkgsrc-2014Q4-base:1.1 pkgsrc-2014Q3:1.1.0.16 pkgsrc-2014Q3-base:1.1 pkgsrc-2014Q2:1.1.0.14 pkgsrc-2014Q2-base:1.1 pkgsrc-2014Q1:1.1.0.12 pkgsrc-2014Q1-base:1.1 pkgsrc-2013Q4:1.1.0.10 pkgsrc-2013Q4-base:1.1 pkgsrc-2013Q3:1.1.0.8 pkgsrc-2013Q3-base:1.1 pkgsrc-2013Q2:1.1.0.6 pkgsrc-2013Q2-base:1.1 pkgsrc-2013Q1:1.1.0.4 pkgsrc-2013Q1-base:1.1 pkgsrc-2012Q4:1.1.0.2 pkgsrc-2012Q4-base:1.1; locks; strict; comment @# @; 1.1 date 2012.12.28.03.03.09; author dholland; state Exp; branches; next ; desc @@ 1.1 log @Fix legacy C. Pass -Wall -W -Wmissing-declarations -Wwrite-strings on gcc45. - avoid implicit int, declare void functions void - return values from non-void functions - put most external declarations properly in header files - use some static and const - fix up a big mess with function pointer casting - use standard includes, don't provide own decls of standard functions - use types matching libc when providing own malloc, printf, and putchar - use functions correctly - silence assorted compiler warnings - fix some bugs exposed by compiler warnings - don't intentionally exercise signed overflow - remove some unused items - add patch comments to other patch (patch-aa) As this includes several fixes and removes some undefined behavior on a commonly reachable code path, bump PKGREVISION. @ text @$NetBSD$ - use standard headers - declare local functions (and data) static - declare void functions void - don't put function declarations inside other functions - return values from non-void functions --- ex_tty.c~ 2003-03-18 20:29:07.000000000 +0000 +++ ex_tty.c @@@@ -79,14 +79,16 @@@@ static char sccsid[] = "@@(#)ex_tty.c 1.1 /* from ex_tty.c 7.10.1 (2.11BSD GTE) 12/9/94 */ +#include + #include "ex.h" #include "ex_tty.h" int ATTN = DELETE; -int gettmode __P((void)); -char *gettlongname __P((char *, char *)); -int zap __P((void)); +static const char *gettlongname __P((char *, const char *)); +static void zap __P((void)); +static int countnum(int ch); /* * Terminal type initialization routines, @@@@ -95,6 +97,7 @@@@ int zap __P((void)); */ /* short ospeed = -1; mjm: def also in tputs.c of termcap.a */ +void gettmode() { #ifdef POSIX_1 @@@@ -171,7 +174,7 @@@@ gettmode() } char *xPC; -char **sstrs[] = { +static char **sstrs[] = { &AL, &BC, &BT, &CD, &CE, &CL, &CM, &xCR, &xCS, &DC, &DL, &DM, &DO, &ED, &EI, &F0, &F1, &F2, &F3, &F4, &F5, &F6, &F7, &F8, &F9, &HO, &IC, &IM, &IP, &KD, &KE, &KH, &KL, &KR, &KS, &KU, &LL, &ND, &xNL, @@@@ -189,13 +192,17 @@@@ bool *sflags[] = { char **fkeys[10] = { &F0, &F1, &F2, &F3, &F4, &F5, &F6, &F7, &F8, &F9 }; + +void setterm(type) - char *type; + const char *type; { - char *tgoto(); register int unknown; char ltcbuf[TCBUFSIZE]; + /* to avoid needing to make all the terminal strings const */ + static char empty[] = ""; + if (type[0] == 0) type = "xx"; unknown = 0; @@@@ -221,13 +228,13 @@@@ setterm(type) * Handle funny termcap capabilities */ if (xCS && SC && RC) { - if (AL==NULL) AL=""; - if (DL==NULL) DL=""; + if (AL==NULL) AL=empty; + if (DL==NULL) DL=empty; } - if (AL_PARM && AL==NULL) AL=""; - if (DL_PARM && DL==NULL) DL=""; - if (IC && IM==NULL) IM=""; - if (IC && EI==NULL) EI=""; + if (AL_PARM && AL==NULL) AL=empty; + if (DL_PARM && DL==NULL) DL=empty; + if (IC && IM==NULL) IM=empty; + if (IC && EI==NULL) EI=empty; if (!GT) BT=NULL; /* If we can't tab, we can't backtab either */ #ifndef USG3TTY @@@@ -313,6 +320,7 @@@@ setterm(type) "%s: Unknown terminal type"), type); } +void setsize() { register int l, i; @@@@ -369,9 +377,10 @@@@ setsize() TLINES = 2; } -zap() +static void +zap(void) { - register char *namp; + register const char *namp; register bool **fp; register char ***sp; int flag; @@@@ -397,10 +406,10 @@@@ zap() } while (*namp); } -char * +static const char * gettlongname(bp, def) register char *bp; - char *def; + const char *def; { register char *cp; @@@@ -438,11 +447,11 @@@@ fkey(i) * than AL vs SR, won't be really affected.) */ static int costnum; + +int cost(str) -char *str; +const char *str; { - int countnum(); - if (str == NULL || *str=='O') /* OOPS */ return 10000; /* infinity */ costnum = 0; @@@@ -451,8 +460,10 @@@@ char *str; } /* ARGSUSED */ +static int countnum(ch) char ch; { costnum++; + return ch; } @