Initial version of sc package
This commit is contained in:
commit
07bf125824
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
/sc-*.tar.gz
|
||||||
|
/sc-*/
|
||||||
|
/.build-*.log
|
||||||
|
/*.src.rpm
|
||||||
|
/x86_64/
|
534
Upstream-changes-from-old-versions.patch
Normal file
534
Upstream-changes-from-old-versions.patch
Normal file
@ -0,0 +1,534 @@
|
|||||||
|
Description: Patches to upstream source since 7.16
|
||||||
|
Self-explanatory changes mostly dealing with compilation issues
|
||||||
|
(ie. broken code, like undefined locals, missing return value, etc.)
|
||||||
|
.
|
||||||
|
sc (7.16-3) unstable; urgency=low
|
||||||
|
.
|
||||||
|
* Changed maintainer to the new email address, recursively.
|
||||||
|
* Fixed old changelog entries' bug closing method
|
||||||
|
* Add patches supplied by Carsten Hey
|
||||||
|
+ Stop compressing tutorial.sc file (closes: #514777)
|
||||||
|
+ Use default colors (closes: #514775)
|
||||||
|
* Bump Standards to 3.8.4.
|
||||||
|
* Bump dependency of debhelper.
|
||||||
|
Author: Adam Majer <adamm@zombino.com>
|
||||||
|
|
||||||
|
---
|
||||||
|
The information above should follow the Patch Tagging Guidelines, please
|
||||||
|
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
|
||||||
|
are templates for supplementary fields that you might want to add:
|
||||||
|
|
||||||
|
Origin: <vendor|upstream|other>, <url of original patch>
|
||||||
|
Bug: <url in upstream bugtracker>
|
||||||
|
Bug-Debian: http://bugs.debian.org/<bugnumber>
|
||||||
|
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
|
||||||
|
Forwarded: <no|not-needed|url proving that it has been forwarded>
|
||||||
|
Reviewed-By: <name and email of someone who approved the patch>
|
||||||
|
Last-Update: <YYYY-MM-DD>
|
||||||
|
|
||||||
|
--- sc-7.16.orig/abbrev.c
|
||||||
|
+++ sc-7.16/abbrev.c
|
||||||
|
@@ -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 @@ add_abbr(char *string)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- 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 @@ add_abbr(char *string)
|
||||||
|
error("abreviation \"%s\" doesn't exist", string);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if (find_abbr(string, strlen(string), &prev))
|
||||||
|
del_abbr(string);
|
||||||
|
@@ -122,7 +128,7 @@ void
|
||||||
|
del_abbr(char *abbrev)
|
||||||
|
{
|
||||||
|
struct abbrev *a;
|
||||||
|
- struct abbrev **prev;
|
||||||
|
+ struct abbrev **prev=0;
|
||||||
|
|
||||||
|
if (!(a = find_abbr(abbrev, strlen(abbrev), prev)))
|
||||||
|
return;
|
||||||
|
--- sc-7.16.orig/cmds.c
|
||||||
|
+++ sc-7.16/cmds.c
|
||||||
|
@@ -478,7 +478,7 @@ yankrow(int arg)
|
||||||
|
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 @@ yankcol(int arg)
|
||||||
|
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 @@ pullcells(int to_insert)
|
||||||
|
|
||||||
|
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 @@ copye(register struct enode *e, int Rdel
|
||||||
|
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 @@ copye(register struct enode *e, int Rdel
|
||||||
|
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 @@ void
|
||||||
|
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 @@ writefile(char *fname, int r0, int c0, i
|
||||||
|
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 @@ writefile(char *fname, int r0, int c0, i
|
||||||
|
}
|
||||||
|
#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 @@ readfile(char *fname, int eraseflg)
|
||||||
|
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;
|
||||||
|
--- sc-7.16.orig/color.c
|
||||||
|
+++ sc-7.16/color.c
|
||||||
|
@@ -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 */
|
||||||
|
@@ -30,6 +31,8 @@ static struct crange *color_base;
|
||||||
|
void
|
||||||
|
initcolor(int colornum)
|
||||||
|
{
|
||||||
|
+ use_default_colors();
|
||||||
|
+
|
||||||
|
if (!colornum) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
--- sc-7.16.orig/frame.c
|
||||||
|
+++ sc-7.16/frame.c
|
||||||
|
@@ -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;
|
||||||
|
--- sc-7.16.orig/help.c
|
||||||
|
+++ sc-7.16/help.c
|
||||||
|
@@ -11,6 +11,7 @@ char *header = " Quick Reference";
|
||||||
|
char *revision = "$Revision: 7.16 $";
|
||||||
|
#else
|
||||||
|
#include <curses.h>
|
||||||
|
+#include <unistd.h>
|
||||||
|
#include "sc.h"
|
||||||
|
#endif /* QREF */
|
||||||
|
|
||||||
|
--- sc-7.16.orig/interp.c
|
||||||
|
+++ sc-7.16/interp.c
|
||||||
|
@@ -1572,12 +1572,12 @@ void
|
||||||
|
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 @@ str_search(char *s, int firstrow, int fi
|
||||||
|
*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 @@ str_search(char *s, int firstrow, int fi
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
+ }
|
||||||
|
if (r == endr && c == endc) {
|
||||||
|
error("String not found");
|
||||||
|
#if defined(REGCOMP)
|
||||||
|
@@ -2471,13 +2472,11 @@ clearent(struct ent *v)
|
||||||
|
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 @@ constant(register struct enode *e)
|
||||||
|
&& e->op != LASTCOL
|
||||||
|
&& e->op != NUMITER
|
||||||
|
&& e->op != FILENAME
|
||||||
|
- && optimize
|
||||||
|
- )
|
||||||
|
- );
|
||||||
|
+ && optimize );
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
--- sc-7.16.orig/lex.c
|
||||||
|
+++ sc-7.16/lex.c
|
||||||
|
@@ -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 @@ int
|
||||||
|
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 @@ plugin_exists(char *name, int len, char
|
||||||
|
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 @@ plugin_exists(char *name, int len, char
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
--- sc-7.16.orig/Makefile
|
||||||
|
+++ sc-7.16/Makefile
|
||||||
|
@@ -32,7 +32,7 @@ MANMODE=644
|
||||||
|
|
||||||
|
# This is where the library file (tutorial) goes.
|
||||||
|
#LIBDIR=/usr/local/share/$(name) # reno
|
||||||
|
-LIBDIR=${prefix}/lib/$(name)
|
||||||
|
+LIBDIR=${prefix}/share/doc/$(name)
|
||||||
|
LIBRARY=-DLIBDIR=\"${LIBDIR}\"
|
||||||
|
|
||||||
|
# Set SIMPLE for lex.c if you don't want arrow keys or lex.c blows up
|
||||||
|
--- sc-7.16.orig/range.c
|
||||||
|
+++ sc-7.16/range.c
|
||||||
|
@@ -18,6 +18,8 @@
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
+#include <unistd.h>
|
||||||
|
+#include <curses.h>
|
||||||
|
#include "sc.h"
|
||||||
|
|
||||||
|
static struct range *rng_base;
|
||||||
|
--- sc-7.16.orig/sc.c
|
||||||
|
+++ sc-7.16/sc.c
|
||||||
|
@@ -212,7 +212,7 @@ flush_saved()
|
||||||
|
|
||||||
|
if (dbidx < 0)
|
||||||
|
return;
|
||||||
|
- if (p = delbuf[dbidx]) {
|
||||||
|
+ if ((p = delbuf[dbidx])) {
|
||||||
|
scxfree(delbuffmt[dbidx]);
|
||||||
|
delbuffmt[dbidx] = NULL;
|
||||||
|
}
|
||||||
|
@@ -845,7 +845,7 @@ main (int argc, char **argv)
|
||||||
|
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 @@ main (int argc, char **argv)
|
||||||
|
attron(COLOR_PAIR(0));
|
||||||
|
bkgd(COLOR_PAIR(0) | ' ');
|
||||||
|
}
|
||||||
|
+ }
|
||||||
|
error("Color %sabled.", color ? "en" : "dis");
|
||||||
|
break;
|
||||||
|
case 'N':
|
||||||
|
--- sc-7.16.orig/sc.h
|
||||||
|
+++ sc-7.16/sc.h
|
||||||
|
@@ -612,6 +612,9 @@ extern int pagesize; /* If nonzero, use
|
||||||
|
extern int rowlimit;
|
||||||
|
extern int collimit;
|
||||||
|
|
||||||
|
+void yankr(struct ent *v1, struct ent *v2);
|
||||||
|
+
|
||||||
|
+
|
||||||
|
#if BSD42 || SYSIII
|
||||||
|
|
||||||
|
#ifndef cbreak
|
||||||
|
--- sc-7.16.orig/screen.c
|
||||||
|
+++ sc-7.16/screen.c
|
||||||
|
@@ -234,11 +234,12 @@ update(int anychanged) /* did any cell
|
||||||
|
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 @@ update(int anychanged) /* did any cell
|
||||||
|
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 @@ update(int anychanged) /* did any cell
|
||||||
|
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 @@ update(int anychanged) /* did any cell
|
||||||
|
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++;
|
||||||
|
--- sc-7.16.orig/sort.c
|
||||||
|
+++ sc-7.16/sort.c
|
||||||
|
@@ -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);
|
||||||
|
--- sc-7.16.orig/vi.c
|
||||||
|
+++ sc-7.16/vi.c
|
||||||
|
@@ -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 @@ void gotobottom();
|
||||||
|
|
||||||
|
#define istext(a) (isalnum(a) || ((a) == '_'))
|
||||||
|
|
||||||
|
-#define bool int
|
||||||
|
+/*#define bool int*/
|
||||||
|
#define true 1
|
||||||
|
#define false 0
|
||||||
|
|
||||||
|
@@ -667,8 +669,10 @@ dotab()
|
||||||
|
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 @@ void
|
||||||
|
showdr()
|
||||||
|
{
|
||||||
|
int minsr, minsc, maxsr, maxsc;
|
||||||
|
- char *p;
|
||||||
|
+ /*char *p;*/
|
||||||
|
char r[12];
|
||||||
|
struct frange *fr = find_frange(currow, curcol);
|
||||||
|
|
||||||
|
@@ -1566,7 +1570,7 @@ static void
|
||||||
|
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 @@ to_char(int arg, int n)
|
||||||
|
static void
|
||||||
|
match_paren()
|
||||||
|
{
|
||||||
|
- register int i;
|
||||||
|
+ /*register int i;*/
|
||||||
|
int nest = 1;
|
||||||
|
int tmp = linelim;
|
||||||
|
|
||||||
|
--- sc-7.16.orig/vmtbl.c
|
||||||
|
+++ sc-7.16/vmtbl.c
|
||||||
|
@@ -16,6 +16,7 @@
|
||||||
|
# include <curses.h>
|
||||||
|
#endif /* PSC */
|
||||||
|
|
||||||
|
+#include <unistd.h>
|
||||||
|
#include "sc.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
--- sc-7.16.orig/xmalloc.c
|
||||||
|
+++ sc-7.16/xmalloc.c
|
||||||
|
@@ -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
|
13
call_function_not_take_its_address.patch
Normal file
13
call_function_not_take_its_address.patch
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
Index: sc/screen.c
|
||||||
|
===================================================================
|
||||||
|
--- sc.orig/screen.c 2011-09-26 23:17:21.000000000 -0500
|
||||||
|
+++ sc/screen.c 2014-05-18 15:01:24.170035634 -0500
|
||||||
|
@@ -874,7 +874,7 @@
|
||||||
|
}
|
||||||
|
} /* else */
|
||||||
|
} else
|
||||||
|
- if (!*pp && color && has_colors && cr && cr->r_color != 1) {
|
||||||
|
+ if (!*pp && color && has_colors() && cr && cr->r_color != 1) {
|
||||||
|
move(r, c);
|
||||||
|
color_set(cr->r_color, NULL);
|
||||||
|
printw("%*s", fwidth[col], " ");
|
74
format_security_fixes.patch
Normal file
74
format_security_fixes.patch
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
--- sc-7.16/sc.c.orig 2014-11-05 16:27:19.470812738 +0000
|
||||||
|
+++ sc-7.16/sc.c 2014-11-05 16:29:14.753177024 +0000
|
||||||
|
@@ -511,7 +511,7 @@
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- if (redraw) printf(redraw);
|
||||||
|
+ if (redraw) printf("%s", redraw);
|
||||||
|
exit (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
--- sc-7.16/sc.h.orig 2014-11-05 16:47:04.184019270 +0000
|
||||||
|
+++ sc-7.16/sc.h 2014-11-05 16:48:20.217944078 +0000
|
||||||
|
@@ -41,9 +41,9 @@
|
||||||
|
#define COLFORMATS 10 /* Number of custom column formats */
|
||||||
|
#define DELBUFSIZE 40 /* Number of named buffers + 4 */
|
||||||
|
#ifdef PSC
|
||||||
|
-# define error(msg) fprintf(stderr, msg);
|
||||||
|
+# define error(format, msg...) fprintf(stderr, format, ## msg);
|
||||||
|
#else
|
||||||
|
-# define error isatty(fileno(stdout)) && !move(1,0) && !clrtoeol() && printw
|
||||||
|
+# define error(format, msg...) (void)(isatty(fileno(stdout)) && !move(1,0) && !clrtoeol() && printw(format, ## msg))
|
||||||
|
#endif
|
||||||
|
#define FBUFLEN 1024 /* buffer size for a single field */
|
||||||
|
#define PATHLEN 1024 /* maximum path length */
|
||||||
|
--- sc-7.16/vmtbl.c.orig 2014-11-05 16:50:49.449833798 +0000
|
||||||
|
+++ sc-7.16/vmtbl.c 2014-11-05 16:52:54.254068948 +0000
|
||||||
|
@@ -56,7 +56,7 @@
|
||||||
|
newptr = (type *)scxrealloc((char *)oldptr, \
|
||||||
|
(unsigned)(nelem * sizeof(type))); \
|
||||||
|
if (newptr == (type *)NULL) { \
|
||||||
|
- error(msg); \
|
||||||
|
+ error("%s", msg); \
|
||||||
|
return (FALSE); \
|
||||||
|
} \
|
||||||
|
oldptr = newptr /* wait incase we can't alloc */
|
||||||
|
@@ -118,7 +118,7 @@
|
||||||
|
if ((rowcol == GROWCOL) || (rowcol == GROWBOTH)) {
|
||||||
|
if ((rowcol == GROWCOL) && ((maxcols == ABSMAXCOLS) ||
|
||||||
|
(topcol >= ABSMAXCOLS))) {
|
||||||
|
- error(nowider);
|
||||||
|
+ error("%s", nowider);
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -173,7 +173,7 @@
|
||||||
|
for (i = 0; i < maxrows; i++) {
|
||||||
|
if ((tbl[i] = (struct ent **)scxrealloc((char *)tbl[i],
|
||||||
|
(unsigned)(newcols * sizeof(struct ent **)))) == (struct ent **)0) {
|
||||||
|
- error(nowider);
|
||||||
|
+ error("%s", nowider);
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
for (nullit = ATBL(tbl, i, maxcols), cnt = 0;
|
||||||
|
@@ -191,7 +191,7 @@
|
||||||
|
for (; i < newrows; i++) {
|
||||||
|
if ((tbl[i] = (struct ent **)scxmalloc((unsigned)(newcols *
|
||||||
|
sizeof(struct ent **)))) == (struct ent **)0) {
|
||||||
|
- error(nowider);
|
||||||
|
+ error("%s", nowider);
|
||||||
|
return(FALSE);
|
||||||
|
}
|
||||||
|
for (nullit = tbl[i], cnt = 0; cnt < newcols; cnt++, nullit++)
|
||||||
|
--- sc-7.16/gram.y.orig 2014-11-05 17:03:00.427505246 +0000
|
||||||
|
+++ sc-7.16/gram.y 2014-11-05 17:03:31.097072485 +0000
|
||||||
|
@@ -1010,7 +1010,7 @@
|
||||||
|
| S_PLUGOUT STRING '=' STRING
|
||||||
|
{ addplugin($2, $4, 'w'); }
|
||||||
|
| PLUGIN { *line = '|';
|
||||||
|
- sprintf(line + 1, $1);
|
||||||
|
+ sprintf(line + 1, "%s", $1);
|
||||||
|
readfile(line, 0);
|
||||||
|
scxfree($1); }
|
||||||
|
| /* nothing */
|
154
function_definitions.patch
Normal file
154
function_definitions.patch
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
Index: sc/Makefile
|
||||||
|
===================================================================
|
||||||
|
--- sc.orig/Makefile 2014-05-18 14:18:57.049996065 -0500
|
||||||
|
+++ sc/Makefile 2014-05-18 14:20:54.953997896 -0500
|
||||||
|
@@ -336,7 +336,7 @@
|
||||||
|
# real effect on the reliability of the program, but may concern some
|
||||||
|
# people who don't understand them.
|
||||||
|
#CFLAGS=-DSYSV3 -O2 -Wall -pipe
|
||||||
|
-CFLAGS=-DSYSV3 -O2 -pipe
|
||||||
|
+CFLAGS=-DSYSV3 -O2 -pipe -g
|
||||||
|
LIB=-lm -lncurses
|
||||||
|
|
||||||
|
# All of the source files
|
||||||
|
Index: sc/cmds.c
|
||||||
|
===================================================================
|
||||||
|
--- sc.orig/cmds.c 2014-05-18 14:18:57.049996065 -0500
|
||||||
|
+++ sc/cmds.c 2014-05-18 14:20:54.953997896 -0500
|
||||||
|
@@ -2406,7 +2406,7 @@
|
||||||
|
} else {
|
||||||
|
switch (e->op) {
|
||||||
|
case 'v':
|
||||||
|
- if (e->e.v.vp->flags & is_cleared) {
|
||||||
|
+ if (e->e.v.vp->flags & flag_is_cleared) {
|
||||||
|
e->op = ERR_;
|
||||||
|
e->e.o.left = NULL;
|
||||||
|
e->e.o.right = NULL;
|
||||||
|
Index: sc/help.c
|
||||||
|
===================================================================
|
||||||
|
--- sc.orig/help.c 2014-05-18 14:18:57.049996065 -0500
|
||||||
|
+++ sc/help.c 2014-05-18 14:20:54.957997896 -0500
|
||||||
|
@@ -15,6 +15,8 @@
|
||||||
|
#include "sc.h"
|
||||||
|
#endif /* QREF */
|
||||||
|
|
||||||
|
+#include <stdlib.h>
|
||||||
|
+
|
||||||
|
char *intro[] = {
|
||||||
|
" ",
|
||||||
|
#if defined(QREF) && defined(TROFF)
|
||||||
|
Index: sc/interp.c
|
||||||
|
===================================================================
|
||||||
|
--- sc.orig/interp.c 2014-05-18 14:18:57.049996065 -0500
|
||||||
|
+++ sc/interp.c 2014-05-18 14:20:54.957997896 -0500
|
||||||
|
@@ -2159,7 +2159,7 @@
|
||||||
|
n->v = start;
|
||||||
|
start += inc;
|
||||||
|
n->flags |= (is_changed|is_valid);
|
||||||
|
- n->flags &= ~(is_cleared);
|
||||||
|
+ n->flags &= ~(flag_is_cleared);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (calc_order == BYCOLS) {
|
||||||
|
@@ -2170,7 +2170,7 @@
|
||||||
|
n->v = start;
|
||||||
|
start += inc;
|
||||||
|
n->flags |= (is_changed|is_valid);
|
||||||
|
- n->flags &= ~(is_cleared);
|
||||||
|
+ n->flags &= ~(flag_is_cleared);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else error(" Internal error calc_order");
|
||||||
|
@@ -2461,7 +2461,7 @@
|
||||||
|
if (v->format)
|
||||||
|
scxfree(v->format);
|
||||||
|
v->format = NULL;
|
||||||
|
- v->flags = (is_changed|is_cleared);
|
||||||
|
+ v->flags = (is_changed|flag_is_cleared);
|
||||||
|
changed++;
|
||||||
|
modflg++;
|
||||||
|
}
|
||||||
|
Index: sc/sc.c
|
||||||
|
===================================================================
|
||||||
|
--- sc.orig/sc.c 2014-05-18 14:18:57.049996065 -0500
|
||||||
|
+++ sc/sc.c 2014-05-18 14:20:54.957997896 -0500
|
||||||
|
@@ -84,15 +84,6 @@
|
||||||
|
int wasforw = FALSE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
-void update();
|
||||||
|
-void repaint();
|
||||||
|
-extern void doshell();
|
||||||
|
-extern void gohome();
|
||||||
|
-extern void leftlimit();
|
||||||
|
-extern void rightlimit();
|
||||||
|
-extern void gototop();
|
||||||
|
-extern void gotobottom();
|
||||||
|
-
|
||||||
|
char curfile[PATHLEN];
|
||||||
|
char revmsg[80];
|
||||||
|
|
||||||
|
@@ -165,7 +156,7 @@
|
||||||
|
if (*pp == NULL) {
|
||||||
|
if (freeents != NULL) {
|
||||||
|
*pp = freeents;
|
||||||
|
- (*pp)->flags &= ~is_cleared;
|
||||||
|
+ (*pp)->flags &= ~flag_is_cleared;
|
||||||
|
(*pp)->flags |= may_sync;
|
||||||
|
freeents = freeents->next;
|
||||||
|
} else
|
||||||
|
@@ -827,7 +818,7 @@
|
||||||
|
break;
|
||||||
|
case 'c':
|
||||||
|
showcell = (!showcell);
|
||||||
|
- repaint(lastmx, lastmy, fwidth[lastcol]);
|
||||||
|
+ repaint(lastmx, lastmy, fwidth[lastcol], 0, A_STANDOUT);
|
||||||
|
error("Cell highlighting %sabled.",
|
||||||
|
showcell ? "en" : "dis");
|
||||||
|
--modflg; /* negate the modflg++ */
|
||||||
|
Index: sc/sc.h
|
||||||
|
===================================================================
|
||||||
|
--- sc.orig/sc.h 2014-05-18 14:18:57.049996065 -0500
|
||||||
|
+++ sc/sc.h 2014-05-18 14:20:54.957997896 -0500
|
||||||
|
@@ -304,7 +304,7 @@
|
||||||
|
#define is_deleted 0020
|
||||||
|
#define is_locked 0040
|
||||||
|
#define is_label 0100
|
||||||
|
-#define is_cleared 0200
|
||||||
|
+#define flag_is_cleared 0200
|
||||||
|
#define may_sync 0400
|
||||||
|
|
||||||
|
/* cell error (1st generation (ERROR) or 2nd+ (INVALID)) */
|
||||||
|
@@ -630,3 +630,14 @@
|
||||||
|
#else
|
||||||
|
#include <memory.h>
|
||||||
|
#endif
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+void update(int anychanged);
|
||||||
|
+void repaint(int x, int y, int len, int attron, int attroff);
|
||||||
|
+
|
||||||
|
+void doshell();
|
||||||
|
+void gohome();
|
||||||
|
+void leftlimit();
|
||||||
|
+void rightlimit();
|
||||||
|
+void gototop();
|
||||||
|
+void gotobottom();
|
||||||
|
Index: sc/vi.c
|
||||||
|
===================================================================
|
||||||
|
--- sc.orig/vi.c 2014-05-18 14:18:57.049996065 -0500
|
||||||
|
+++ sc/vi.c 2014-05-18 14:20:54.961997896 -0500
|
||||||
|
@@ -33,13 +33,6 @@
|
||||||
|
char *regex();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
-void doshell();
|
||||||
|
-void gohome();
|
||||||
|
-void leftlimit();
|
||||||
|
-void rightlimit();
|
||||||
|
-void gototop();
|
||||||
|
-void gotobottom();
|
||||||
|
-
|
||||||
|
#define istext(a) (isalnum(a) || ((a) == '_'))
|
||||||
|
|
||||||
|
/*#define bool int*/
|
58
sc.spec
Normal file
58
sc.spec
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
Name: sc
|
||||||
|
Version: 7.16
|
||||||
|
Release: 1%{?dist}
|
||||||
|
Summary: Spreadsheet Calculator
|
||||||
|
|
||||||
|
License: Public Domain
|
||||||
|
URL: http://www.ibiblio.org/pub/Linux/apps/financial/spreadsheet/!INDEX.html
|
||||||
|
Source0: http://www.ibiblio.org/pub/Linux/apps/financial/spreadsheet/sc-%{version}.tar.gz
|
||||||
|
|
||||||
|
# These patches are from Debian, see:
|
||||||
|
# http://anonscm.debian.org/cgit/collab-maint/sc.git/tree/debian/patches?id=8d75b0ec9f761b5d5245290a79a20b409c442d52
|
||||||
|
Patch0: Upstream-changes-from-old-versions.patch
|
||||||
|
Patch1: function_definitions.patch
|
||||||
|
Patch2: call_function_not_take_its_address.patch
|
||||||
|
|
||||||
|
# Patch for http://fedoraproject.org/wiki/Changes/FormatSecurity
|
||||||
|
Patch3: format_security_fixes.patch
|
||||||
|
|
||||||
|
BuildRequires: bison
|
||||||
|
BuildRequires: ncurses-devel
|
||||||
|
|
||||||
|
%description
|
||||||
|
Spreadsheet Calculator is a free curses-based spreadsheet program that uses key
|
||||||
|
bindings similar to vi and less.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup
|
||||||
|
|
||||||
|
%build
|
||||||
|
make all sc.1 psc.1 %{?_smp_mflags} CFLAGS="%{optflags} -DSYSV3"
|
||||||
|
|
||||||
|
%install
|
||||||
|
# The "install" target of upstream's makefile does not work, so install manually
|
||||||
|
|
||||||
|
# Binaries
|
||||||
|
install -d -m 0755 %{buildroot}%{_bindir}
|
||||||
|
install -m 0755 sc %{buildroot}%{_bindir}
|
||||||
|
install -m 0755 psc %{buildroot}%{_bindir}
|
||||||
|
|
||||||
|
# Man pages
|
||||||
|
install -d -m 0755 %{buildroot}%{_mandir}/man1
|
||||||
|
install -m 0644 sc.1 %{buildroot}%{_mandir}/man1
|
||||||
|
install -m 0644 psc.1 %{buildroot}%{_mandir}/man1
|
||||||
|
|
||||||
|
# Data
|
||||||
|
install -d -m 0755 %{buildroot}%{_datadir}/sc
|
||||||
|
install -m 0644 tutorial.sc %{buildroot}%{_datadir}/sc
|
||||||
|
|
||||||
|
%files
|
||||||
|
%doc CHANGES README SC.MACROS TODO
|
||||||
|
%{_bindir}/*
|
||||||
|
%{_mandir}/man1/*
|
||||||
|
%{_datadir}/sc
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Wed Nov 05 2014 Mat Booth <mat.booth@redhat.com> - 7.16-1
|
||||||
|
- Initial version of sc package
|
||||||
|
|
Loading…
Reference in New Issue
Block a user