Tue Jan 30 13:32:05 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu>

* dirent/scandir.c: Allocate dirents with correct size for name, and
	copy with correct size.

	* hurd/hurdinit.c [! PIC] (map0): New function, on _hurd_preinit_hook.

	* stdio-common/vfscanf.c (TYPEMOD): New macro of all type modifier
	flag bits.
	(__vfscanf): Fix checking of extra type modifiers.

	* time/asia, time/australasia, time/backward: Updated from ADO 96b.

Tue Jan 30 12:17:26 1996  Ulrich Drepper  <drepper@ipd.info.uni-karlsruhe.de>

	* stdlib/strtod.c: Only negate exponent when there really is one.

	* stdio-common/vfscanf.c: Accept type modifiers on %n.
	Fix FP number parsing.
This commit is contained in:
Roland McGrath 1996-01-31 10:00:24 +00:00
parent f0b1101835
commit 01cdeca0c9
9 changed files with 134 additions and 53 deletions

View File

@ -1,3 +1,23 @@
Tue Jan 30 13:32:05 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* dirent/scandir.c: Allocate dirents with correct size for name, and
copy with correct size.
* hurd/hurdinit.c [! PIC] (map0): New function, on _hurd_preinit_hook.
* stdio-common/vfscanf.c (TYPEMOD): New macro of all type modifier
flag bits.
(__vfscanf): Fix checking of extra type modifiers.
* time/asia, time/australasia, time/backward: Updated from ADO 96b.
Tue Jan 30 12:17:26 1996 Ulrich Drepper <drepper@ipd.info.uni-karlsruhe.de>
* stdlib/strtod.c: Only negate exponent when there really is one.
* stdio-common/vfscanf.c: Accept type modifiers on %n.
Fix FP number parsing.
Mon Jan 29 21:53:40 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* sysdeps/stub/msync.c (msync): Declare third arg FLAGS.

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
/* Copyright (C) 1992, 1993, 1994, 1995, 1996 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
@ -19,6 +19,7 @@ Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <dirent.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
int
@ -44,6 +45,8 @@ DEFUN(scandir, (dir, namelist, select, cmp),
while ((d = readdir (dp)) != NULL)
if (select == NULL || (*select) (d))
{
size_t dsize;
if (i == vsize)
{
struct dirent **new;
@ -61,11 +64,12 @@ DEFUN(scandir, (dir, namelist, select, cmp),
v = new;
}
v[i] = (struct dirent *) malloc (sizeof (**v));
dsize = &d->d_name[d->d_namlen + 1] - (char *) d;
v[i] = (struct dirent *) malloc (dsize);
if (v[i] == NULL)
goto lose;
*v[i++] = *d;
memcpy (v[i++], d, dsize);
}
if (errno != 0)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
/* Copyright (C) 1992, 1993, 1994, 1995, 1996 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
@ -197,3 +197,27 @@ _hurd_setproc (process_t procserver)
return 0;
}
#ifndef PIC
/* Map the page at address zero with no access allowed, so
dereferencing NULL will fault and no "anywhere" allocations
(e.g. the out of line memory containing the argument strings)
can be assigned address zero, which C says is not a valid pointer.
When dynamically linked, this will be done by the dynamic linker
before we run. */
static void map0 (void) __attribute__ ((unused));
text_set_element (_hurd_preinit_hook, map0);
static void
map0 (void)
{
vm_address_t addr = 0;
__vm_map (__mach_task_self (),
&addr, __vm_page_size, 0, 0, MACH_PORT_NULL, 0, 1,
VM_PROT_NONE, VM_PROT_NONE, VM_INHERIT_COPY);
}
#endif

View File

