[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-gnulib] strftime merge from Emacs
From: |
Dave Love |
Subject: |
[Bug-gnulib] strftime merge from Emacs |
Date: |
Wed, 04 Jun 2003 22:43:17 +0100 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.2 (gnu/linux) |
I merged these from Emacs (and pending changes thereto). Is the
copyright notice meant to be GPL rather than LGPL?
2003-06-04 Dave Love <address@hidden>
[From Emacs]
* strftime.c: Change some #if to #ifdef.
[__hpux]: Include sys/_mbstate_t.h.
(mbsinit): Define as no-op if not available.
[!__P]: Use PROTOTYPES.
[USE_CRT_DLL]: Remove unnecessary extern, which screws up
dllimport attributes.
(my_strftime): Don't special-case Emacs.
[WINDOWSNT]: Don't apply Solaris 2.5 work-around on Windows.
(my_strftime) [STRFTIME_NO_POSIX2]: Handle %h when underlying
strftime does not.
(emacs_strftimeu): Undef ut.
Index: strftime.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/strftime.c,v
retrieving revision 1.69
diff -u -p -r1.69 strftime.c
--- strftime.c 12 May 2003 08:20:29 -0000 1.69
+++ strftime.c 4 Jun 2003 20:01:53 -0000
@@ -1,7 +1,8 @@
-/* Copyright (C) 1991-1999, 2000, 2001, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,94,95,96,97,98,99,2000,2001,2003
+ Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C
Library.
- Bugs can be reported to address@hidden
+ Bugs can be reported to address@hidden
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
@@ -36,10 +37,6 @@
# include "../locale/localeinfo.h"
#endif
-#if defined emacs && !defined HAVE_BCOPY
-# define HAVE_MEMCPY 1
-#endif
-
#include <ctype.h>
#include <sys/types.h> /* Some systems define `time_t' here. */
@@ -54,8 +51,10 @@
# endif
#endif
#if HAVE_TZNAME
+#ifndef USE_CRT_DLL
extern char *tzname[];
#endif
+#endif
/* Do multibyte processing if multibytes are supported, unless
multibyte sequences are safe in formats. Multibyte sequences are
@@ -68,6 +67,12 @@ extern char *tzname[];
#if DO_MULTIBYTE
# if HAVE_MBRLEN
# include <wchar.h>
+# if __hpux
+# include <sys/_mbstate_t.h>
+# endif
+# if !defined (mbsinit) && !defined (HAVE_MBSINIT)
+# define mbsinit(ps) 1
+# endif /* !defined (mbsinit) && !defined (HAVE_MBSINIT) */
# else
/* Simulate mbrlen with mblen as best we can. */
# define mbstate_t int
@@ -77,11 +82,11 @@ extern char *tzname[];
static const mbstate_t mbstate_zero;
#endif
-#if HAVE_LIMITS_H
+#ifdef HAVE_LIMITS_H
# include <limits.h>
#endif
-#if STDC_HEADERS
+#ifdef STDC_HEADERS
# include <stddef.h>
# include <stdlib.h>
# include <string.h>
@@ -124,7 +129,7 @@ extern char *tzname[];
#endif
#ifndef __P
-# if defined __GNUC__ || (defined __STDC__ && __STDC__)
+# if defined __GNUC__ || (defined __STDC__ && __STDC__) || defined (PROTOTYPES)
# define __P(args) args
# else
# define __P(args) ()
@@ -466,12 +471,7 @@ static CHAR_T const month_name[][10] =
/* When compiling this file, GNU applications can #define my_strftime
to a symbol (typically nstrftime) to get an extended strftime with
- extra arguments UT and NS. Emacs is a special case for now, but
- this Emacs-specific code can be removed once Emacs's config.h
- defines my_strftime. */
-#if defined emacs && !defined my_strftime
-# define my_strftime nstrftime
-#endif
+ extra arguments UT and NS. */
#ifdef my_strftime
# define extra_args , ut, ns
@@ -493,7 +493,7 @@ static CHAR_T const month_name[][10] =
# define ns 0
#endif
-#if !defined _LIBC && HAVE_TZNAME && HAVE_TZSET
+#if !defined _LIBC && !defined(WINDOWSNT) && HAVE_TZNAME && HAVE_TZSET
/* Solaris 2.5 tzset sometimes modifies the storage returned by localtime.
Work around this bug by copying *tp before it might be munged. */
size_t _strftime_copytm __P ((char *, size_t, const char *,
@@ -905,24 +905,31 @@ my_strftime (s, maxsize, format, tp extr
size_t strftime ();
# endif
- *u++ = '%';
- if (modifier != 0)
- *u++ = modifier;
- *u++ = format_char;
- *u = '\0';
- len = strftime (ubuf, sizeof ubuf, ufmt, tp);
- if (len == 0 && ubuf[0] != '\0')
- return 0;
- cpy (len, ubuf);
- }
- break;
-#endif
-
- case L_('C'):
- if (modifier == L_('O'))
- goto bad_format;
- if (modifier == L_('E'))
- {
+#ifdef STRFTIME_NO_POSIX2
+ /* Some system libraries do not support the POSIX.2 extensions.
+ In those cases, convert %h to %b, and strip modifiers. */
+ modifier = 0;
+ if (format_char == 'h')
+ format_char = 'b';
+#endif
+ *u++ = '%';
+ if (modifier != 0)
+ *u++ = modifier;
+ *u++ = format_char;
+ *u = '\0';
+ len = strftime (ubuf, sizeof ubuf, ufmt, tp);
+ if (len == 0 && ubuf[0] != '\0')
+ return 0;
+ cpy (len, ubuf);
+ }
+ break;
+#endif
+
+ case L_('C'):
+ if (modifier == L_('O'))
+ goto bad_format;
+ if (modifier == L_('E'))
+ {
#if HAVE_STRUCT_ERA_ENTRY
struct era_entry *era = _nl_get_era_entry (tp HELPER_LOCALE_ARG);
if (era)
@@ -1468,6 +1475,7 @@ libc_hidden_def (my_strftime)
#ifdef emacs
+#undef ut
/* For Emacs we have a separate interface which corresponds to the normal
strftime function plus the ut argument, but without the ns argument. */
size_t
- [Bug-gnulib] strftime merge from Emacs,
Dave Love <=
- Re: [Bug-gnulib] strftime merge from Emacs, Jim Meyering, 2003/06/05
- Re: [Bug-gnulib] strftime merge from Emacs, Paul Eggert, 2003/06/05
- Re: [Bug-gnulib] strftime merge from Emacs, Dave Love, 2003/06/05
- Re: [Bug-gnulib] strftime merge from Emacs, Jim Meyering, 2003/06/05
- Re: [Bug-gnulib] strftime merge from Emacs, Paul Eggert, 2003/06/05
- [Bug-gnulib] access to Solaris2.5 system? [Re: strftime merge from Emacs, Jim Meyering, 2003/06/06
- [Bug-gnulib] Re: access to Solaris2.5 system? [Re: strftime merge from Emacs, Paul Eggert, 2003/06/07
- Re: [Bug-gnulib] Re: access to Solaris2.5 system? [Re: strftime merge from Emacs, Jim Meyering, 2003/06/07
- Re: [Bug-gnulib] Re: access to Solaris2.5 system? [Re: strftime merge from Emacs, Paul Eggert, 2003/06/09