wok-6.x view sc/stuff/7.16.patch @ rev 11765

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