@ -8,7 +8,7 @@ conversion between different time representations.
The time functions fall into three main categories:
@itemize @bullet
@item
@item
Functions for measuring elapsed CPU time are discussed in @ref{Processor
Time}.
@ -102,7 +102,7 @@ by the @code{clock} function.
@comment time.h
@comment POSIX.1
@deftypevr Macro int CLK_TCK
This is an obsolete name for @code{CLOCKS_PER_SEC}.
This is an obsolete name for @code{CLOCKS_PER_SEC}.
@end deftypevr
@comment time.h
@ -195,8 +195,8 @@ according to the Gregorian calendar.
There are three representations for date and time information:
@itemize @bullet
@item
@dfn{Calendar time} (the @code{time_t} data type) is a compact
@item
@dfn{Calendar time} (the @code{time_t} data type) is a compact
representation, typically giving the number of seconds elapsed since
some implementation-specific base time.
@cindex calendar time
@ -224,7 +224,7 @@ date and time values.
* Broken-down Time:: Facilities for manipulating local time.
* Formatting Date and Time:: Converting times to strings.
* TZ Variable:: How users specify the time zone.
* Time Zone Functions:: Functions to examine or specify the time zone.
* Time Zone Functions:: Functions to examine or specify the time zone.
* Time Functions Example:: An example program showing use of some of
the time functions.
@end menu
@ -272,7 +272,7 @@ where subtraction doesn't work directly.
@deftypefun time_t time (time_t *@var{result})
The @code{time} function returns the current time as a value of type
@code{time_t}. If the argument @var{result} is not a null pointer, the
time value is also stored in @code{*@var{result}}. If the calendar
time value is also stored in @code{*@var{result}}. If the calendar
time is not available, the value @w{@code{(time_t)(-1)}} is returned.
@end deftypefun
@ -280,7 +280,7 @@ time is not available, the value @w{@code{(time_t)(-1)}} is returned.
@node High-Resolution Calendar
@subsection High-Resolution Calendar
The @code{time_t} data type used to represent calendar times has a
The @code{time_t} data type used to represent calendar times has a
resolution of only one second. Some applications need more precision.
So, the GNU C library also contains functions which are capable of
@ -436,7 +436,7 @@ You do not have privilege to set the time.
@end deftypefun
@strong{Portability Note:} The @code{gettimeofday}, @code{settimeofday},
and @code{adjtime} functions are derived from BSD.
and @code{adjtime} functions are derived from BSD.
@node Broken-down Time
@ -762,7 +762,7 @@ to get a Coordinated Universal Time value. It has syntax like
[@code{+}|@code{-}]@var{hh}[@code{:}@var{mm}[@code{:}@var{ss}]]. This
is positive if the local time zone is west of the Prime Meridian and
negative if it is east. The hour must be between @code{0} and
@code{24}, and the minute and seconds between @code{0} and @code{59}.
@code{23}, and the minute and seconds between @code{0} and @code{59}.
For example, here is how we would specify Eastern Standard Time, but
without any daylight savings time alternative:
@ -948,19 +948,19 @@ timer; when the timer expires, the process receives a signal.
Each process has three independent interval timers available:
@itemize @bullet
@item
@item
A real-time timer that counts clock time. This timer sends a
@code{SIGALRM} signal to the process when it expires.
@cindex real-time timer
@cindex timer, real-time
@item
@item
A virtual timer that counts CPU time used by the process. This timer
sends a @code{SIGVTALRM} signal to the process when it expires.
@cindex virtual timer
@cindex timer, virtual
@item
@item
A profiling timer that counts both CPU time used by the process, and CPU
time spent in system calls on behalf of the process. This timer sends a
@code{SIGPROF} signal to the process when it expires.
@ -1013,7 +1013,7 @@ Calendar}.
@comment sys/time.h
@comment BSD
@deftypefun int setitimer (int @var{which}, struct itimerval *@var{new}, struct itimerval *@var{old})
The @code{setitimer} function sets the timer specified by @var{which}
The @code{setitimer} function sets the timer specified by @var{which}
according to @var{new}. The @var{which} argument can have a value of
@code{ITIMER_REAL}, @code{ITIMER_VIRTUAL}, or @code{ITIMER_PROF}.
@ -1128,7 +1128,7 @@ specify any descriptors to wait for.
@comment POSIX.1
@deftypefun {unsigned int} sleep (unsigned int @var{seconds})
The @code{sleep} function waits for @var{seconds} or until a signal
is delivered, whichever happens first.
is delivered, whichever happens first.
If @code{sleep} function returns because the requested time has
elapsed, it returns a value of zero. If it returns because of delivery
@ -1149,7 +1149,7 @@ Instead, compute the time at which the program should stop waiting, and
keep trying to wait until that time. This won't be off by more than a
second. With just a little more work, you can use @code{select} and
make the waiting period quite accurate. (Of course, heavy system load
can cause unavoidable additional delays---unless the machine is
can cause unavoidable additional delays---unless the machine is
dedicated to one application, there is no way you can avoid this.)
On some systems, @code{sleep} can do strange things if your program uses

