include alpha time zone as 822 comment in Date: line
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Mon, 8 Aug 1994 03:27:17 +0000 (19:27 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Mon, 8 Aug 1994 03:27:17 +0000 (19:27 -0800)
SCCS-vsn: usr.sbin/sendmail/src/arpadate.c 8.2

usr/src/usr.sbin/sendmail/src/arpadate.c

index 67e0131..4695cbf 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)arpadate.c 8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)arpadate.c 8.2 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -38,6 +38,17 @@ static char sccsid[] = "@(#)arpadate.c       8.1 (Berkeley) %G%";
 **             the format is and work appropriately.
 */
 
 **             the format is and work appropriately.
 */
 
+#ifndef TZNAME_MAX
+# define TZNAME_MAX    50      /* max size of timezone */
+#endif
+
+/* values for TZ_TYPE */
+#define TZ_NONE                0       /* no character timezone support */
+#define TZ_USE_TM_NAME 1       /* use tm->tm_name */
+#define TZ_USE_TM_ZONE 2       /* use tm->tm_zone */
+#define TZ_USE_TZNAME  3       /* use tzname[] */
+#define TZ_USE_TIMEZONE        4       /* use timezone() */
+
 char *
 arpadate(ud)
        register char *ud;
 char *
 arpadate(ud)
        register char *ud;
@@ -49,7 +60,8 @@ arpadate(ud)
        register struct tm *lt;
        time_t t;
        struct tm gmt;
        register struct tm *lt;
        time_t t;
        struct tm gmt;
-       static char b[40];
+       char *tz;
+       static char b[43 + TZNAME_MAX];
 
        /*
        **  Get current time.
 
        /*
        **  Get current time.
@@ -121,15 +133,41 @@ arpadate(ud)
                off += 24 * 60;
 
        *q++ = ' ';
                off += 24 * 60;
 
        *q++ = ' ';
-       if (off == 0) {
+       if (off == 0)
+       {
                *q++ = 'G';
                *q++ = 'M';
                *q++ = 'T';
                *q++ = 'G';
                *q++ = 'M';
                *q++ = 'T';
-       } else {
-               if (off < 0) {
+       }
+       else
+       {
+               tz = NULL;
+#if TZ_TYPE == TZ_USE_TM_NAME
+               tz = lt->tm_name;
+#endif
+#if TZ_TYPE == TZ_USE_TM_ZONE
+               tz = lt->tm_zone;
+#endif
+#if TZ_TYPE == TZ_USE_TZNAME
+               {
+                       extern char *tzname[];
+
+                       tz = tzname[lt->tm_isdst];
+               }
+#endif
+#if TZ_TYPE == TZ_USE_TIMEZONE
+               {
+                       extern char *timezone();
+
+                       tz = timezone(off, lt->tm_isdst);
+               }
+#endif
+               if (off < 0)
+               {
                        off = -off;
                        *q++ = '-';
                        off = -off;
                        *q++ = '-';
-               } else
+               }
+               else
                        *q++ = '+';
 
                if (off >= 24*60)               /* should be impossible */
                        *q++ = '+';
 
                if (off >= 24*60)               /* should be impossible */
@@ -140,6 +178,14 @@ arpadate(ud)
                off %= 60;
                *q++ = (off / 10) + '0';
                *q++ = (off % 10) + '0';
                off %= 60;
                *q++ = (off / 10) + '0';
                *q++ = (off % 10) + '0';
+               if (tz != NULL && *tz != '\0')
+               {
+                       *q++ = ' ';
+                       *q++ = '(';
+                       while (*tz != '\0')
+                               *q++ = *tz++;
+                       *q++ = ')';
+               }
        }
        *q = '\0';
 
        }
        *q = '\0';