wok annotate sc/stuff/7.16.patch @ rev 19594

Up: zlib (1.2.9)
author Alexander Medvedev <devl547@gmail.com>
date Sun Jan 01 17:10:55 2017 +0000 (2017-01-01)
parents
children
rev   line source
paul@4539 1 --- sc-7.16.orig/sc.h
paul@4539 2 +++ sc-7.16/sc.h
paul@4539 3 @@ -612,6 +612,9 @@
paul@4539 4 extern int rowlimit;
paul@4539 5 extern int collimit;
paul@4539 6
paul@4539 7 +void yankr(struct ent *v1, struct ent *v2);
paul@4539 8 +
paul@4539 9 +
paul@4539 10 #if BSD42 || SYSIII
paul@4539 11
paul@4539 12 #ifndef cbreak
paul@4539 13 --- sc-7.16.orig/cmds.c
paul@4539 14 +++ sc-7.16/cmds.c
paul@4539 15 @@ -478,7 +478,7 @@
paul@4539 16 int i, qtmp;
paul@4539 17 char buf[50];
paul@4539 18 struct frange *fr;
paul@4539 19 - struct ent *obuf;
paul@4539 20 + struct ent *obuf=0;
paul@4539 21
paul@4539 22 if ((fr = find_frange(currow, curcol)))
paul@4539 23 rs = fr->or_right->row - currow + 1;
paul@4539 24 @@ -535,7 +535,7 @@
paul@4539 25 int cs = maxcol - curcol + 1;
paul@4539 26 int i, qtmp;
paul@4539 27 char buf[50];
paul@4539 28 - struct ent *obuf;
paul@4539 29 + struct ent *obuf=0;
paul@4539 30
paul@4539 31 if (cs - arg < 0) {
paul@4539 32 cs = cs > 0 ? cs : 0;
paul@4539 33 @@ -810,7 +810,7 @@
paul@4539 34
paul@4539 35 if (to_insert == 'r') {
paul@4539 36 insertrow(numrows, 0);
paul@4539 37 - if (fr = find_frange(currow, curcol))
paul@4539 38 + if ((fr = find_frange(currow, curcol)))
paul@4539 39 deltac = fr->or_left->col - mincol;
paul@4539 40 else {
paul@4539 41 for (i = 0; i < numrows; i++)
paul@4539 42 @@ -2279,7 +2279,7 @@
paul@4539 43 ret->e.r.right.vp = lookat(newrow, newcol);
paul@4539 44 ret->e.r.right.vf = e->e.r.right.vf;
paul@4539 45 } else {
paul@4539 46 - struct enode *temprange;
paul@4539 47 + struct enode *temprange=0;
paul@4539 48
paul@4539 49 if (freeenodes) {
paul@4539 50 ret = freeenodes;
paul@4539 51 @@ -2337,8 +2337,7 @@
paul@4539 52 break;
paul@4539 53 case 'f':
paul@4539 54 case 'F':
paul@4539 55 - if (range && ret->op == 'F' ||
paul@4539 56 - !range && ret->op == 'f')
paul@4539 57 + if ((range && ret->op == 'F') || (!range && ret->op == 'f'))
paul@4539 58 Rdelta = Cdelta = 0;
paul@4539 59 ret->e.o.left = copye(e->e.o.left, Rdelta, Cdelta,
paul@4539 60 r1, c1, r2, c2, transpose);
paul@4539 61 @@ -2798,7 +2797,7 @@
paul@4539 62 write_cells(register FILE *f, int r0, int c0, int rn, int cn, int dr, int dc)
paul@4539 63 {
paul@4539 64 register struct ent **pp;
paul@4539 65 - int r, c, rs, cs, mf;
paul@4539 66 + int r, c, rs=0, cs=0, mf;
paul@4539 67 char *dpointptr;
paul@4539 68
paul@4539 69 mf = modflg;
paul@4539 70 @@ -2861,12 +2860,12 @@
paul@4539 71 if ((plugin = findplugin(p+1, 'w')) != NULL) {
paul@4539 72 if (!plugin_exists(plugin, strlen(plugin), save + 1)) {
paul@4539 73 error("plugin not found");
paul@4539 74 - return;
paul@4539 75 + return -1;
paul@4539 76 }
paul@4539 77 *save = '|';
paul@4539 78 if ((strlen(save) + strlen(fname) + 20) > PATHLEN) {
paul@4539 79 error("Path too long");
paul@4539 80 - return;
paul@4539 81 + return -1;
paul@4539 82 }
paul@4539 83 sprintf(save + strlen(save), " %s%d:", coltoa(c0), r0);
paul@4539 84 sprintf(save + strlen(save), "%s%d \"%s\"", coltoa(cn), rn, fname);
paul@4539 85 @@ -2883,13 +2882,14 @@
paul@4539 86 }
paul@4539 87 #endif /* VMS */
paul@4539 88
paul@4539 89 - if (*fname == '\0')
paul@4539 90 + if (*fname == '\0'){
paul@4539 91 if (isatty(STDOUT_FILENO) || *curfile != '\0')
paul@4539 92 fname = curfile;
paul@4539 93 else {
paul@4539 94 write_fd(stdout, r0, c0, rn, cn);
paul@4539 95 return (0);
paul@4539 96 }
paul@4539 97 + }
paul@4539 98
paul@4539 99 #ifdef MSDOS
paul@4539 100 namelen = 12;
paul@4539 101 @@ -2981,12 +2981,12 @@
paul@4539 102 if ((plugin = findplugin(p+1, 'r')) != NULL) {
paul@4539 103 if (!(plugin_exists(plugin, strlen(plugin), save + 1))) {
paul@4539 104 error("plugin not found");
paul@4539 105 - return;
paul@4539 106 + return -1;
paul@4539 107 }
paul@4539 108 *save = '|';
paul@4539 109 if ((strlen(save) + strlen(fname) + 2) > PATHLEN) {
paul@4539 110 error("Path too long");
paul@4539 111 - return;
paul@4539 112 + return -1;
paul@4539 113 }
paul@4539 114 sprintf(save + strlen(save), " \"%s\"", fname);
paul@4539 115 eraseflg = 0;
paul@4539 116 --- sc-7.16.orig/abbrev.c
paul@4539 117 +++ sc-7.16/abbrev.c
paul@4539 118 @@ -19,10 +19,15 @@
paul@4539 119 #include <stdio.h>
paul@4539 120 #include <stdlib.h>
paul@4539 121 #include <ctype.h>
paul@4539 122 +#include <curses.h>
paul@4539 123 +#include <unistd.h>
paul@4539 124 #include "sc.h"
paul@4539 125
paul@4539 126 static struct abbrev *abbr_base;
paul@4539 127
paul@4539 128 +int are_abbrevs(void);
paul@4539 129 +
paul@4539 130 +
paul@4539 131 void
paul@4539 132 add_abbr(char *string)
paul@4539 133 {
paul@4539 134 @@ -87,7 +92,7 @@
paul@4539 135 }
paul@4539 136 }
paul@4539 137
paul@4539 138 - if (expansion == NULL)
paul@4539 139 + if (expansion == NULL){
paul@4539 140 if ((a = find_abbr(string, strlen(string), &prev))) {
paul@4539 141 error("abbrev \"%s %s\"", a->abbr, a->exp);
paul@4539 142 return;
paul@4539 143 @@ -95,6 +100,7 @@
paul@4539 144 error("abreviation \"%s\" doesn't exist", string);
paul@4539 145 return;
paul@4539 146 }
paul@4539 147 + }
paul@4539 148
paul@4539 149 if (find_abbr(string, strlen(string), &prev))
paul@4539 150 del_abbr(string);
paul@4539 151 @@ -122,7 +128,7 @@
paul@4539 152 del_abbr(char *abbrev)
paul@4539 153 {
paul@4539 154 struct abbrev *a;
paul@4539 155 - struct abbrev **prev;
paul@4539 156 + struct abbrev **prev=0;
paul@4539 157
paul@4539 158 if (!(a = find_abbr(abbrev, strlen(abbrev), prev)))
paul@4539 159 return;
paul@4539 160 --- sc-7.16.orig/range.c
paul@4539 161 +++ sc-7.16/range.c
paul@4539 162 @@ -18,6 +18,8 @@
paul@4539 163
paul@4539 164 #include <stdio.h>
paul@4539 165 #include <ctype.h>
paul@4539 166 +#include <unistd.h>
paul@4539 167 +#include <curses.h>
paul@4539 168 #include "sc.h"
paul@4539 169
paul@4539 170 static struct range *rng_base;
paul@4539 171 --- sc-7.16.orig/vi.c
paul@4539 172 +++ sc-7.16/vi.c
paul@4539 173 @@ -17,6 +17,8 @@
paul@4539 174 #include <curses.h>
paul@4539 175 #include <ctype.h>
paul@4539 176 #include <stdlib.h>
paul@4539 177 +#include <unistd.h>
paul@4539 178 +#include <sys/wait.h>
paul@4539 179 #include "sc.h"
paul@4539 180
paul@4539 181 #if defined(REGCOMP)
paul@4539 182 @@ -40,7 +42,7 @@
paul@4539 183
paul@4539 184 #define istext(a) (isalnum(a) || ((a) == '_'))
paul@4539 185
paul@4539 186 -#define bool int
paul@4539 187 +/*#define bool int*/
paul@4539 188 #define true 1
paul@4539 189 #define false 0
paul@4539 190
paul@4539 191 @@ -667,8 +669,10 @@
paul@4539 192 static struct range *nextmatch;
paul@4539 193 int len;
paul@4539 194
paul@4539 195 - if (linelim > 0 && isalnum(line[linelim-1]) || line[linelim-1] == '_' ||
paul@4539 196 - (completethis && line[linelim-1] == ' ')) {
paul@4539 197 + if ((linelim > 0 && isalnum(line[linelim-1])) ||
paul@4539 198 + line[linelim-1] == '_' ||
paul@4539 199 + (completethis && line[linelim-1] == ' ')) {
paul@4539 200 +
paul@4539 201 if (!completethis) {
paul@4539 202 for (completethis = line + linelim - 1; isalnum(*completethis) ||
paul@4539 203 *completethis == '_'; completethis--) /* */;
paul@4539 204 @@ -715,7 +719,7 @@
paul@4539 205 showdr()
paul@4539 206 {
paul@4539 207 int minsr, minsc, maxsr, maxsc;
paul@4539 208 - char *p;
paul@4539 209 + /*char *p;*/
paul@4539 210 char r[12];
paul@4539 211 struct frange *fr = find_frange(currow, curcol);
paul@4539 212
paul@4539 213 @@ -1566,7 +1570,7 @@
paul@4539 214 search_again(bool reverse)
paul@4539 215 {
paul@4539 216 int prev_match;
paul@4539 217 - int found_it;
paul@4539 218 + int found_it=0;
paul@4539 219 #if !defined(REGCOMP) && !defined(RE_COMP) && !defined(REGCMP)
paul@4539 220 char *look_here;
paul@4539 221 int do_next;
paul@4539 222 @@ -1777,7 +1781,7 @@
paul@4539 223 static void
paul@4539 224 match_paren()
paul@4539 225 {
paul@4539 226 - register int i;
paul@4539 227 + /*register int i;*/
paul@4539 228 int nest = 1;
paul@4539 229 int tmp = linelim;
paul@4539 230
paul@4539 231 --- sc-7.16.orig/vmtbl.c
paul@4539 232 +++ sc-7.16/vmtbl.c
paul@4539 233 @@ -16,6 +16,7 @@
paul@4539 234 # include <curses.h>
paul@4539 235 #endif /* PSC */
paul@4539 236
paul@4539 237 +#include <unistd.h>
paul@4539 238 #include "sc.h"
paul@4539 239
paul@4539 240 /*
paul@4539 241 --- sc-7.16.orig/Makefile
paul@4539 242 +++ sc-7.16/Makefile
paul@4539 243 @@ -32,7 +32,7 @@
paul@4539 244
paul@4539 245 # This is where the library file (tutorial) goes.
paul@4539 246 #LIBDIR=/usr/local/share/$(name) # reno
paul@4539 247 -LIBDIR=${prefix}/lib/$(name)
paul@4539 248 +LIBDIR=${prefix}/share/doc/$(name)
paul@4539 249 LIBRARY=-DLIBDIR=\"${LIBDIR}\"
paul@4539 250
paul@4539 251 # Set SIMPLE for lex.c if you don't want arrow keys or lex.c blows up
paul@4539 252 --- sc-7.16.orig/color.c
paul@4539 253 +++ sc-7.16/color.c
paul@4539 254 @@ -19,6 +19,7 @@
paul@4539 255
paul@4539 256 #include <curses.h>
paul@4539 257 #include <ctype.h>
paul@4539 258 +#include <unistd.h>
paul@4539 259 #include "sc.h"
paul@4539 260
paul@4539 261 /* a linked list of free [struct ent]'s, uses .next as the pointer */
paul@4539 262 --- sc-7.16.orig/frame.c
paul@4539 263 +++ sc-7.16/frame.c
paul@4539 264 @@ -18,6 +18,9 @@
paul@4539 265
paul@4539 266 #include <stdio.h>
paul@4539 267 #include <ctype.h>
paul@4539 268 +#include <stdlib.h>
paul@4539 269 +#include <curses.h>
paul@4539 270 +#include <unistd.h>
paul@4539 271 #include "sc.h"
paul@4539 272
paul@4539 273 static struct frange *frame_base;
paul@4539 274 --- sc-7.16.orig/sc.c
paul@4539 275 +++ sc-7.16/sc.c
paul@4539 276 @@ -212,7 +212,7 @@
paul@4539 277
paul@4539 278 if (dbidx < 0)
paul@4539 279 return;
paul@4539 280 - if (p = delbuf[dbidx]) {
paul@4539 281 + if ((p = delbuf[dbidx])) {
paul@4539 282 scxfree(delbuffmt[dbidx]);
paul@4539 283 delbuffmt[dbidx] = NULL;
paul@4539 284 }
paul@4539 285 @@ -845,7 +845,7 @@
paul@4539 286 break;
paul@4539 287 case 'C':
paul@4539 288 color = !color;
paul@4539 289 - if (has_colors())
paul@4539 290 + if (has_colors()){
paul@4539 291 if (color) {
paul@4539 292 attron(COLOR_PAIR(1));
paul@4539 293 bkgd(COLOR_PAIR(1) | ' ');
paul@4539 294 @@ -853,6 +853,7 @@
paul@4539 295 attron(COLOR_PAIR(0));
paul@4539 296 bkgd(COLOR_PAIR(0) | ' ');
paul@4539 297 }
paul@4539 298 + }
paul@4539 299 error("Color %sabled.", color ? "en" : "dis");
paul@4539 300 break;
paul@4539 301 case 'N':
paul@4539 302 --- sc-7.16.orig/sort.c
paul@4539 303 +++ sc-7.16/sort.c
paul@4539 304 @@ -19,6 +19,8 @@
paul@4539 305 #include <stdio.h>
paul@4539 306 #include <ctype.h>
paul@4539 307 #include <stdlib.h>
paul@4539 308 +#include <unistd.h>
paul@4539 309 +#include <curses.h>
paul@4539 310 #include "sc.h"
paul@4539 311
paul@4539 312 int compare(const void *row1, const void *row2);
paul@4539 313 --- sc-7.16.orig/xmalloc.c
paul@4539 314 +++ sc-7.16/xmalloc.c
paul@4539 315 @@ -4,11 +4,12 @@
paul@4539 316 */
paul@4539 317
paul@4539 318 #include <curses.h>
paul@4539 319 +#include <stdlib.h>
paul@4539 320 #include "sc.h"
paul@4539 321
paul@4539 322 -extern char *malloc();
paul@4539 323 +/* extern char *malloc();
paul@4539 324 extern char *realloc();
paul@4539 325 -extern void free();
paul@4539 326 +extern void free(); */
paul@4539 327 void fatal();
paul@4539 328
paul@4539 329 #ifdef SYSV3
paul@4539 330 --- sc-7.16.orig/screen.c
paul@4539 331 +++ sc-7.16/screen.c
paul@4539 332 @@ -234,11 +234,12 @@
paul@4539 333 i = stcol;
paul@4539 334 lcols = 0;
paul@4539 335 col = rescol + frcols;
paul@4539 336 - if (fr && stcol >= fr->or_left->col)
paul@4539 337 + if (fr && stcol >= fr->or_left->col){
paul@4539 338 if (stcol < fr->ir_left->col)
paul@4539 339 i = fr->or_left->col;
paul@4539 340 else
paul@4539 341 col += flcols;
paul@4539 342 + }
paul@4539 343 for (; (col + fwidth[i] < cols-1 || col_hidden[i] || i < curcol) &&
paul@4539 344 i < maxcols; i++) {
paul@4539 345 lcols++;
paul@4539 346 @@ -328,11 +329,12 @@
paul@4539 347 i = stcol;
paul@4539 348 lcols = 0;
paul@4539 349 col = rescol + frcols;
paul@4539 350 - if (fr && stcol >= fr->or_left->col)
paul@4539 351 + if (fr && stcol >= fr->or_left->col){
paul@4539 352 if (stcol < fr->ir_left->col)
paul@4539 353 i = fr->or_left->col;
paul@4539 354 else
paul@4539 355 col += flcols;
paul@4539 356 + }
paul@4539 357 for (; (col + fwidth[i] < cols-1 || col_hidden[i] || i < curcol) &&
paul@4539 358 i < maxcols; i++) {
paul@4539 359 lcols++;
paul@4539 360 @@ -377,11 +379,12 @@
paul@4539 361 i = strow;
paul@4539 362 rows = 0;
paul@4539 363 row = RESROW + fbrows;
paul@4539 364 - if (fr && strow >= fr->or_left->row)
paul@4539 365 + if (fr && strow >= fr->or_left->row){
paul@4539 366 if (strow < fr->ir_left->row)
paul@4539 367 i = fr->or_left->row;
paul@4539 368 else
paul@4539 369 row += ftrows;
paul@4539 370 + }
paul@4539 371 for (; (row < lines || row_hidden[i] || i < currow) && i < maxrows;
paul@4539 372 i++) {
paul@4539 373 rows++;
paul@4539 374 @@ -460,11 +463,12 @@
paul@4539 375 i = strow;
paul@4539 376 rows = 0;
paul@4539 377 row = RESROW + fbrows;
paul@4539 378 - if (fr && strow >= fr->or_left->row)
paul@4539 379 + if (fr && strow >= fr->or_left->row){
paul@4539 380 if (strow < fr->ir_left->row)
paul@4539 381 i = fr->or_left->row;
paul@4539 382 else
paul@4539 383 row += ftrows;
paul@4539 384 + }
paul@4539 385 for (; (row < lines || row_hidden[i] || i < currow) && i < maxrows;
paul@4539 386 i++) {
paul@4539 387 rows++;
paul@4539 388 --- sc-7.16.orig/lex.c
paul@4539 389 +++ sc-7.16/lex.c
paul@4539 390 @@ -34,6 +34,8 @@
paul@4539 391 #include <signal.h>
paul@4539 392 #include <setjmp.h>
paul@4539 393 #include <ctype.h>
paul@4539 394 +#include <unistd.h>
paul@4539 395 +#include <math.h>
paul@4539 396 #include "sc.h"
paul@4539 397
paul@4539 398 #ifdef NONOTIMEOUT
paul@4539 399 @@ -107,7 +109,7 @@
paul@4539 400 yylex()
paul@4539 401 {
paul@4539 402 char *p = line + linelim;
paul@4539 403 - int ret;
paul@4539 404 + int ret=0;
paul@4539 405 static int isfunc = 0;
paul@4539 406 static bool isgoto = 0;
paul@4539 407 static bool colstate = 0;
paul@4539 408 @@ -326,7 +328,7 @@
paul@4539 409 strcpy((char *)path, HomeDir);
paul@4539 410 strcat((char *)path, "/.sc/plugins/");
paul@4539 411 strncat((char *)path, name, len);
paul@4539 412 - if (fp = fopen((char *)path, "r")) {
paul@4539 413 + if ((fp = fopen((char *)path, "r"))) {
paul@4539 414 fclose(fp);
paul@4539 415 return 1;
paul@4539 416 }
paul@4539 417 @@ -334,7 +336,7 @@
paul@4539 418 strcpy((char *)path, LIBDIR);
paul@4539 419 strcat((char *)path, "/plugins/");
paul@4539 420 strncat((char *)path, name, len);
paul@4539 421 - if (fp = fopen((char *)path, "r")) {
paul@4539 422 + if ((fp = fopen((char *)path, "r"))) {
paul@4539 423 fclose(fp);
paul@4539 424 return 1;
paul@4539 425 }
paul@4539 426 --- sc-7.16.orig/interp.c
paul@4539 427 +++ sc-7.16/interp.c
paul@4539 428 @@ -1572,12 +1572,12 @@
paul@4539 429 copy(struct ent *dv1, struct ent *dv2, struct ent *v1, struct ent *v2)
paul@4539 430 {
paul@4539 431 struct ent *p;
paul@4539 432 - struct ent *n;
paul@4539 433 +/* struct ent *n;*/
paul@4539 434 static int minsr = -1, minsc = -1;
paul@4539 435 static int maxsr = -1, maxsc = -1;
paul@4539 436 int mindr, mindc;
paul@4539 437 int maxdr, maxdc;
paul@4539 438 - int vr, vc;
paul@4539 439 +/* int vr, vc;*/
paul@4539 440 int r, c;
paul@4539 441 int deltar, deltac;
paul@4539 442
paul@4539 443 @@ -2066,7 +2066,7 @@
paul@4539 444 *line = '\0';
paul@4539 445 }
paul@4539 446 }
paul@4539 447 - if (!col_hidden[c])
paul@4539 448 + if (!col_hidden[c]){
paul@4539 449 if (gs.g_type == G_STR) {
paul@4539 450 if (p && p->label
paul@4539 451 #if defined(REGCOMP)
paul@4539 452 @@ -2099,6 +2099,7 @@
paul@4539 453 #endif
paul@4539 454 #endif
paul@4539 455 break;
paul@4539 456 + }
paul@4539 457 if (r == endr && c == endc) {
paul@4539 458 error("String not found");
paul@4539 459 #if defined(REGCOMP)
paul@4539 460 @@ -2471,13 +2472,11 @@
paul@4539 461 int
paul@4539 462 constant(register struct enode *e)
paul@4539 463 {
paul@4539 464 - return (
paul@4539 465 - e == NULL
paul@4539 466 + return e == NULL
paul@4539 467 || e->op == O_CONST
paul@4539 468 || e->op == O_SCONST
paul@4539 469 - || e->op == 'm' && constant(e->e.o.left)
paul@4539 470 - || (
paul@4539 471 - e->op != O_VAR
paul@4539 472 + || (e->op == 'm' && constant(e->e.o.left))
paul@4539 473 + || (e->op != O_VAR
paul@4539 474 && !(e->op & REDUCE)
paul@4539 475 && constant(e->e.o.left)
paul@4539 476 && constant(e->e.o.right)
paul@4539 477 @@ -2491,9 +2490,7 @@
paul@4539 478 && e->op != LASTCOL
paul@4539 479 && e->op != NUMITER
paul@4539 480 && e->op != FILENAME
paul@4539 481 - && optimize
paul@4539 482 - )
paul@4539 483 - );
paul@4539 484 + && optimize );
paul@4539 485 }
paul@4539 486
paul@4539 487 void
paul@4539 488 --- sc-7.16.orig/help.c
paul@4539 489 +++ sc-7.16/help.c
paul@4539 490 @@ -11,6 +11,7 @@
paul@4539 491 char *revision = "$Revision: 7.16 $";
paul@4539 492 #else
paul@4539 493 #include <curses.h>
paul@4539 494 +#include <unistd.h>
paul@4539 495 #include "sc.h"
paul@4539 496 #endif /* QREF */
paul@4539 497