wok diff sc/stuff/7.16.patch @ rev 9622
Add roundup. We should have roundup in wok for next stable.
author | Christopher Rogers <slaxemulator@gmail.com> |
---|---|
date | Fri Apr 22 17:33:42 2011 +0000 (2011-04-22) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/sc/stuff/7.16.patch Fri Apr 22 17:33:42 2011 +0000 1.3 @@ -0,0 +1,497 @@ 1.4 +--- sc-7.16.orig/sc.h 1.5 ++++ sc-7.16/sc.h 1.6 +@@ -612,6 +612,9 @@ 1.7 + extern int rowlimit; 1.8 + extern int collimit; 1.9 + 1.10 ++void yankr(struct ent *v1, struct ent *v2); 1.11 ++ 1.12 ++ 1.13 + #if BSD42 || SYSIII 1.14 + 1.15 + #ifndef cbreak 1.16 +--- sc-7.16.orig/cmds.c 1.17 ++++ sc-7.16/cmds.c 1.18 +@@ -478,7 +478,7 @@ 1.19 + int i, qtmp; 1.20 + char buf[50]; 1.21 + struct frange *fr; 1.22 +- struct ent *obuf; 1.23 ++ struct ent *obuf=0; 1.24 + 1.25 + if ((fr = find_frange(currow, curcol))) 1.26 + rs = fr->or_right->row - currow + 1; 1.27 +@@ -535,7 +535,7 @@ 1.28 + int cs = maxcol - curcol + 1; 1.29 + int i, qtmp; 1.30 + char buf[50]; 1.31 +- struct ent *obuf; 1.32 ++ struct ent *obuf=0; 1.33 + 1.34 + if (cs - arg < 0) { 1.35 + cs = cs > 0 ? cs : 0; 1.36 +@@ -810,7 +810,7 @@ 1.37 + 1.38 + if (to_insert == 'r') { 1.39 + insertrow(numrows, 0); 1.40 +- if (fr = find_frange(currow, curcol)) 1.41 ++ if ((fr = find_frange(currow, curcol))) 1.42 + deltac = fr->or_left->col - mincol; 1.43 + else { 1.44 + for (i = 0; i < numrows; i++) 1.45 +@@ -2279,7 +2279,7 @@ 1.46 + ret->e.r.right.vp = lookat(newrow, newcol); 1.47 + ret->e.r.right.vf = e->e.r.right.vf; 1.48 + } else { 1.49 +- struct enode *temprange; 1.50 ++ struct enode *temprange=0; 1.51 + 1.52 + if (freeenodes) { 1.53 + ret = freeenodes; 1.54 +@@ -2337,8 +2337,7 @@ 1.55 + break; 1.56 + case 'f': 1.57 + case 'F': 1.58 +- if (range && ret->op == 'F' || 1.59 +- !range && ret->op == 'f') 1.60 ++ if ((range && ret->op == 'F') || (!range && ret->op == 'f')) 1.61 + Rdelta = Cdelta = 0; 1.62 + ret->e.o.left = copye(e->e.o.left, Rdelta, Cdelta, 1.63 + r1, c1, r2, c2, transpose); 1.64 +@@ -2798,7 +2797,7 @@ 1.65 + write_cells(register FILE *f, int r0, int c0, int rn, int cn, int dr, int dc) 1.66 + { 1.67 + register struct ent **pp; 1.68 +- int r, c, rs, cs, mf; 1.69 ++ int r, c, rs=0, cs=0, mf; 1.70 + char *dpointptr; 1.71 + 1.72 + mf = modflg; 1.73 +@@ -2861,12 +2860,12 @@ 1.74 + if ((plugin = findplugin(p+1, 'w')) != NULL) { 1.75 + if (!plugin_exists(plugin, strlen(plugin), save + 1)) { 1.76 + error("plugin not found"); 1.77 +- return; 1.78 ++ return -1; 1.79 + } 1.80 + *save = '|'; 1.81 + if ((strlen(save) + strlen(fname) + 20) > PATHLEN) { 1.82 + error("Path too long"); 1.83 +- return; 1.84 ++ return -1; 1.85 + } 1.86 + sprintf(save + strlen(save), " %s%d:", coltoa(c0), r0); 1.87 + sprintf(save + strlen(save), "%s%d \"%s\"", coltoa(cn), rn, fname); 1.88 +@@ -2883,13 +2882,14 @@ 1.89 + } 1.90 + #endif /* VMS */ 1.91 + 1.92 +- if (*fname == '\0') 1.93 ++ if (*fname == '\0'){ 1.94 + if (isatty(STDOUT_FILENO) || *curfile != '\0') 1.95 + fname = curfile; 1.96 + else { 1.97 + write_fd(stdout, r0, c0, rn, cn); 1.98 + return (0); 1.99 + } 1.100 ++ } 1.101 + 1.102 + #ifdef MSDOS 1.103 + namelen = 12; 1.104 +@@ -2981,12 +2981,12 @@ 1.105 + if ((plugin = findplugin(p+1, 'r')) != NULL) { 1.106 + if (!(plugin_exists(plugin, strlen(plugin), save + 1))) { 1.107 + error("plugin not found"); 1.108 +- return; 1.109 ++ return -1; 1.110 + } 1.111 + *save = '|'; 1.112 + if ((strlen(save) + strlen(fname) + 2) > PATHLEN) { 1.113 + error("Path too long"); 1.114 +- return; 1.115 ++ return -1; 1.116 + } 1.117 + sprintf(save + strlen(save), " \"%s\"", fname); 1.118 + eraseflg = 0; 1.119 +--- sc-7.16.orig/abbrev.c 1.120 ++++ sc-7.16/abbrev.c 1.121 +@@ -19,10 +19,15 @@ 1.122 + #include <stdio.h> 1.123 + #include <stdlib.h> 1.124 + #include <ctype.h> 1.125 ++#include <curses.h> 1.126 ++#include <unistd.h> 1.127 + #include "sc.h" 1.128 + 1.129 + static struct abbrev *abbr_base; 1.130 + 1.131 ++int are_abbrevs(void); 1.132 ++ 1.133 ++ 1.134 + void 1.135 + add_abbr(char *string) 1.136 + { 1.137 +@@ -87,7 +92,7 @@ 1.138 + } 1.139 + } 1.140 + 1.141 +- if (expansion == NULL) 1.142 ++ if (expansion == NULL){ 1.143 + if ((a = find_abbr(string, strlen(string), &prev))) { 1.144 + error("abbrev \"%s %s\"", a->abbr, a->exp); 1.145 + return; 1.146 +@@ -95,6 +100,7 @@ 1.147 + error("abreviation \"%s\" doesn't exist", string); 1.148 + return; 1.149 + } 1.150 ++ } 1.151 + 1.152 + if (find_abbr(string, strlen(string), &prev)) 1.153 + del_abbr(string); 1.154 +@@ -122,7 +128,7 @@ 1.155 + del_abbr(char *abbrev) 1.156 + { 1.157 + struct abbrev *a; 1.158 +- struct abbrev **prev; 1.159 ++ struct abbrev **prev=0; 1.160 + 1.161 + if (!(a = find_abbr(abbrev, strlen(abbrev), prev))) 1.162 + return; 1.163 +--- sc-7.16.orig/range.c 1.164 ++++ sc-7.16/range.c 1.165 +@@ -18,6 +18,8 @@ 1.166 + 1.167 + #include <stdio.h> 1.168 + #include <ctype.h> 1.169 ++#include <unistd.h> 1.170 ++#include <curses.h> 1.171 + #include "sc.h" 1.172 + 1.173 + static struct range *rng_base; 1.174 +--- sc-7.16.orig/vi.c 1.175 ++++ sc-7.16/vi.c 1.176 +@@ -17,6 +17,8 @@ 1.177 + #include <curses.h> 1.178 + #include <ctype.h> 1.179 + #include <stdlib.h> 1.180 ++#include <unistd.h> 1.181 ++#include <sys/wait.h> 1.182 + #include "sc.h" 1.183 + 1.184 + #if defined(REGCOMP) 1.185 +@@ -40,7 +42,7 @@ 1.186 + 1.187 + #define istext(a) (isalnum(a) || ((a) == '_')) 1.188 + 1.189 +-#define bool int 1.190 ++/*#define bool int*/ 1.191 + #define true 1 1.192 + #define false 0 1.193 + 1.194 +@@ -667,8 +669,10 @@ 1.195 + static struct range *nextmatch; 1.196 + int len; 1.197 + 1.198 +- if (linelim > 0 && isalnum(line[linelim-1]) || line[linelim-1] == '_' || 1.199 +- (completethis && line[linelim-1] == ' ')) { 1.200 ++ if ((linelim > 0 && isalnum(line[linelim-1])) || 1.201 ++ line[linelim-1] == '_' || 1.202 ++ (completethis && line[linelim-1] == ' ')) { 1.203 ++ 1.204 + if (!completethis) { 1.205 + for (completethis = line + linelim - 1; isalnum(*completethis) || 1.206 + *completethis == '_'; completethis--) /* */; 1.207 +@@ -715,7 +719,7 @@ 1.208 + showdr() 1.209 + { 1.210 + int minsr, minsc, maxsr, maxsc; 1.211 +- char *p; 1.212 ++ /*char *p;*/ 1.213 + char r[12]; 1.214 + struct frange *fr = find_frange(currow, curcol); 1.215 + 1.216 +@@ -1566,7 +1570,7 @@ 1.217 + search_again(bool reverse) 1.218 + { 1.219 + int prev_match; 1.220 +- int found_it; 1.221 ++ int found_it=0; 1.222 + #if !defined(REGCOMP) && !defined(RE_COMP) && !defined(REGCMP) 1.223 + char *look_here; 1.224 + int do_next; 1.225 +@@ -1777,7 +1781,7 @@ 1.226 + static void 1.227 + match_paren() 1.228 + { 1.229 +- register int i; 1.230 ++ /*register int i;*/ 1.231 + int nest = 1; 1.232 + int tmp = linelim; 1.233 + 1.234 +--- sc-7.16.orig/vmtbl.c 1.235 ++++ sc-7.16/vmtbl.c 1.236 +@@ -16,6 +16,7 @@ 1.237 + # include <curses.h> 1.238 + #endif /* PSC */ 1.239 + 1.240 ++#include <unistd.h> 1.241 + #include "sc.h" 1.242 + 1.243 + /* 1.244 +--- sc-7.16.orig/Makefile 1.245 ++++ sc-7.16/Makefile 1.246 +@@ -32,7 +32,7 @@ 1.247 + 1.248 + # This is where the library file (tutorial) goes. 1.249 + #LIBDIR=/usr/local/share/$(name) # reno 1.250 +-LIBDIR=${prefix}/lib/$(name) 1.251 ++LIBDIR=${prefix}/share/doc/$(name) 1.252 + LIBRARY=-DLIBDIR=\"${LIBDIR}\" 1.253 + 1.254 + # Set SIMPLE for lex.c if you don't want arrow keys or lex.c blows up 1.255 +--- sc-7.16.orig/color.c 1.256 ++++ sc-7.16/color.c 1.257 +@@ -19,6 +19,7 @@ 1.258 + 1.259 + #include <curses.h> 1.260 + #include <ctype.h> 1.261 ++#include <unistd.h> 1.262 + #include "sc.h" 1.263 + 1.264 + /* a linked list of free [struct ent]'s, uses .next as the pointer */ 1.265 +--- sc-7.16.orig/frame.c 1.266 ++++ sc-7.16/frame.c 1.267 +@@ -18,6 +18,9 @@ 1.268 + 1.269 + #include <stdio.h> 1.270 + #include <ctype.h> 1.271 ++#include <stdlib.h> 1.272 ++#include <curses.h> 1.273 ++#include <unistd.h> 1.274 + #include "sc.h" 1.275 + 1.276 + static struct frange *frame_base; 1.277 +--- sc-7.16.orig/sc.c 1.278 ++++ sc-7.16/sc.c 1.279 +@@ -212,7 +212,7 @@ 1.280 + 1.281 + if (dbidx < 0) 1.282 + return; 1.283 +- if (p = delbuf[dbidx]) { 1.284 ++ if ((p = delbuf[dbidx])) { 1.285 + scxfree(delbuffmt[dbidx]); 1.286 + delbuffmt[dbidx] = NULL; 1.287 + } 1.288 +@@ -845,7 +845,7 @@ 1.289 + break; 1.290 + case 'C': 1.291 + color = !color; 1.292 +- if (has_colors()) 1.293 ++ if (has_colors()){ 1.294 + if (color) { 1.295 + attron(COLOR_PAIR(1)); 1.296 + bkgd(COLOR_PAIR(1) | ' '); 1.297 +@@ -853,6 +853,7 @@ 1.298 + attron(COLOR_PAIR(0)); 1.299 + bkgd(COLOR_PAIR(0) | ' '); 1.300 + } 1.301 ++ } 1.302 + error("Color %sabled.", color ? "en" : "dis"); 1.303 + break; 1.304 + case 'N': 1.305 +--- sc-7.16.orig/sort.c 1.306 ++++ sc-7.16/sort.c 1.307 +@@ -19,6 +19,8 @@ 1.308 + #include <stdio.h> 1.309 + #include <ctype.h> 1.310 + #include <stdlib.h> 1.311 ++#include <unistd.h> 1.312 ++#include <curses.h> 1.313 + #include "sc.h" 1.314 + 1.315 + int compare(const void *row1, const void *row2); 1.316 +--- sc-7.16.orig/xmalloc.c 1.317 ++++ sc-7.16/xmalloc.c 1.318 +@@ -4,11 +4,12 @@ 1.319 + */ 1.320 + 1.321 + #include <curses.h> 1.322 ++#include <stdlib.h> 1.323 + #include "sc.h" 1.324 + 1.325 +-extern char *malloc(); 1.326 ++/* extern char *malloc(); 1.327 + extern char *realloc(); 1.328 +-extern void free(); 1.329 ++extern void free(); */ 1.330 + void fatal(); 1.331 + 1.332 + #ifdef SYSV3 1.333 +--- sc-7.16.orig/screen.c 1.334 ++++ sc-7.16/screen.c 1.335 +@@ -234,11 +234,12 @@ 1.336 + i = stcol; 1.337 + lcols = 0; 1.338 + col = rescol + frcols; 1.339 +- if (fr && stcol >= fr->or_left->col) 1.340 ++ if (fr && stcol >= fr->or_left->col){ 1.341 + if (stcol < fr->ir_left->col) 1.342 + i = fr->or_left->col; 1.343 + else 1.344 + col += flcols; 1.345 ++ } 1.346 + for (; (col + fwidth[i] < cols-1 || col_hidden[i] || i < curcol) && 1.347 + i < maxcols; i++) { 1.348 + lcols++; 1.349 +@@ -328,11 +329,12 @@ 1.350 + i = stcol; 1.351 + lcols = 0; 1.352 + col = rescol + frcols; 1.353 +- if (fr && stcol >= fr->or_left->col) 1.354 ++ if (fr && stcol >= fr->or_left->col){ 1.355 + if (stcol < fr->ir_left->col) 1.356 + i = fr->or_left->col; 1.357 + else 1.358 + col += flcols; 1.359 ++ } 1.360 + for (; (col + fwidth[i] < cols-1 || col_hidden[i] || i < curcol) && 1.361 + i < maxcols; i++) { 1.362 + lcols++; 1.363 +@@ -377,11 +379,12 @@ 1.364 + i = strow; 1.365 + rows = 0; 1.366 + row = RESROW + fbrows; 1.367 +- if (fr && strow >= fr->or_left->row) 1.368 ++ if (fr && strow >= fr->or_left->row){ 1.369 + if (strow < fr->ir_left->row) 1.370 + i = fr->or_left->row; 1.371 + else 1.372 + row += ftrows; 1.373 ++ } 1.374 + for (; (row < lines || row_hidden[i] || i < currow) && i < maxrows; 1.375 + i++) { 1.376 + rows++; 1.377 +@@ -460,11 +463,12 @@ 1.378 + i = strow; 1.379 + rows = 0; 1.380 + row = RESROW + fbrows; 1.381 +- if (fr && strow >= fr->or_left->row) 1.382 ++ if (fr && strow >= fr->or_left->row){ 1.383 + if (strow < fr->ir_left->row) 1.384 + i = fr->or_left->row; 1.385 + else 1.386 + row += ftrows; 1.387 ++ } 1.388 + for (; (row < lines || row_hidden[i] || i < currow) && i < maxrows; 1.389 + i++) { 1.390 + rows++; 1.391 +--- sc-7.16.orig/lex.c 1.392 ++++ sc-7.16/lex.c 1.393 +@@ -34,6 +34,8 @@ 1.394 + #include <signal.h> 1.395 + #include <setjmp.h> 1.396 + #include <ctype.h> 1.397 ++#include <unistd.h> 1.398 ++#include <math.h> 1.399 + #include "sc.h" 1.400 + 1.401 + #ifdef NONOTIMEOUT 1.402 +@@ -107,7 +109,7 @@ 1.403 + yylex() 1.404 + { 1.405 + char *p = line + linelim; 1.406 +- int ret; 1.407 ++ int ret=0; 1.408 + static int isfunc = 0; 1.409 + static bool isgoto = 0; 1.410 + static bool colstate = 0; 1.411 +@@ -326,7 +328,7 @@ 1.412 + strcpy((char *)path, HomeDir); 1.413 + strcat((char *)path, "/.sc/plugins/"); 1.414 + strncat((char *)path, name, len); 1.415 +- if (fp = fopen((char *)path, "r")) { 1.416 ++ if ((fp = fopen((char *)path, "r"))) { 1.417 + fclose(fp); 1.418 + return 1; 1.419 + } 1.420 +@@ -334,7 +336,7 @@ 1.421 + strcpy((char *)path, LIBDIR); 1.422 + strcat((char *)path, "/plugins/"); 1.423 + strncat((char *)path, name, len); 1.424 +- if (fp = fopen((char *)path, "r")) { 1.425 ++ if ((fp = fopen((char *)path, "r"))) { 1.426 + fclose(fp); 1.427 + return 1; 1.428 + } 1.429 +--- sc-7.16.orig/interp.c 1.430 ++++ sc-7.16/interp.c 1.431 +@@ -1572,12 +1572,12 @@ 1.432 + copy(struct ent *dv1, struct ent *dv2, struct ent *v1, struct ent *v2) 1.433 + { 1.434 + struct ent *p; 1.435 +- struct ent *n; 1.436 ++/* struct ent *n;*/ 1.437 + static int minsr = -1, minsc = -1; 1.438 + static int maxsr = -1, maxsc = -1; 1.439 + int mindr, mindc; 1.440 + int maxdr, maxdc; 1.441 +- int vr, vc; 1.442 ++/* int vr, vc;*/ 1.443 + int r, c; 1.444 + int deltar, deltac; 1.445 + 1.446 +@@ -2066,7 +2066,7 @@ 1.447 + *line = '\0'; 1.448 + } 1.449 + } 1.450 +- if (!col_hidden[c]) 1.451 ++ if (!col_hidden[c]){ 1.452 + if (gs.g_type == G_STR) { 1.453 + if (p && p->label 1.454 + #if defined(REGCOMP) 1.455 +@@ -2099,6 +2099,7 @@ 1.456 + #endif 1.457 + #endif 1.458 + break; 1.459 ++ } 1.460 + if (r == endr && c == endc) { 1.461 + error("String not found"); 1.462 + #if defined(REGCOMP) 1.463 +@@ -2471,13 +2472,11 @@ 1.464 + int 1.465 + constant(register struct enode *e) 1.466 + { 1.467 +- return ( 1.468 +- e == NULL 1.469 ++ return e == NULL 1.470 + || e->op == O_CONST 1.471 + || e->op == O_SCONST 1.472 +- || e->op == 'm' && constant(e->e.o.left) 1.473 +- || ( 1.474 +- e->op != O_VAR 1.475 ++ || (e->op == 'm' && constant(e->e.o.left)) 1.476 ++ || (e->op != O_VAR 1.477 + && !(e->op & REDUCE) 1.478 + && constant(e->e.o.left) 1.479 + && constant(e->e.o.right) 1.480 +@@ -2491,9 +2490,7 @@ 1.481 + && e->op != LASTCOL 1.482 + && e->op != NUMITER 1.483 + && e->op != FILENAME 1.484 +- && optimize 1.485 +- ) 1.486 +- ); 1.487 ++ && optimize ); 1.488 + } 1.489 + 1.490 + void 1.491 +--- sc-7.16.orig/help.c 1.492 ++++ sc-7.16/help.c 1.493 +@@ -11,6 +11,7 @@ 1.494 + char *revision = "$Revision: 7.16 $"; 1.495 + #else 1.496 + #include <curses.h> 1.497 ++#include <unistd.h> 1.498 + #include "sc.h" 1.499 + #endif /* QREF */ 1.500 +