SCCS-vsn: usr.sbin/sendmail/src/arpadate.c 8.2
-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"
** 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;
register struct tm *lt;
time_t t;
struct tm gmt;
register struct tm *lt;
time_t t;
struct tm gmt;
+ char *tz;
+ static char b[43 + TZNAME_MAX];
off += 24 * 60;
*q++ = ' ';
off += 24 * 60;
*q++ = ' ';
*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)
+ {
*q++ = '+';
if (off >= 24*60) /* should be impossible */
*q++ = '+';
if (off >= 24*60) /* should be impossible */
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++ = ')';
+ }