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.08; 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$ - declare local functions static - avoid implicit int - declare void functions void - silence warnings about assignments in conditionals - use const for string constants --- ex_cmdsub.c.orig 2012-12-27 21:58:41.000000000 +0000 +++ ex_cmdsub.c @@@@ -93,15 +93,18 @@@@ static char sccsid[] = "@@(#)ex_cmdsub.c bool endline = 1; line *tad1; -static jnoop(); + +static int jnoop(void); +static int getcopy(void); /* * Append after line a lines returned by function f. * Be careful about intermediate states to avoid scramble * if an interrupt comes in. */ +int append(f, a) - int (*f)(); + int (*f)(void); line *a; { register line *a1, *a2, *rdot; @@@@ -144,6 +147,7 @@@@ append(f, a) return (nline); } +void appendnone() { @@@@ -156,6 +160,7 @@@@ appendnone() /* * Print out the argument list, with []'s around the current name. */ +void pargs() { register char **av = argv0, *as = args0; @@@@ -182,6 +187,7 @@@@ pargs() * Delete lines; two cases are if we are really deleting, * more commonly we are just moving lines to the undo save area. */ +void delete(hush) bool hush; { @@@@ -242,6 +248,7 @@@@ delete(hush) killed(); } +void deletenone() { @@@@ -256,6 +263,7 @@@@ deletenone() * Crush out the undo save area, moving the open/visual * save area down in its place. */ +void squish() { register line *a1 = dol + 1, *a2 = unddol + 1, *a3 = truedol + 1; @@@@ -276,8 +284,9 @@@@ squish() * Join lines. Special hacks put in spaces, two spaces if * preceding line ends with '.', or no spaces if next line starts with ). */ -static int jcount, jnoop(); +static int jcount; +void join(c) int c; { @@@@ -300,7 +309,7 @@@@ join(c) } } } - while (*cp++ = *cp1++) + while ((*cp++ = *cp1++) != 0) if (cp > &genbuf[LBSIZE-2]) error(catgets(catd, 1, 40, "Line overflow|Result line of join would be too long")); @@@@ -316,8 +325,8 @@@@ join(c) vundkind = VMANY; } -static -jnoop() +static int +jnoop(void) { return(--jcount); @@@@ -327,11 +336,9 @@@@ jnoop() * Move and copy lines. Hard work is done by move1 which * is also called by undo. */ -int getcopy(); -move1(cflag, addrt) - int cflag; - line *addrt; +static void +move1(int cflag, line *addrt) { register line *adt, *ad1, *ad2; int lines; @@@@ -384,6 +391,7 @@@@ move1(cflag, addrt) } } +void move() { register line *adt; @@@@ -406,7 +414,8 @@@@ move() killed(); } -getcopy() +static int +getcopy(void) { if (tad1 > addr2) @@@@ -418,7 +427,8 @@@@ getcopy() /* * Put lines in the buffer from the undo save area. */ -getput() +static int +getput(void) { if (tad1 > unddol) @@@@ -428,6 +438,7 @@@@ getput() return (0); } +void put() { register int cnt; @@@@ -452,6 +463,7 @@@@ put() * Argument says pkills have meaning, e.g. called from * put; it is 0 on calls from putreg. */ +void pragged(kill) bool kill; { @@@@ -489,6 +501,7 @@@@ pragged(kill) * Shift lines, based on c. * If c is neither < nor >, then this is a lisp aligning =. */ +void shift(c, cnt) int c; int cnt; @@@@ -546,6 +559,7 @@@@ shift(c, cnt) * Find a tag in the tags file. * Most work here is in parsing the tags file itself. */ +void tagfind(quick) bool quick; { @@@@ -634,7 +648,7 @@@@ badtag: /* loop for each tags file entry */ register char *cp = linebuf; register char *lp = lasttag; - char *oglobp; + const char *oglobp; #ifdef FASTTAG mid = (top + bot) / 2; @@@@ -777,6 +791,7 @@@@ badtags: * Save lines from addr1 thru addr2 as though * they had been deleted. */ +void yank() { @@@@ -801,6 +816,7 @@@@ bool zhadpr; bool znoclear; short zweight; +void zop(hadpr) int hadpr; { @@@@ -862,8 +878,8 @@@@ zop(hadpr) zop2(lines, op); } -static -splitit() +static void +splitit(void) { register int l; @@@@ -872,6 +888,7 @@@@ splitit() putnl(); } +void zop2(lines, op) register int lines; register int op; @@@@ -956,6 +973,7 @@@@ zop2(lines, op) plines(addr1, addr2, 0); } +void plines(adr1, adr2, movedot) line *adr1; register line *adr2; @@@@ -981,6 +999,7 @@@@ plines(adr1, adr2, movedot) } } +void pofix() { @@@@ -994,6 +1013,7 @@@@ pofix() * Be (almost completely) sure there really * was a change, before claiming to undo. */ +static void somechange() { register line *ip, *jp; @@@@ -1045,6 +1065,7 @@@@ somechange() * * Undo is its own inverse. */ +void undo(c) bool c; { @@@@ -1191,6 +1212,7 @@@@ undo(c) * Map command: * map src dest */ +void mapcmd(un, ab) int un; /* true if this is unmap command */ int ab; /* true if this is abbr command */ @@@@ -1287,8 +1309,10 @@@@ mapcmd(un, ab) * using NOSTR for dest. Dname is what to show in listings. mp is * the structure to affect (arrows, etc). */ +void addmac(src,dest,dname,mp) - register char *src, *dest, *dname; + register char *src; + register const char *dest, *dname; register struct maps *mp; { register int slot, zer; @@@@ -1314,7 +1338,7 @@@@ addmac(src,dest,dname,mp) * linefeed, and escape, he can screw himself. This is * so weird I don't bother to check for it. */ - if (isalpha(cuc(src[0])) && src[1] || any(src[0],":")) + if ((isalpha(cuc(src[0])) && src[1]) || any(src[0],":")) error(catgets(catd, 1, 64, "Too dangerous to map that")); } @@@@ -1385,12 +1409,13 @@@@ addmac(src,dest,dname,mp) * Implements macros from command mode. c is the buffer to * get the macro from. */ +void cmdmac(c) char c; { char macbuf[BUFSIZ]; line *ad, *a1, *a2; - char *oglobp; + const char *oglobp; short pk; bool oinglobal; @