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$ - declare local functions static - declare void functions void - silence warnings about braces - fix up function pointer casting mess - avoid implicit int - silence warnings about && and || precedence - use const for string constants - silence warnings about unused arguments - silence signed/unsigned compiler warning --- ex_vops.c~ 2012-12-27 21:58:42.000000000 +0000 +++ ex_vops.c @@@@ -89,8 +89,9 @@@@ static char sccsid[] = "@@(#)ex_vops.c 1. * display representations. */ -int xdw __P((void)); -int setpk __P((void)); +static int xdw __P((void)); +static void vshift(int ignore); +static void setpk __P((void)); /* * Undo. @@@@ -111,6 +112,7 @@@@ int setpk __P((void)); char *vUA1, *vUA2; char *vUD1, *vUD2; +void vUndo() { @@@@ -137,6 +139,7 @@@@ vUndo() vfixcurs(); } +void vundo(show) bool show; /* if true update the screen */ { @@@@ -173,12 +176,13 @@@@ bool show; /* if true update the screen * with dol through unddol-1. Hack screen image to * reflect this replacement. */ - if (show) + if (show) { if (undkind == UNDMOVE) vdirty(0, TLINES); else vreplace(undap1 - addr, undap2 - undap1, undkind == UNDPUT ? 0 : unddol - dol); + } savenote = notecnt; undo(1); if (show && (vundkind != VMCHNG || addr != dot)) @@@@ -250,6 +254,7 @@@@ bool show; /* if true update the screen * opposed to an ex command). This has nothing to do with being * in open/visual mode as :s/foo/bar is not fromvis. */ +void vmacchng(fromvis) bool fromvis; { @@@@ -259,7 +264,6 @@@@ bool fromvis; int nlines, more; /* register line *a1, *a2; */ /* char ch; */ /* DEBUG */ - int copyw(), copywR(); if (!inopen) return; @@@@ -338,6 +342,7 @@@@ bool fromvis; /* * Initialize undo information before an append. */ +void vnoapp() { @@@@ -357,6 +362,7 @@@@ vnoapp() /* * Move is simple, except for moving onto new lines in hardcopy open mode. */ +void vmove() { register int cnt; @@@@ -423,6 +429,17 @@@@ vmove() } /* + * This is the same as vmove, but throws away its argument, so + * it can be used in combination with other function pointers. + */ +void +vmove_i(int ignore) +{ + (void)ignore; + vmove(); +} + +/* * Delete operator. * * Hard case of deleting a range where both wcursor and wdot @@@@ -430,7 +447,8 @@@@ vmove() * by vchange (although vchange may pass it back if it degenerates * to a full line range delete.) */ -vdelete(c) +void +vdelete(int c) { register char *cp; register int i; @@@@ -489,7 +507,8 @@@@ vdelete(c) * Across lines with both wcursor and wdot given, we delete * and sync then append (but one operation for undo). */ -vchange(c) +void +vchange(int c) { register char *cp; register int i, ind, cnt; @@@@ -705,6 +724,7 @@@@ smallchange: * Actually counts are obsoleted, since if your terminal is slow * you are better off with slowopen. */ +void voOpen(c, cnt) int c; /* mjm: char --> int */ register int cnt; @@@@ -719,7 +739,7 @@@@ voOpen(c, cnt) #endif #endif - if (value(SLOWOPEN) || value(REDRAW) && AL && DL) + if (value(SLOWOPEN) || (value(REDRAW) && AL && DL)) cnt = 1; #ifdef SIGWINCH #ifndef POSIX_1 @@@@ -794,6 +814,7 @@@@ voOpen(c, cnt) */ char vshnam[2] = { 'x', 0 }; +void vshftop() { register line *addr; @@@@ -817,11 +838,12 @@@@ vshftop() * * Filter portions of the buffer through unix commands. */ +void vfilter() { register line *addr; register int cnt; - char *oglobp; + const char *oglobp; short d; #ifdef BIT8 cell cuxb[UXBSIZE + 2]; @@@@ -885,6 +907,7 @@@@ vfilter() * that wdot is reasonable. Its name comes from * xchange dotand wdot */ +static int xdw() { register char *cp; @@@@ -956,9 +979,10 @@@@ xdw() /* * Routine for vremote to call to implement shifts. */ -vshift() +static void +vshift(int ignore) { - + (void)ignore; shift(op, 1); } @@@@ -966,12 +990,13 @@@@ vshift() * Replace a single character with the next input character. * A funny kind of insert. */ +void vrep(cnt) register int cnt; { register int i, c; - if (cnt > strlen(cursor)) { + if (cnt > (int)strlen(cursor)) { beep(); return; } @@@@ -1000,12 +1025,20 @@@@ vrep(cnt) setLAST(); } +static void +doyank(int ignore) +{ + (void)ignore; + yank(); +} + /* * Yank. * * Yanking to string registers occurs for free (essentially) * in the routine xdw(). */ +void vyankit() { register int cnt; @@@@ -1013,7 +1046,7 @@@@ vyankit() if (wdot) { if ((cnt = xdw()) < 0) return; - vremote(cnt, yank, 0); + vremote(cnt, doyank, 0); setpk(); notenam = "yank"; if (FIXUNDO) @@@@ -1036,6 +1069,7 @@@@ vyankit() * the first and last lines. The compromise * is for put to be more clever. */ +static void setpk() { @