summaryrefslogtreecommitdiff
path: root/time
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-03-06 03:00:08 +0000
committerRoland McGrath <roland@gnu.org>1995-03-06 03:00:08 +0000
commit933e73facc338fb81f1f72af416ea57fbf439a2f (patch)
tree1a91e86bb27602a860b65afca47cbc6a38223df4 /time
parent6408bdde65cac02ef96ae9f2b77f222b534c0e75 (diff)
downloadglibc-933e73facc338fb81f1f72af416ea57fbf439a2f.tar.gz
Sun Mar 5 19:40:13 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* locale/localeinfo.h: Rewritten for new locale system, using locale data files and with <langinfo.h> interface. * locale/setlocale.c: Rewritten to use locale data files. * langinfo.h: New file. * locale/langinfo.h: New file. * locale/nl_langinfo.c: New file. * locale/loadlocale.c: New file. * locale/lc-ctype.c: New file. * locale/lc-messages.c: New file. * locale/lc-monetary.c: New file. * locale/lc-numeric.c: New file. * locale/lc-time.c: New file. * locale/categories.def: New file. * locale/Makefile (headers): Remove localeinfo.h. (distribute): New variable; put localeinfo.h here, and categories.def. (routines): Add loadlocale. (categories): New variable. (aux): Use that to get C-category and lc-category. * ctype/ctype.h (_IS*): Use independent bits for all but _ISalnum. * locale/C-ctype.c, locale/C-messages.c: New files. * locale/C-monetary.c, locale/C-numeric.c, locale/C-time.c: Default "C" locale data updated for new locale system. * locale/C-collate.c: File removed. * locale/C-ctype_ct.c: File removed. * locale/C-ctype_mb.c: File removed. * locale/C-response.c: File removed. * locale/localeconv.c: Use _NL_CURRENT macro to access locale data. * stdio/printf_fp.c, stdio/vfprintf.c, stdio/vfscanf.c, stdlib/strtod.c, time/asctime.c, time/strftime.c: Include ../locale/localeinfo.h and use _NL_CURRENT macro to access locale data. * time/localtime.c: Don't include <localeinfo.h>. * time/tzset.c: Don't use locale items for default TZ value or "GMT" string (use "UTC"). * stdio/vfprintf.c [USE_IN_LIBIO] (PAD): Only call the function if WIDTH>0; update DONE. * malloc/malloc.c (morecore): Fix last change to calculate by blocks instead of bytes.
Diffstat (limited to 'time')
-rw-r--r--time/asctime.c8
-rw-r--r--time/localtime.c1
-rw-r--r--time/strftime.c27
-rw-r--r--time/tzset.c14
4 files changed, 24 insertions, 26 deletions
diff --git a/time/asctime.c b/time/asctime.c
index 3337c74388..644df3277f 100644
--- a/time/asctime.c
+++ b/time/asctime.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1995 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -17,7 +17,7 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
#include <ansidecl.h>
-#include <localeinfo.h>
+#include "../locale/localeinfo.h"
#include <errno.h>
#include <stdio.h>
#include <time.h>
@@ -39,9 +39,9 @@ DEFUN(asctime, (tp), CONST struct tm *tp)
if (sprintf (result, format,
(tp->tm_wday < 0 || tp->tm_wday >= 7 ?
- "???" : _time_info->abbrev_wkday[tp->tm_wday]),
+ "???" : _NL_CURRENT (LC_TIME, ABDAY_1 + tp->tm_wday)),
(tp->tm_mon < 0 || tp->tm_mon >= 12 ?
- "???" : _time_info->abbrev_month[tp->tm_mon]),
+ "???" : _NL_CURRENT (LC_TIME, ABMON_1 + tp->tm_mon)),
tp->tm_mday, tp->tm_hour, tp->tm_min,
tp->tm_sec, 1900 + tp->tm_year) < 0)
return NULL;
diff --git a/time/localtime.c b/time/localtime.c
index 3377b80197..a729b974a6 100644
--- a/time/localtime.c
+++ b/time/localtime.c
@@ -17,7 +17,6 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
#include <ansidecl.h>
-#include <localeinfo.h>
#include <stddef.h>
#include <ctype.h>
#include <stdio.h>
diff --git a/time/strftime.c b/time/strftime.c
index ccc19c72b0..625508c72e 100644
--- a/time/strftime.c
+++ b/time/strftime.c
@@ -3,7 +3,7 @@
_
*/
-/* Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -22,7 +22,7 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
#include <ansidecl.h>
-#include <localeinfo.h>
+#include "../locale/localeinfo.h"
#include <ctype.h>
#include <limits.h>
#include <stddef.h>
@@ -90,19 +90,20 @@ DEFUN(strftime, (s, maxsize, format, tp),
char *s AND size_t maxsize AND
CONST char *format AND register CONST struct tm *tp)
{
- CONST char *CONST a_wkday = _time_info->abbrev_wkday[tp->tm_wday];
- CONST char *CONST f_wkday = _time_info->full_wkday[tp->tm_wday];
- CONST char *CONST a_month = _time_info->abbrev_month[tp->tm_mon];
- CONST char *CONST f_month = _time_info->full_month[tp->tm_mon];
+ CONST char *CONST a_wkday = _NL_CURRENT (LC_TIME, ABDAY_1 + tp->tm_wday);
+ CONST char *CONST f_wkday = _NL_CURRENT (LC_TIME, DAY_1 + tp->tm_wday);
+ CONST char *CONST a_month = _NL_CURRENT (LC_TIME, ABMON_1 + tp->tm_mon);
+ CONST char *CONST f_month = _NL_CURRENT (LC_TIME, MON_1 + tp->tm_mon);
size_t aw_len = strlen(a_wkday);
size_t am_len = strlen(a_month);
size_t wkday_len = strlen(f_wkday);
size_t month_len = strlen(f_month);
int hour12 = tp->tm_hour;
- CONST char *CONST ampm = _time_info->ampm[hour12 >= 12];
- size_t ap_len = strlen(ampm);
- CONST unsigned int y_week0 = week(tp, 0);
- CONST unsigned int y_week1 = week(tp, 1);
+ CONST char *CONST ampm = _NL_CURRENT (LC_TIME,
+ hour12 > 12 ? PM_STR : AM_STR);
+ size_t ap_len = strlen (ampm);
+ CONST unsigned int y_week0 = week (tp, 0);
+ CONST unsigned int y_week1 = week (tp, 1);
CONST char *zone;
size_t zonelen;
register size_t i = 0;
@@ -172,7 +173,7 @@ DEFUN(strftime, (s, maxsize, format, tp),
break;
case 'c':
- subfmt = _time_info->date_time;
+ subfmt = _NL_CURRENT (LC_TIME, D_T_FMT);
subformat:
{
size_t len = strftime (p, maxsize - i, subfmt, tp);
@@ -265,11 +266,11 @@ DEFUN(strftime, (s, maxsize, format, tp),
break;
case 'X':
- subfmt = _time_info->time;
+ subfmt = _NL_CURRENT (LC_TIME, T_FMT);
goto subformat;
case 'x':
- subfmt = _time_info->date;
+ subfmt = _NL_CURRENT (LC_TIME, D_FMT);
goto subformat;
case 'Y':
diff --git a/time/tzset.c b/time/tzset.c
index e4d5209e88..3eac151f22 100644
--- a/time/tzset.c
+++ b/time/tzset.c
@@ -17,7 +17,6 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
#include <ansidecl.h>
-#include <localeinfo.h>
#include <ctype.h>
#include <stddef.h>
#include <stdio.h>
@@ -112,21 +111,20 @@ DEFUN_VOID(__tzset)
}
if (tz == NULL || *tz == '\0')
- tz = _time_info->tz;
- if (tz == NULL || *tz == '\0')
{
__tzfile_read((char *) NULL);
if (!__use_tzfile)
{
- size_t len = strlen(_time_info->ut0) + 1;
+ const char UTC[] = "UTC";
+ size_t len = sizeof UTC;
tz_rules[0].name = (char *) malloc(len);
if (tz_rules[0].name == NULL)
return;
tz_rules[1].name = (char *) malloc(len);
if (tz_rules[1].name == NULL)
return;
- memcpy((PTR) tz_rules[0].name, _time_info->ut0, len);
- memcpy((PTR) tz_rules[1].name, _time_info->ut0, len);
+ memcpy ((PTR) tz_rules[0].name, UTC, len);
+ memcpy ((PTR) tz_rules[1].name, UTC, len);
tz_rules[0].type = tz_rules[1].type = J0;
tz_rules[0].m = tz_rules[0].n = tz_rules[0].d = 0;
tz_rules[1].m = tz_rules[1].n = tz_rules[1].d = 0;
@@ -139,7 +137,7 @@ DEFUN_VOID(__tzset)
return;
}
- /* Clear out old state and reset to unnamed GMT. */
+ /* Clear out old state and reset to unnamed UTC. */
memset (tz_rules, 0, sizeof tz_rules);
tz_rules[0].name = tz_rules[1].name = (char *) "";
@@ -165,7 +163,7 @@ DEFUN_VOID(__tzset)
tz += l;
- /* Figure out the standard offset from GMT. */
+ /* Figure out the standard offset from UTC. */
if (*tz == '\0' || (*tz != '+' && *tz != '-' && !isdigit(*tz)))
return;