View File

@ -45,6 +45,8 @@ Cambridge, MA 02139, USA. */
# define GROUP 0x080 /* ': group numbers */
# define MALLOC 0x100 /* a: malloc strings */
# define TYPEMOD (LONG|LONGDBL|SHORT)
#ifdef USE_IN_LIBIO
# include <libioP.h>
@ -114,7 +116,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
register int flags; /* Modifiers for current format element. */
/* Status for reading F-P nums. */
char got_dot, got_e;
char got_dot, got_e, negative;
/* If a [...] is a [^...]. */
char not_in;
/* Base for integral numbers. */
@ -307,7 +309,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
{
case 'h':
/* int's are short int's. */
if (flags & (LONG|LONGDBL))
if (flags & TYPEMOD)
/* Signal illegal format element. */
conv_error ();
flags |= SHORT;
@ -328,12 +330,15 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
case 'q':
case 'L':
/* double's are long double's, and int's are long long int's. */
if (flags & (LONG|SHORT))
if (flags & TYPEMOD)
/* Signal illegal format element. */
conv_error ();
flags |= LONGDBL;
break;
case 'a':
if (flags & TYPEMOD)
/* Signal illegal format element. */
conv_error ();
/* String conversions (%s, %[) take a `char **'
arg and fill it in with a malloc'd pointer. */
flags |= MALLOC;
@ -363,8 +368,18 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
break;
case 'n': /* Answer number of assignments done. */
/* Corrigendum 1 to ISO C 1990 describes the allowed flags
with the 'n' conversion specifier. */
if (!(flags & SUPPRESS))
*ARG (int *) = read_in - 1; /* Don't count the read-ahead. */
/* Don't count the read-ahead. */
if (flags & LONGDBL)
*ARG (long long int *) = read_in - 1;
else if (flags & LONG)
*ARG (long int *) = read_in - 1;
else if (flags & SHORT)
*ARG (short int *) = read_in - 1;
else
*ARG (int *) = read_in - 1;
break;
case 'c': /* Match characters. */
@ -439,7 +454,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
{ \
/* We lose. Oh well. \
Terminate the string and stop converting, \
so at least we don't skip any input. */ \
so at least we don't skip any input. */ \
(*strptr)[strsize] = '\0'; \
++done; \
conv_error (); \
@ -512,7 +527,6 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
{
if (width > 0)
--width;
ADDW ('0');
(void) inchar ();
@ -612,13 +626,15 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
/* Check for a sign. */
if (c == '-' || c == '+')
{
ADDW (c);
negative = c == '-';
if (inchar () == EOF)
/* EOF is only an input error before we read any chars. */
conv_error ();
if (width > 0)
--width;
}
else
negative = 0;
got_dot = got_e = 0;
do
@ -628,7 +644,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
else if (got_e && wp[wpsize - 1] == 'e'
&& (c == '-' || c == '+'))
ADDW (c);
else if (!got_e && tolower (c) == 'e')
else if (wpsize > 0 && !got_e && tolower (c) == 'e')
{
ADDW ('e');
got_e = got_dot = 1;
@ -644,12 +660,10 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
break;
if (width > 0)
--width;
} while (inchar () != EOF && width != 0);
}
while (inchar () != EOF && width != 0);
if (wpsize == 0)
conv_error();
if (wp[wpsize - 1] == '-' || wp[wpsize - 1] == '+'
|| wp[wpsize - 1] == 'e')
conv_error ();
/* Convert the number. */
@ -658,19 +672,19 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
{
long double d = __strtold_internal (wp, &tw, flags & GROUP);
if (!(flags & SUPPRESS) && tw != wp)
*ARG (long double *) = d;
*ARG (long double *) = negative ? -d : d;
}
else if (flags & LONG)
{
double d = __strtod_internal (wp, &tw, flags & GROUP);
if (!(flags & SUPPRESS) && tw != wp)
*ARG (double *) = d;
*ARG (double *) = negative ? -d : d;
}
else
{
float d = __strtof_internal (wp, &tw, flags & GROUP);
if (!(flags & SUPPRESS) && tw != wp)
*ARG (float *) = d;
*ARG (float *) = negative ? -d : d;
}
if (tw == wp)
@ -738,7 +752,8 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
STRING_ADD_CHAR (c);
if (width > 0)
--width;
} while (inchar () != EOF && width != 0);
}
while (inchar () != EOF && width != 0);
if (read_in == num.ul)
conv_error ();

