From 933e73facc338fb81f1f72af416ea57fbf439a2f Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 6 Mar 1995 03:00:08 +0000 Subject: Sun Mar 5 19:40:13 1995 Roland McGrath * locale/localeinfo.h: Rewritten for new locale system, using locale data files and with 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 . * 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. --- time/asctime.c | 8 ++++---- time/localtime.c | 1 - time/strftime.c | 27 ++++++++++++++------------- time/tzset.c | 14 ++++++-------- 4 files changed, 24 insertions(+), 26 deletions(-) (limited to 'time') diff --git a/time/asctime.c b/time/asctime.c index 3337c74..644df32 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 -#include +#include "../locale/localeinfo.h" #include #include #include @@ -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 3377b80..a729b97 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 -#include #include #include #include diff --git a/time/strftime.c b/time/strftime.c index ccc19c7..625508c 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 -#include +#include "../locale/localeinfo.h" #include #include #include @@ -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 e4d5209..3eac151 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 -#include #include #include #include @@ -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; -- cgit v1.1