changeset 112:f36d12551bb4

GNU shell utilities
author Jim Meyering <jim@meyering.net>
date Tue, 12 Oct 1993 01:50:00 +0000
parents 361372d725f6
children 57a0fd8d9f26
files lib/basename.c lib/getdate.y lib/mktime.c lib/posixtm.y
diffstat 4 files changed, 46 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/lib/basename.c	Mon Oct 04 21:07:56 1993 +0000
+++ b/lib/basename.c	Tue Oct 12 01:50:00 1993 +0000
@@ -15,6 +15,17 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
+#ifdef HAVE_CONFIG_H
+#if defined (CONFIG_BROKETS)
+/* We use <config.h> instead of "config.h" so that a compilation
+   using -I. -I will use ./config.h rather than /config.h
+   (which it would do because it found this file in ).  */
+#include <config.h>
+#else
+#include "config.h"
+#endif
+#endif
+
 #if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
 #include <string.h>
 #ifndef rindex
--- a/lib/getdate.y	Mon Oct 04 21:07:56 1993 +0000
+++ b/lib/getdate.y	Tue Oct 12 01:50:00 1993 +0000
@@ -41,7 +41,7 @@
 #ifdef _AIX /* for Bison */
  #pragma alloca
 #else
-char *alloca ();
+void *alloca ();
 #endif
 #endif
 #endif
--- a/lib/mktime.c	Mon Oct 04 21:07:56 1993 +0000
+++ b/lib/mktime.c	Tue Oct 12 01:50:00 1993 +0000
@@ -19,8 +19,15 @@
 Cambridge, MA 02139, USA.  */
 
 #ifdef HAVE_CONFIG_H
+#if defined (CONFIG_BROKETS)
+/* We use <config.h> instead of "config.h" so that a compilation
+   using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
+   (which it would do because it found this file in $srcdir).  */
+#include <config.h>
+#else
 #include "config.h"
 #endif
+#endif
 
 #include <sys/types.h>		/* Some systems define `time_t' here.  */
 #include <time.h>
@@ -96,14 +103,14 @@
       else if (t1->x > t2->x)						      \
 	diff_flag = 1;							      \
     }
-  
+
   doit (tm_year, 31536000);	/* Okay, not all years have 365 days.  */
   doit (tm_mon, 2592000);	/* Okay, not all months have 30 days.  */
   doit (tm_mday, 86400);
   doit (tm_hour, 3600);
   doit (tm_min, 60);
   doit (tm_sec, 1);
-  
+
 #undef doit
 
   distance = v1 - v2;
@@ -118,7 +125,7 @@
 
   return distance;
 }
-      
+
 
 /* Modified binary search -- make intelligent guesses as to where the time
    might lie along the timeline, assuming that our target time lies a
@@ -142,7 +149,7 @@
       guess += distance;
 
       guess_tm = localtime (&guess);
-      
+
 #ifdef DEBUG
       if (debugging_enabled)
 	{
@@ -151,7 +158,7 @@
 	  puts ("");
 	}
 #endif
-      
+
       /* Are we on the money?  */
       distance = dist_tm (target, guess_tm);
 
@@ -176,7 +183,7 @@
   time_t result;
 
   me = &private_mktime_struct_tm;
-  
+
   *me = *timeptr;
 
 #define normalize(foo,x,y,bar); \
@@ -190,11 +197,11 @@
       me->bar++; \
       me->foo = (x + (me->foo - y)); \
     }
-  
+
   normalize (tm_sec, 0, 59, tm_min);
   normalize (tm_min, 0, 59, tm_hour);
   normalize (tm_hour, 0, 23, tm_mday);
-  
+
   /* Do the month first, so day range can be found.  */
   normalize (tm_mon, 0, 11, tm_year);
   normalize (tm_mday, 1,
@@ -208,7 +215,7 @@
   normalize (tm_mday, 1,
 	     __mon_lengths[__isleap (me->tm_year)][me->tm_mon],
 	     tm_mon);
-  
+
 #ifdef DEBUG
   if (debugging_enabled)
     {
@@ -234,11 +241,11 @@
   int time;
   int result_time;
   struct tm *tmptr;
-  
+
   if (argc == 1)
     {
       long q;
-      
+
       printf ("starting long test...\n");
 
       for (q = 10000000; q < 1000000000; q++)
@@ -248,23 +255,23 @@
 	  if (q != my_mktime (tm))
 	    { printf ("failed for %ld\n", q); fflush (stdout); }
 	}
-      
+
       printf ("test finished\n");
 
       exit (0);
     }
-  
+
   if (argc != 2)
     {
       printf ("wrong # of args\n");
       exit (0);
     }
-  
+
   debugging_enabled = 1;	/* we want to see the info */
 
   ++argv;
   time = atoi (*argv);
-  
+
   printf ("Time: %d %s\n", time, ctime (&time));
 
   tmptr = localtime (&time);
--- a/lib/posixtm.y	Mon Oct 04 21:07:56 1993 +0000
+++ b/lib/posixtm.y	Tue Oct 12 01:50:00 1993 +0000
@@ -26,8 +26,19 @@
 #ifdef _AIX
  #pragma alloca
 #else
-char *alloca ();
+void *alloca ();
+#endif
+#endif
 #endif
+
+#ifdef HAVE_CONFIG_H
+#if defined (CONFIG_BROKETS)
+/* We use <config.h> instead of "config.h" so that a compilation
+   using -I. -I will use ./config.h rather than /config.h
+   (which it would do because it found this file in ).  */
+#include <config.h>
+#else
+#include "config.h"
 #endif
 #endif