--- ./sc.h Mon Jun 1 10:38:51 1992 +++ ../src/./sc.h Tue Jan 11 14:12:01 2000 @@ -282,7 +282,9 @@ extern int cwritefile(); extern int engformat(); extern int etype(); +#ifndef __sgi extern int fork(); +#endif extern int format(); extern int get_rcqual(); extern int growtbl(); --- ./Makefile Mon Jun 1 12:38:06 1992 +++ ../src/./Makefile Tue Jan 11 14:09:16 2000 @@ -18,7 +18,7 @@ # This is where the install step puts it. #EXDIR=/site/bin -EXDIR=/usr/local/bin +EXDIR=/usr/freeware/bin # This is where the man page goes. #MANDIR=/usr/local/src/man/man1 # reno @@ -29,7 +29,7 @@ # This is where the library file (tutorial) goes. #LIBDIR=/usr/local/share/$(name) # reno -LIBDIR=/usr/local/lib/$(name) +LIBDIR=/usr/freeware/lib/$(name) # Set SIMPLE for lex.c if you don't want arrow keys or lex.c blows up SIMPLE= @@ -47,8 +47,8 @@ # Set INTERNATIONAL if you need 8 bit characters. You should # not set this if you are running 5.3.0. I think it is OK in 5.3.1. -#INTERNATIONAL=-DINTERNATIONAL -INTERNATIONAL= +INTERNATIONAL=-DINTERNATIONAL +#INTERNATIONAL= # Set SIGVOID if signal routines are type void. # use: SIGVOID=-DSIGVOID for: @@ -178,11 +178,11 @@ #CFLAGS= -DSYSV2 -g -pipe -traditional # Use this for system V.3 -CFLAGS= -DSYSV3 -O -LDFLAGS= -s +#CFLAGS= -DSYSV3 -O +#LDFLAGS= -s #CFLAGS= -DSYSV3 -g #LDFLAGS= -g -LIB=-lm -lcurses -lPW +#LIB=-lm -lcurses -lPW # with gcc also use: #CC=gcc #CFLAGS= -DSYSV3 -O -pipe -traditional @@ -191,9 +191,9 @@ #YACC=bison -y -v -t -l # Use this for system V.4 -#CFLAGS= -DSYSV4 -DSYSV3 -O +CFLAGS= -DSYSV4 -DSYSV3 -O #LDFLAGS= -s -#LIB=-lm -lcurses -lgen +LIB=-lm -lcurses -lgen # with gcc also use: #CC=gcc #CFLAGS= -DSYSV3 -O -pipe @@ -399,10 +399,10 @@ shar -c -m 1000000 -f shar ${SRC} lint: sc.h sc.c lex.c gram.c interp.c cmds.c crypt.c range.c help.c \ - vi.c version.c xmalloc.c format.c vmtbl.c + vi.c version.c xmalloc.c format.c vmtbl.c lint ${LINTFLAGS} ${CFLAGS} ${SIMPLE} sc.c lex.c gram.c interp.c \ - cmds.c crypt.c range.c help.c vi.c version.c xmalloc.c format.c \ - vmtbl.c -lcurses -lm + cmds.c crypt.c range.c help.c vi.c version.c xmalloc.c format.c \ + vmtbl.c -lcurses -lm make lintqref lintqref: help.c --- ./interp.c Mon Jun 1 10:38:50 1992 +++ ../src/./interp.c Tue Jan 11 13:48:40 2000 @@ -165,7 +165,7 @@ double val; int minr, minc, maxr, maxc; { - register r,c; + register int r,c; register struct ent *p; char *pr; int x; @@ -203,7 +203,7 @@ int minr, minc, maxr, maxc; { double v; - register r,c; + register int r,c; register struct ent *p; int x; @@ -241,7 +241,7 @@ int minr, minc, maxr, maxc, offr, offc; { double v, ret = (double)0; - register r,c; + register int r,c; register struct ent *p = (struct ent *)0; int incr,incc,fndr,fndc; char *s; @@ -302,7 +302,7 @@ int minr, minc, maxr, maxc; { int v; - register r,c; + register int r,c; register struct ent *p; v = 0; @@ -321,7 +321,7 @@ int minr, minc, maxr, maxc; { double v; - register r,c; + register int r,c; register struct ent *p; v = (double)0; @@ -340,7 +340,7 @@ int minr, minc, maxr, maxc; { double v; - register r,c; + register int r,c; register struct ent *p; v = 1; @@ -359,7 +359,7 @@ int minr, minc, maxr, maxc; { double v; - register r,c,count; + register int r,c,count; register struct ent *p; v = (double)0; @@ -385,7 +385,7 @@ int minr, minc, maxr, maxc; { double lp, rp, v, nd; - register r,c,n; + register int r,c,n; register struct ent *p; n = 0; @@ -414,7 +414,7 @@ int minr, minc, maxr, maxc; { double v = (double)0; - register r,c,count; + register int r,c,count; register struct ent *p; count = 0; @@ -442,7 +442,7 @@ int minr, minc, maxr, maxc; { double v = (double)0; - register r,c,count; + register int r,c,count; register struct ent *p; count = 0; @@ -476,62 +476,24 @@ dodts(mo, day, yr) int mo, day, yr; { - long trial; - register struct tm *tp; - register int i; - register long jdate; + time_t time; + struct tm tp; - mdays[1] = 28 + (yr%4 == 0); + tp.tm_sec = 0; /* seconds after the minute [0, 61] */ + tp.tm_min = 0; /* minutes after the hour [0, 59] */ + tp.tm_hour = 0; /* hour since midnight [0, 23] */ + tp.tm_mday = day; /* day of the month [1, 31] */ + tp.tm_mon = mo-1; /* months since January [0, 11] */ + tp.tm_year = yr-1900; /* years since 1900 */ + tp.tm_isdst = -1; /* compute dst for us... */ - if (mo < 1 || mo > 12 || day < 1 || day > mdays[--mo] || - yr > 1999 || yr < 1970) { + if ((time = mktime(&tp)) < 0) { error("@dts: invalid argument"); cellerror = CELLERROR; return(0.0); } - jdate = day-1; - for (i=0; itm_year != yr) { - /* - * We may fail this test once a year because of time zone - * and daylight savings time errors. This bounces the - * trial time past the boundary. The error introduced is - * corrected below. - */ - trial += sec_day*(yr - tp->tm_year); - tp = localtime(&trial); - } - if (tp->tm_mon != mo) { - /* We may fail this test once a month. */ - trial += sec_day*(mo - tp->tm_mon); - tp = localtime(&trial); - } - if (tp->tm_mday + tp->tm_hour + tp->tm_min + tp->tm_sec != day) { - trial -= (tp->tm_mday - day)*sec_day + tp->tm_hour*sec_hr - + tp->tm_min*sec_min + tp->tm_sec; - } - -#ifdef DEBUGDTS - tp = localtime(&trial); - if (tp->tm_mday + tp->tm_hour + tp->tm_min + tp->tm_sec + - tp->tm_year + tp->tm_mon != yr+mo+day) - { error("Dts broke down"); - cellerror = CELLERROR; - } -#endif - - return ((double)trial); + return ((double)time); } double @@ -601,6 +563,8 @@ return(v); } +/* Mods by ajw@ansa.co.uk 20/4/94 */ + double doeqs(s1, s2) char *s1, *s2; @@ -610,6 +574,18 @@ if (!s1 && !s2) return((double)1.0); +/* AJW start */ + if (!s1 && !strlen(s2)) + { scxfree(s2); + return((double)1.0); + } + + if (!s2 && !strlen(s1)) + { scxfree(s1); + return((double)1.0); + } +/* AJW end */ + if (!s1 || !s2) v = 0.0; else if (strcmp(s1, s2) == 0) @@ -740,7 +716,9 @@ num = eval(e->e.o.left); denom = eval(e->e.o.right); if (denom) -/* if (1) /* to test num div 0 */ +#if 0 + if (1) /* to test num div 0 */ +#endif return(num/denom); else { cellerror = CELLERROR; @@ -777,9 +755,9 @@ case LOOKUP: case HLOOKUP: case VLOOKUP: - { register r,c; - register maxr, maxc; - register minr, minc; + { register int r,c; + register int maxr, maxc; + register int minr, minc; maxr = e->e.o.right->e.r.right.vp -> row; maxc = e->e.o.right->e.r.right.vp -> col; minr = e->e.o.right->e.r.left.vp -> row; @@ -807,9 +785,9 @@ case REDUCE | 's': case REDUCE | MAX: case REDUCE | MIN: - { register r,c; - register maxr, maxc; - register minr, minc; + { register int r,c; + register int maxr, maxc; + register int minr, minc; maxr = e->e.r.right.vp -> row; maxc = e->e.r.right.vp -> col; minr = e->e.r.left.vp -> row; @@ -1257,9 +1235,9 @@ case LOWER: return(docase(LOWER, seval(se->e.o.right))); case CAPITAL:return(docapital(seval(se->e.o.right))); case STINDEX: - { register r,c; - register maxr, maxc; - register minr, minc; + { register int r,c; + register int maxr, maxc; + register int minr, minc; maxr = se->e.o.right->e.r.right.vp -> row; maxc = se->e.o.right->e.r.right.vp -> col; minr = se->e.o.right->e.r.left.vp -> row; @@ -1747,7 +1725,7 @@ struct ent *v1, *v2; double start, inc; { - register r,c; + register int r,c; register struct ent *n; int maxr, maxc; int minr, minc; @@ -1794,7 +1772,7 @@ lock_cells (v1, v2) struct ent *v1, *v2; { - register r,c; + register int r,c; register struct ent *n; int maxr, maxc; int minr, minc; @@ -1822,7 +1800,7 @@ unlock_cells (v1, v2) struct ent *v1, *v2; { - register r,c; + register int r,c; register struct ent *n; int maxr, maxc; int minr, minc; @@ -1970,7 +1948,7 @@ struct ent *v1, *v2; char *s; { - register r,c; + register int r,c; register struct ent *n; int maxr, maxc; int minr, minc; --- ./format.c Mon Jun 1 10:35:54 1992 +++ ../src/./format.c Tue Jan 11 13:47:11 2000 @@ -245,6 +245,7 @@ width = 0; if (decimal) { + int backslashes = 0; *decimal++ = EOS; for (cp = decimal; *cp != EOS; cp++) { @@ -252,6 +253,7 @@ { case '\\': cp++; + backslashes++; break; case '#': @@ -263,7 +265,7 @@ break; } } - zero_pad = strlen(decimal) - zero_pad; + zero_pad = strlen(decimal) - backslashes - zero_pad; } (void) sprintf(prtfmt, "%%.%dlf", width); (void) sprintf(mantissa, prtfmt, val);