scsh-users
[Top] [All Lists]

time1.c bug in scsh-0.2

To: scsh-bugs@martigny.ai.mit.edu
Subject: time1.c bug in scsh-0.2
From: brent@jade.ssd.csd.harris.com (Brent Benson)
Date: Wed, 16 Nov 94 15:01:30 -0500
Reply-to: Brent.Benson@mail.csd.harris.com
This bug shows up in scsh-0.2.

A function in time1.c initializes a structure with non-constant
initializers.  This is not allowed in ANSI C and it makes my compiler
barf.  Here is a context diff that still allows the non-ANSIism under
GNU C:

*** scsh/time1.c.orig   Wed Nov 16 14:25:06 1994
--- scsh/time1.c        Wed Nov 16 14:31:37 1994
***************
*** 185,192 ****
                       int *hi_secs, int *lo_secs)
  {
      time_t t;
-     struct tm d = {sec, min, hour, mday, month, year, 0, 0, summer};
      int error = 0;
      errno = 0; /* Have to test carefully for error return 
                   since a -1 time_t is an actual time... Ech. */
  
--- 185,208 ----
                       int *hi_secs, int *lo_secs)
  {
      time_t t;
      int error = 0;
+ #ifdef __GNUC__
+     struct tm d = {sec, min, hour, mday, month, year, 0, 0, summer};
+ #else
+     struct tm d;
+ 
+     d.tm_sec = sec;
+     d.tm_min = min;
+     d.tm_hour = hour;
+     d.tm_mday = mday;
+     d.tm_mon = month;
+     d.tm_year = year;
+     d.tm_wday = 0;
+     d.tm_yday = 0;
+     d.tm_isdst = summer;
+ #endif
+ 
+ 
      errno = 0; /* Have to test carefully for error return 
                   since a -1 time_t is an actual time... Ech. */
  


<Prev in Thread] Current Thread [Next in Thread>
  • time1.c bug in scsh-0.2, Brent Benson <=