View File

@ -1,5 +1,5 @@
/* Read decimal floating point numbers.
Copyright (C) 1995 Free Software Foundation, Inc.
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
Contributed by Ulrich Drepper.
This file is part of the GNU C Library.
@ -545,12 +545,12 @@ INTERNAL (STRTOF) (nptr, endptr, group)
c = *++cp;
}
while (isdigit (c));
if (exp_negative)
exponent = -exponent;
}
else
cp = expp;
if (exp_negative)
exponent = -exponent;
}
/* We don't want to have to work with trailing zeroes after the radix. */

View File

@ -1,4 +1,4 @@
# @(#)asia 7.17
# @(#)asia 7.18
# This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to
@ -499,7 +499,7 @@ Rule Zion 1996 only - Sep 16 0:00 0:00 S
Rule Zion 1997 1998 - Oct Sun>=14 0:00 0:00 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Tel_Aviv 2:19:04 - LMT 1880
Zone Asia/Jerusalem 2:20:56 - LMT 1880
2:21 - JMT 1918
2:00 Zion I%sT

View File

@ -1,4 +1,4 @@
# @(#)australasia 7.24
# @(#)australasia 7.25
# This file also includes Pacific islands.
# Notes are at the end of this file
@ -208,15 +208,21 @@ Zone Pacific/Johnston -10:00 - HST
# uninhabited
# Kiribati
# From Paul Eggert (1996-01-22):
# Today's _Wall Street Journal_ (page 1) reports that Kiribati
# ``declared it the same day throught the country as of Jan. 1, 1995''
# as part of the competition to be first into the 21st century.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Pacific/Tarawa 11:32:04 - LMT 1901 # Bairiki
12:00 - NZST
Zone Pacific/Enderbury -11:24:20 - LMT 1901
-12:00 - KJT 1979 Oct
-11:00 - SST
-11:00 - SST 1995
13:00 - TGT
Zone Pacific/Kiritimati -10:29:20 - LMT 1901
-10:40 - LIT 1979 Oct # Line Is Time
-10:00 - THT
-10:00 - THT 1995
14:00 - KRT
# N Mariana Is
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@ -362,6 +368,10 @@ Zone Pacific/Fakaofo -11:24:56 - LMT 1901
-10:00 - THT
# Tonga
# From Paul Eggert (1996-01-22):
# Today's _Wall Street Journal_ (page 1) reports that ``Tonga has been plotting
# to sneak ahead of [New Zealanders] by introducing daylight-saving time.''
# But since Kiribati has moved the Date Line it's not clear what Tonga will do.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Pacific/Tongatapu 12:19:20 - LMT 1901
12:20 - TMT 1968 Oct
@ -403,7 +413,7 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901
# go ahead and edit the file (and please send any changes to
# tz@elsie.nci.nih.gov for general use in the future).
# From Paul Eggert <eggert@twinsun.com> (August 18, 1994):
# From Paul Eggert <eggert@twinsun.com> (1996-01-22);
# A good source for time zone historical data outside the U.S. is
# Thomas G. Shanks, The International Atlas (3rd edition),
# San Diego: ACS Publications, Inc. (1991).
@ -436,6 +446,7 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901
# 12:00 NZST NZDT New Zealand
# 12:45 CHST CHDT Chatham*
# 13:00 TGT Tongatapu*
# 14:00 KRT Kiritimati*
# -12:00 KJT Kwajalein (no longer used)*
# -11:00 SST Samoa
# -10:40 LIT Line Is (no longer used)*

