514 lines
13 KiB
Diff
514 lines
13 KiB
Diff
diff -Nru sc-7.16.orig/Makefile sc-7.16/Makefile
|
|
--- sc-7.16.orig/Makefile 2006-12-20 18:43:05.630179753 +0100
|
|
+++ sc-7.16/Makefile 2006-12-20 18:48:45.280553112 +0100
|
|
@@ -32,7 +32,7 @@
|
|
|
|
# This is where the library file (tutorial) goes.
|
|
#LIBDIR=/usr/local/share/$(name) # reno
|
|
-LIBDIR=${prefix}/lib/$(name)
|
|
+LIBDIR=${prefix}/share/$(name)
|
|
LIBRARY=-DLIBDIR=\"${LIBDIR}\"
|
|
|
|
# Set SIMPLE for lex.c if you don't want arrow keys or lex.c blows up
|
|
diff -Nru sc-7.16.orig/abbrev.c sc-7.16/abbrev.c
|
|
--- sc-7.16.orig/abbrev.c 2006-12-20 18:43:05.630179753 +0100
|
|
+++ sc-7.16/abbrev.c 2006-12-20 18:48:45.280553112 +0100
|
|
@@ -19,10 +19,15 @@
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <ctype.h>
|
|
+#include <curses.h>
|
|
+#include <unistd.h>
|
|
#include "sc.h"
|
|
|
|
static struct abbrev *abbr_base;
|
|
|
|
+int are_abbrevs(void);
|
|
+
|
|
+
|
|
void
|
|
add_abbr(char *string)
|
|
{
|
|
@@ -87,7 +92,7 @@
|
|
}
|
|
}
|
|
|
|
- if (expansion == NULL)
|
|
+ if (expansion == NULL){
|
|
if ((a = find_abbr(string, strlen(string), &prev))) {
|
|
error("abbrev \"%s %s\"", a->abbr, a->exp);
|
|
return;
|
|
@@ -95,6 +100,7 @@
|
|
error("abreviation \"%s\" doesn't exist", string);
|
|
return;
|
|
}
|
|
+ }
|
|
|
|
if (find_abbr(string, strlen(string), &prev))
|
|
del_abbr(string);
|
|
@@ -122,7 +128,7 @@
|
|
del_abbr(char *abbrev)
|
|
{
|
|
struct abbrev *a;
|
|
- struct abbrev **prev;
|
|
+ struct abbrev **prev=0;
|
|
|
|
if (!(a = find_abbr(abbrev, strlen(abbrev), prev)))
|
|
return;
|
|
diff -Nru sc-7.16.orig/cmds.c sc-7.16/cmds.c
|
|
--- sc-7.16.orig/cmds.c 2006-12-20 18:43:05.630179753 +0100
|
|
+++ sc-7.16/cmds.c 2006-12-20 18:48:45.280553112 +0100
|
|
@@ -478,7 +478,7 @@
|
|
int i, qtmp;
|
|
char buf[50];
|
|
struct frange *fr;
|
|
- struct ent *obuf;
|
|
+ struct ent *obuf=0;
|
|
|
|
if ((fr = find_frange(currow, curcol)))
|
|
rs = fr->or_right->row - currow + 1;
|
|
@@ -535,7 +535,7 @@
|
|
int cs = maxcol - curcol + 1;
|
|
int i, qtmp;
|
|
char buf[50];
|
|
- struct ent *obuf;
|
|
+ struct ent *obuf=0;
|
|
|
|
if (cs - arg < 0) {
|
|
cs = cs > 0 ? cs : 0;
|
|
@@ -810,7 +810,7 @@
|
|
|
|
if (to_insert == 'r') {
|
|
insertrow(numrows, 0);
|
|
- if (fr = find_frange(currow, curcol))
|
|
+ if ((fr = find_frange(currow, curcol)))
|
|
deltac = fr->or_left->col - mincol;
|
|
else {
|
|
for (i = 0; i < numrows; i++)
|
|
@@ -2279,7 +2279,7 @@
|
|
ret->e.r.right.vp = lookat(newrow, newcol);
|
|
ret->e.r.right.vf = e->e.r.right.vf;
|
|
} else {
|
|
- struct enode *temprange;
|
|
+ struct enode *temprange=0;
|
|
|
|
if (freeenodes) {
|
|
ret = freeenodes;
|
|
@@ -2337,8 +2337,7 @@
|
|
break;
|
|
case 'f':
|
|
case 'F':
|
|
- if (range && ret->op == 'F' ||
|
|
- !range && ret->op == 'f')
|
|
+ if ((range && ret->op == 'F') || (!range && ret->op == 'f'))
|
|
Rdelta = Cdelta = 0;
|
|
ret->e.o.left = copye(e->e.o.left, Rdelta, Cdelta,
|
|
r1, c1, r2, c2, transpose);
|
|
@@ -2798,7 +2797,7 @@
|
|
write_cells(register FILE *f, int r0, int c0, int rn, int cn, int dr, int dc)
|
|
{
|
|
register struct ent **pp;
|
|
- int r, c, rs, cs, mf;
|
|
+ int r, c, rs=0, cs=0, mf;
|
|
char *dpointptr;
|
|
|
|
mf = modflg;
|
|
@@ -2861,12 +2860,12 @@
|
|
if ((plugin = findplugin(p+1, 'w')) != NULL) {
|
|
if (!plugin_exists(plugin, strlen(plugin), save + 1)) {
|
|
error("plugin not found");
|
|
- return;
|
|
+ return -1;
|
|
}
|
|
*save = '|';
|
|
if ((strlen(save) + strlen(fname) + 20) > PATHLEN) {
|
|
error("Path too long");
|
|
- return;
|
|
+ return -1;
|
|
}
|
|
sprintf(save + strlen(save), " %s%d:", coltoa(c0), r0);
|
|
sprintf(save + strlen(save), "%s%d \"%s\"", coltoa(cn), rn, fname);
|
|
@@ -2883,13 +2882,14 @@
|
|
}
|
|
#endif /* VMS */
|
|
|
|
- if (*fname == '\0')
|
|
+ if (*fname == '\0'){
|
|
if (isatty(STDOUT_FILENO) || *curfile != '\0')
|
|
fname = curfile;
|
|
else {
|
|
write_fd(stdout, r0, c0, rn, cn);
|
|
return (0);
|
|
}
|
|
+ }
|
|
|
|
#ifdef MSDOS
|
|
namelen = 12;
|
|
@@ -2981,12 +2981,12 @@
|
|
if ((plugin = findplugin(p+1, 'r')) != NULL) {
|
|
if (!(plugin_exists(plugin, strlen(plugin), save + 1))) {
|
|
error("plugin not found");
|
|
- return;
|
|
+ return -1;
|
|
}
|
|
*save = '|';
|
|
if ((strlen(save) + strlen(fname) + 2) > PATHLEN) {
|
|
error("Path too long");
|
|
- return;
|
|
+ return -1;
|
|
}
|
|
sprintf(save + strlen(save), " \"%s\"", fname);
|
|
eraseflg = 0;
|
|
diff -Nru sc-7.16.orig/color.c sc-7.16/color.c
|
|
--- sc-7.16.orig/color.c 2006-12-20 18:43:05.630179753 +0100
|
|
+++ sc-7.16/color.c 2006-12-20 18:48:45.280553112 +0100
|
|
@@ -19,6 +19,7 @@
|
|
|
|
#include <curses.h>
|
|
#include <ctype.h>
|
|
+#include <unistd.h>
|
|
#include "sc.h"
|
|
|
|
/* a linked list of free [struct ent]'s, uses .next as the pointer */
|
|
diff -Nru sc-7.16.orig/frame.c sc-7.16/frame.c
|
|
--- sc-7.16.orig/frame.c 2006-12-20 18:43:05.630179753 +0100
|
|
+++ sc-7.16/frame.c 2006-12-20 18:48:45.280553112 +0100
|
|
@@ -18,6 +18,9 @@
|
|
|
|
#include <stdio.h>
|
|
#include <ctype.h>
|
|
+#include <stdlib.h>
|
|
+#include <curses.h>
|
|
+#include <unistd.h>
|
|
#include "sc.h"
|
|
|
|
static struct frange *frame_base;
|
|
diff -Nru sc-7.16.orig/help.c sc-7.16/help.c
|
|
--- sc-7.16.orig/help.c 2006-12-20 18:43:05.630179753 +0100
|
|
+++ sc-7.16/help.c 2006-12-20 18:48:45.280553112 +0100
|
|
@@ -11,6 +11,7 @@
|
|
char *revision = "$Revision: 7.16 $";
|
|
#else
|
|
#include <curses.h>
|
|
+#include <unistd.h>
|
|
#include "sc.h"
|
|
#endif /* QREF */
|
|
|
|
diff -Nru sc-7.16.orig/interp.c sc-7.16/interp.c
|
|
--- sc-7.16.orig/interp.c 2006-12-20 18:43:05.630179753 +0100
|
|
+++ sc-7.16/interp.c 2006-12-20 18:48:45.290552829 +0100
|
|
@@ -1572,12 +1572,12 @@
|
|
copy(struct ent *dv1, struct ent *dv2, struct ent *v1, struct ent *v2)
|
|
{
|
|
struct ent *p;
|
|
- struct ent *n;
|
|
+/* struct ent *n;*/
|
|
static int minsr = -1, minsc = -1;
|
|
static int maxsr = -1, maxsc = -1;
|
|
int mindr, mindc;
|
|
int maxdr, maxdc;
|
|
- int vr, vc;
|
|
+/* int vr, vc;*/
|
|
int r, c;
|
|
int deltar, deltac;
|
|
|
|
@@ -2066,7 +2066,7 @@
|
|
*line = '\0';
|
|
}
|
|
}
|
|
- if (!col_hidden[c])
|
|
+ if (!col_hidden[c]){
|
|
if (gs.g_type == G_STR) {
|
|
if (p && p->label
|
|
#if defined(REGCOMP)
|
|
@@ -2099,6 +2099,7 @@
|
|
#endif
|
|
#endif
|
|
break;
|
|
+ }
|
|
if (r == endr && c == endc) {
|
|
error("String not found");
|
|
#if defined(REGCOMP)
|
|
@@ -2471,13 +2472,11 @@
|
|
int
|
|
constant(register struct enode *e)
|
|
{
|
|
- return (
|
|
- e == NULL
|
|
+ return e == NULL
|
|
|| e->op == O_CONST
|
|
|| e->op == O_SCONST
|
|
- || e->op == 'm' && constant(e->e.o.left)
|
|
- || (
|
|
- e->op != O_VAR
|
|
+ || (e->op == 'm' && constant(e->e.o.left))
|
|
+ || (e->op != O_VAR
|
|
&& !(e->op & REDUCE)
|
|
&& constant(e->e.o.left)
|
|
&& constant(e->e.o.right)
|
|
@@ -2491,9 +2490,7 @@
|
|
&& e->op != LASTCOL
|
|
&& e->op != NUMITER
|
|
&& e->op != FILENAME
|
|
- && optimize
|
|
- )
|
|
- );
|
|
+ && optimize );
|
|
}
|
|
|
|
void
|
|
diff -Nru sc-7.16.orig/lex.c sc-7.16/lex.c
|
|
--- sc-7.16.orig/lex.c 2006-12-20 18:43:05.630179753 +0100
|
|
+++ sc-7.16/lex.c 2006-12-20 18:48:45.290552829 +0100
|
|
@@ -34,6 +34,8 @@
|
|
#include <signal.h>
|
|
#include <setjmp.h>
|
|
#include <ctype.h>
|
|
+#include <unistd.h>
|
|
+#include <math.h>
|
|
#include "sc.h"
|
|
|
|
#ifdef NONOTIMEOUT
|
|
@@ -107,7 +109,7 @@
|
|
yylex()
|
|
{
|
|
char *p = line + linelim;
|
|
- int ret;
|
|
+ int ret=0;
|
|
static int isfunc = 0;
|
|
static bool isgoto = 0;
|
|
static bool colstate = 0;
|
|
@@ -326,7 +328,7 @@
|
|
strcpy((char *)path, HomeDir);
|
|
strcat((char *)path, "/.sc/plugins/");
|
|
strncat((char *)path, name, len);
|
|
- if (fp = fopen((char *)path, "r")) {
|
|
+ if ((fp = fopen((char *)path, "r"))) {
|
|
fclose(fp);
|
|
return 1;
|
|
}
|
|
@@ -334,7 +336,7 @@
|
|
strcpy((char *)path, LIBDIR);
|
|
strcat((char *)path, "/plugins/");
|
|
strncat((char *)path, name, len);
|
|
- if (fp = fopen((char *)path, "r")) {
|
|
+ if ((fp = fopen((char *)path, "r"))) {
|
|
fclose(fp);
|
|
return 1;
|
|
}
|
|
diff -Nru sc-7.16.orig/range.c sc-7.16/range.c
|
|
--- sc-7.16.orig/range.c 2006-12-20 18:43:05.630179753 +0100
|
|
+++ sc-7.16/range.c 2006-12-20 18:48:45.290552829 +0100
|
|
@@ -18,6 +18,8 @@
|
|
|
|
#include <stdio.h>
|
|
#include <ctype.h>
|
|
+#include <unistd.h>
|
|
+#include <curses.h>
|
|
#include "sc.h"
|
|
|
|
static struct range *rng_base;
|
|
diff -Nru sc-7.16.orig/sc.c sc-7.16/sc.c
|
|
--- sc-7.16.orig/sc.c 2006-12-20 18:43:05.630179753 +0100
|
|
+++ sc-7.16/sc.c 2006-12-20 18:48:45.290552829 +0100
|
|
@@ -212,7 +212,7 @@
|
|
|
|
if (dbidx < 0)
|
|
return;
|
|
- if (p = delbuf[dbidx]) {
|
|
+ if ((p = delbuf[dbidx])) {
|
|
scxfree(delbuffmt[dbidx]);
|
|
delbuffmt[dbidx] = NULL;
|
|
}
|
|
@@ -845,7 +845,7 @@
|
|
break;
|
|
case 'C':
|
|
color = !color;
|
|
- if (has_colors())
|
|
+ if (has_colors()){
|
|
if (color) {
|
|
attron(COLOR_PAIR(1));
|
|
bkgd(COLOR_PAIR(1) | ' ');
|
|
@@ -853,6 +853,7 @@
|
|
attron(COLOR_PAIR(0));
|
|
bkgd(COLOR_PAIR(0) | ' ');
|
|
}
|
|
+ }
|
|
error("Color %sabled.", color ? "en" : "dis");
|
|
break;
|
|
case 'N':
|
|
diff -Nru sc-7.16.orig/sc.h sc-7.16/sc.h
|
|
--- sc-7.16.orig/sc.h 2006-12-20 18:43:05.630179753 +0100
|
|
+++ sc-7.16/sc.h 2006-12-20 18:48:45.290552829 +0100
|
|
@@ -612,6 +612,9 @@
|
|
extern int rowlimit;
|
|
extern int collimit;
|
|
|
|
+void yankr(struct ent *v1, struct ent *v2);
|
|
+
|
|
+
|
|
#if BSD42 || SYSIII
|
|
|
|
#ifndef cbreak
|
|
diff -Nru sc-7.16.orig/screen.c sc-7.16/screen.c
|
|
--- sc-7.16.orig/screen.c 2006-12-20 18:43:05.630179753 +0100
|
|
+++ sc-7.16/screen.c 2006-12-20 18:48:45.290552829 +0100
|
|
@@ -234,11 +234,12 @@
|
|
i = stcol;
|
|
lcols = 0;
|
|
col = rescol + frcols;
|
|
- if (fr && stcol >= fr->or_left->col)
|
|
+ if (fr && stcol >= fr->or_left->col){
|
|
if (stcol < fr->ir_left->col)
|
|
i = fr->or_left->col;
|
|
else
|
|
col += flcols;
|
|
+ }
|
|
for (; (col + fwidth[i] < cols-1 || col_hidden[i] || i < curcol) &&
|
|
i < maxcols; i++) {
|
|
lcols++;
|
|
@@ -328,11 +329,12 @@
|
|
i = stcol;
|
|
lcols = 0;
|
|
col = rescol + frcols;
|
|
- if (fr && stcol >= fr->or_left->col)
|
|
+ if (fr && stcol >= fr->or_left->col){
|
|
if (stcol < fr->ir_left->col)
|
|
i = fr->or_left->col;
|
|
else
|
|
col += flcols;
|
|
+ }
|
|
for (; (col + fwidth[i] < cols-1 || col_hidden[i] || i < curcol) &&
|
|
i < maxcols; i++) {
|
|
lcols++;
|
|
@@ -377,11 +379,12 @@
|
|
i = strow;
|
|
rows = 0;
|
|
row = RESROW + fbrows;
|
|
- if (fr && strow >= fr->or_left->row)
|
|
+ if (fr && strow >= fr->or_left->row){
|
|
if (strow < fr->ir_left->row)
|
|
i = fr->or_left->row;
|
|
else
|
|
row += ftrows;
|
|
+ }
|
|
for (; (row < lines || row_hidden[i] || i < currow) && i < maxrows;
|
|
i++) {
|
|
rows++;
|
|
@@ -460,11 +463,12 @@
|
|
i = strow;
|
|
rows = 0;
|
|
row = RESROW + fbrows;
|
|
- if (fr && strow >= fr->or_left->row)
|
|
+ if (fr && strow >= fr->or_left->row){
|
|
if (strow < fr->ir_left->row)
|
|
i = fr->or_left->row;
|
|
else
|
|
row += ftrows;
|
|
+ }
|
|
for (; (row < lines || row_hidden[i] || i < currow) && i < maxrows;
|
|
i++) {
|
|
rows++;
|
|
diff -Nru sc-7.16.orig/sort.c sc-7.16/sort.c
|
|
--- sc-7.16.orig/sort.c 2006-12-20 18:43:05.630179753 +0100
|
|
+++ sc-7.16/sort.c 2006-12-20 18:48:45.290552829 +0100
|
|
@@ -19,6 +19,8 @@
|
|
#include <stdio.h>
|
|
#include <ctype.h>
|
|
#include <stdlib.h>
|
|
+#include <unistd.h>
|
|
+#include <curses.h>
|
|
#include "sc.h"
|
|
|
|
int compare(const void *row1, const void *row2);
|
|
diff -Nru sc-7.16.orig/vi.c sc-7.16/vi.c
|
|
--- sc-7.16.orig/vi.c 2006-12-20 18:43:05.630179753 +0100
|
|
+++ sc-7.16/vi.c 2006-12-20 18:48:45.290552829 +0100
|
|
@@ -17,6 +17,8 @@
|
|
#include <curses.h>
|
|
#include <ctype.h>
|
|
#include <stdlib.h>
|
|
+#include <unistd.h>
|
|
+#include <sys/wait.h>
|
|
#include "sc.h"
|
|
|
|
#if defined(REGCOMP)
|
|
@@ -40,7 +42,7 @@
|
|
|
|
#define istext(a) (isalnum(a) || ((a) == '_'))
|
|
|
|
-#define bool int
|
|
+/*#define bool int*/
|
|
#define true 1
|
|
#define false 0
|
|
|
|
@@ -667,8 +669,10 @@
|
|
static struct range *nextmatch;
|
|
int len;
|
|
|
|
- if (linelim > 0 && isalnum(line[linelim-1]) || line[linelim-1] == '_' ||
|
|
- (completethis && line[linelim-1] == ' ')) {
|
|
+ if ((linelim > 0 && isalnum(line[linelim-1])) ||
|
|
+ line[linelim-1] == '_' ||
|
|
+ (completethis && line[linelim-1] == ' ')) {
|
|
+
|
|
if (!completethis) {
|
|
for (completethis = line + linelim - 1; isalnum(*completethis) ||
|
|
*completethis == '_'; completethis--) /* */;
|
|
@@ -715,7 +719,7 @@
|
|
showdr()
|
|
{
|
|
int minsr, minsc, maxsr, maxsc;
|
|
- char *p;
|
|
+ /*char *p;*/
|
|
char r[12];
|
|
struct frange *fr = find_frange(currow, curcol);
|
|
|
|
@@ -1566,7 +1570,7 @@
|
|
search_again(bool reverse)
|
|
{
|
|
int prev_match;
|
|
- int found_it;
|
|
+ int found_it=0;
|
|
#if !defined(REGCOMP) && !defined(RE_COMP) && !defined(REGCMP)
|
|
char *look_here;
|
|
int do_next;
|
|
@@ -1777,7 +1781,7 @@
|
|
static void
|
|
match_paren()
|
|
{
|
|
- register int i;
|
|
+ /*register int i;*/
|
|
int nest = 1;
|
|
int tmp = linelim;
|
|
|
|
diff -Nru sc-7.16.orig/vmtbl.c sc-7.16/vmtbl.c
|
|
--- sc-7.16.orig/vmtbl.c 2006-12-20 18:43:05.630179753 +0100
|
|
+++ sc-7.16/vmtbl.c 2006-12-20 18:48:45.290552829 +0100
|
|
@@ -16,6 +16,7 @@
|
|
# include <curses.h>
|
|
#endif /* PSC */
|
|
|
|
+#include <unistd.h>
|
|
#include "sc.h"
|
|
|
|
/*
|
|
diff -Nru sc-7.16.orig/xmalloc.c sc-7.16/xmalloc.c
|
|
--- sc-7.16.orig/xmalloc.c 2006-12-20 18:43:05.630179753 +0100
|
|
+++ sc-7.16/xmalloc.c 2006-12-20 18:48:45.290552829 +0100
|
|
@@ -4,11 +4,12 @@
|
|
*/
|
|
|
|
#include <curses.h>
|
|
+#include <stdlib.h>
|
|
#include "sc.h"
|
|
|
|
-extern char *malloc();
|
|
+/* extern char *malloc();
|
|
extern char *realloc();
|
|
-extern void free();
|
|
+extern void free(); */
|
|
void fatal();
|
|
|
|
#ifdef SYSV3
|