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

Generated by cgit