View File

@ -1,9 +1,15 @@
# @(#)backward 7.9
# @(#)backward 7.13
# This file provides links between current names for time zones
# and their old names. Many names changed in late 1993.
Link Australia/Canberra Australia/ACT
Link America/Adak America/Atka
Link America/Indianapolis America/Fort_Wayne
Link America/Indiana/Knox America/Knox_IN
Link America/St_Thomas America/Virgin
Link Asia/Jerusalem Asia/Tel_Aviv
Link Australia/Sydney Australia/ACT
Link Australia/Sydney Australia/Canberra
Link Australia/Lord_Howe Australia/LHI
Link Australia/Sydney Australia/NSW
Link Australia/Darwin Australia/North
@ -40,7 +46,7 @@ Link Etc/Greenwich Greenwich
Link Asia/Hong_Kong Hongkong
Link Atlantic/Reykjavik Iceland
Link Asia/Tehran Iran
Link Asia/Tel_Aviv Israel
Link Asia/Jerusalem Israel
Link America/Jamaica Jamaica
Link Asia/Tokyo Japan
Link Pacific/Kwajalein Kwajalein
@ -48,9 +54,10 @@ Link Africa/Tripoli Libya
Link America/Tijuana Mexico/BajaNorte
Link America/Mazatlan Mexico/BajaSur
Link America/Mexico_City Mexico/General
Link America/Shiprock Navajo
Link America/Denver Navajo
Link Pacific/Auckland NZ
Link Pacific/Chatham NZ-CHAT
Link Pacific/Pago_Pago Pacific/Samoa
Link Asia/Shanghai PRC
Link Europe/Warsaw Poland
Link Europe/Lisbon Portugal
@ -60,17 +67,17 @@ Link Asia/Singapore Singapore
Link Europe/Istanbul Turkey
Link Etc/UCT UCT
Link America/Anchorage US/Alaska
Link America/Atka US/Aleutian
Link America/Adak US/Aleutian
Link America/Phoenix US/Arizona
Link America/Chicago US/Central
Link America/Fort_Wayne US/East-Indiana
Link America/Indianapolis US/East-Indiana
Link America/New_York US/Eastern
Link Pacific/Honolulu US/Hawaii
Link America/Knox_IN US/Indiana-Starke
Link America/Indiana/Knox US/Indiana-Starke
Link America/Detroit US/Michigan
Link America/Denver US/Mountain
Link America/Los_Angeles US/Pacific
Link Pacific/Samoa US/Samoa
Link Pacific/Pago_Pago US/Samoa
Link Etc/UTC UTC
Link Etc/Universal Universal
Link Europe/Moscow W-SU