Minor misfeature in SC Version 6.8 (and correction)
Peter King
pjbk at cs.hw.ac.uk
Fri Sep 7 22:32:32 AEST 1990
Here is a minor update to the sc version 6.8 which recently appeared in
comp.sources.unix. It has the effect of making the name used to save
the spreadsheet in an emergency be x.SAVE where x is the name the
spreadsheet has. The distributed version had SC.SAVE hard-coded.
Apply this using patch or by hand.
*** sc.c.orig Fri Sep 7 13:16:59 1990
--- sc.c Fri Sep 7 13:19:41 1990
***************
*** 34,39
void exit();
#endif
#ifndef DFLT_PAGER
#define DFLT_PAGER "more" /* more is probably more widespread than less */
#endif /* DFLT_PAGER */
--- 42,51 -----
void exit();
#endif
+ #ifndef SAVENAME
+ #define SAVENAME "SC.SAVE" /* file name to use for emergency saves */
+ #endif /* SAVENAME */
+
#ifndef DFLT_PAGER
#define DFLT_PAGER "more" /* more is probably more widespread than less */
#endif /* DFLT_PAGER */
***************
*** 1560,1566
diesave()
{ char path[PATHLEN];
if (modcheck(" before Spreadsheet dies") == 1)
! { sprintf(path, "~/SC.SAVE");
if (writefile(path, 0, 0, maxrow, maxcol) < 0)
if (writefile("/tmp/SC.SAVE", 0, 0, maxrow, maxcol) < 0)
error("Couldn't save current spreadsheet, Sorry");
--- 1572,1578 -----
diesave()
{ char path[PATHLEN];
if (modcheck(" before Spreadsheet dies") == 1)
! { sprintf(path, "~/%s", SAVENAME);
if (writefile(path, 0, 0, maxrow, maxcol) < 0)
{
sprintf(path, "/tmp/%s", SAVENAME);
***************
*** 1562,1568
if (modcheck(" before Spreadsheet dies") == 1)
{ sprintf(path, "~/SC.SAVE");
if (writefile(path, 0, 0, maxrow, maxcol) < 0)
! if (writefile("/tmp/SC.SAVE", 0, 0, maxrow, maxcol) < 0)
error("Couldn't save current spreadsheet, Sorry");
}
}
--- 1574,1582 -----
if (modcheck(" before Spreadsheet dies") == 1)
{ sprintf(path, "~/%s", SAVENAME);
if (writefile(path, 0, 0, maxrow, maxcol) < 0)
! {
! sprintf(path, "/tmp/%s", SAVENAME);
! if (writefile(path, 0, 0, maxrow, maxcol) < 0)
error("Couldn't save current spreadsheet, Sorry");
}
}
***************
*** 1564,1569
if (writefile(path, 0, 0, maxrow, maxcol) < 0)
if (writefile("/tmp/SC.SAVE", 0, 0, maxrow, maxcol) < 0)
error("Couldn't save current spreadsheet, Sorry");
}
}
--- 1578,1584 -----
sprintf(path, "/tmp/%s", SAVENAME);
if (writefile(path, 0, 0, maxrow, maxcol) < 0)
error("Couldn't save current spreadsheet, Sorry");
+ }
}
}
*** Makefile.orig Thu Sep 6 12:08:30 1990
--- Makefile Thu Sep 6 12:21:32 1990
***************
*** 33,38
# then "more" will be used. "pg" may be appropriate for SYSV
PAGER=-DDFLT_PAGER=\"less\"
# Use this for system V.2
#CFLAGS= -O -DSYSV2
#LDFLAGS=
--- 33,41 -----
# then "more" will be used. "pg" may be appropriate for SYSV
PAGER=-DDFLT_PAGER=\"less\"
+ # This carries the default save name which is used to save if there is a SIGQUIT
+ SAVENAME=-DSAVENAME=\"$(NAME).SAVE\"
+
# Use this for system V.2
#CFLAGS= -O -DSYSV2
#LDFLAGS=
***************
*** 104,110
$(CC) ${CFLAGS} ${SIMPLE} ${IEEE_MATH} ${INTERNATIONAL} ${SIGVOID} -c lex.c
sc.o: sc.h sc.c
! $(CC) ${CFLAGS} ${INTERNATIONAL} ${PAGER} ${SIGVOID} -c sc.c
interp.o: interp.c sc.h
$(CC) ${CFLAGS} ${IEEE_MATH} ${SIGVOID} -c interp.c
--- 107,113 -----
$(CC) ${CFLAGS} ${SIMPLE} ${IEEE_MATH} ${INTERNATIONAL} ${SIGVOID} -c lex.c
sc.o: sc.h sc.c
! $(CC) ${CFLAGS} ${INTERNATIONAL} ${PAGER} ${SAVENAME} ${SIGVOID} -c sc.c
interp.o: interp.c sc.h
$(CC) ${CFLAGS} ${IEEE_MATH} ${SIGVOID} -c interp.c
--
Peter King, Computer Science Department JANET: pjbk at uk.ac.hw.cs
Heriot-Watt University ARPA: pjbk at cs.hw.ac.uk
79 Grassmarket, Edinburgh EH1 2HJ or pjbk%cs.hw.ac.uk at ucl-cs
Phone: (+44) 31 225 6465 Ext. 555 UUCP: ..!ukc!cs.hw.ac.uk!pjbk
More information about the Comp.sources.bugs
mailing list