home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
pc.louisiana.edu/pub/unix/
/
Louisiana_UNIX.tar
/
Louisiana_UNIX
/
xspread.sc.y2k.patch
< prev
next >
Wrap
Text File
|
1999-09-11
|
5KB
|
165 lines
The following context diff allows xspread 2.1 to display a date value using
four year digits, provided that the format has a precision value of 4, and
the width value is sufficient to contain the result, e.g. f20,4,3
Similar changes can be made to sc 6.21.
-- James Dugal, jpd@usl.edu
--------------------------------------------------------------------------
*** format.c.orig Fri Sep 3 19:51:31 1999
--- format.c Fri Sep 3 20:03:01 1999
***************
*** 495,500 ****
--- 495,501 ----
* David Fox - added a date format
* Philemon W. Johnson <pjohnson@itd.nrl.navy.mil>
* added exponent format, 19 July 92
+ * 4-digit date added, when precision is set to 4: jpd@usl.edu
*
* This routine takes a value and formats it using fixed, scientific,
* engineering notation, date, or exponent (modulo 3). The format command
***************
*** 503,509 ****
* 0: Fixed point (default) 0.00010
* 1: Scientific 1.00E-04
* 2: Engineering 100.00u
! * 3: Date 05/15/92
* 4: Exponent, modulo 3 100.E-06
*
* The format command 'f' now uses three values. The first two are the
--- 504,510 ----
* 0: Fixed point (default) 0.00010
* 1: Scientific 1.00E-04
* 2: Engineering 100.00u
! * 3: Date 15 May 92 or 15 May 1992
* 4: Exponent, modulo 3 100.E-06
*
* The format command 'f' now uses three values. The first two are the
***************
*** 577,583 ****
case REFMTDATE:
{
int i;
! char *time;
long int secs;
/*
* sure hope that this is an 8 bit per character machine
--- 578,584 ----
case REFMTDATE:
{
int i;
! char *temp_time;
long int secs;
/*
* sure hope that this is an 8 bit per character machine
***************
*** 594,611 ****
else
{
secs = (time_t) val;
! time = ctime (&secs);
! buf[0] = time[8];
! buf[1] = time[9];
buf[2] = ' ';
! buf[3] = time[4];
! buf[4] = time[5];
! buf[5] = time[6];
buf[6] = ' ';
! buf[7] = time[22];
! buf[8] = time[23];
! for (i = 9; i < width; i++)
! buf[i] = ' ';
buf[i] = '\0';
}
}
--- 595,617 ----
else
{
secs = (time_t) val;
! temp_time = ctime (&secs);
! buf[0] = temp_time[8];
! buf[1] = temp_time[9];
buf[2] = ' ';
! buf[3] = temp_time[4];
! buf[4] = temp_time[5];
! buf[5] = temp_time[6];
buf[6] = ' ';
! i = 7;
! if (lprecision == 4 && width > 10) { /* use 4-digit year */
! buf[i++] = temp_time[20];
! buf[i++] = temp_time[21];
! }
! buf[i++] = temp_time[22];
! buf[i++] = temp_time[23];
! while(i < width)
! buf[i++] = ' ';
buf[i] = '\0';
}
}
The following context diff allows xspread 2.1 to process dates > 1999
(but < 2038) in the @dts function. Similar changes could be made to sc 6.21.
-- James Dugal, jpd@usl.edu
==========================================================================
*** interp.c.orig Mon Jun 1 09:38:50 1992
--- interp.c Fri Sep 3 19:35:16 1999
***************
*** 481,490 ****
register int i;
register long jdate;
! mdays[1] = 28 + (yr%4 == 0);
if (mo < 1 || mo > 12 || day < 1 || day > mdays[--mo] ||
! yr > 1999 || yr < 1970) {
error("@dts: invalid argument");
cellerror = CELLERROR;
return(0.0);
--- 481,490 ----
register int i;
register long jdate;
! mdays[1] = 28 + (yr%4 == 0); /* valid 1901 - 2099 */
if (mo < 1 || mo > 12 || day < 1 || day > mdays[--mo] ||
! yr > 2037 || yr < 1970) { /* Unix epoch=1970 overflows 32 bits in 2038 */
error("@dts: invalid argument");
cellerror = CELLERROR;
return(0.0);
***************
*** 494,500 ****
for (i=0; i<mo; i++)
jdate += mdays[i];
for (i = 1970; i < yr; i++)
! jdate += 365 + (i%4 == 0);
trial = jdate * sec_day;
--- 494,500 ----
for (i=0; i<mo; i++)
jdate += mdays[i];
for (i = 1970; i < yr; i++)
! jdate += 365 + (i%4 == 0); /* valid 1901 - 2099 */
trial = jdate * sec_day;
***************
*** 609,614 ****
--- 609,627 ----
if (!s1 && !s2)
return((double)1.0);
+
+
+ /* AJW@ansa.co.uk 20/4/94 start: treat NUL name ("") as nonexistent name */
+ 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;