about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog19
-rw-r--r--manual/time.texi553
-rw-r--r--manual/top-menu.texi8
-rw-r--r--sysdeps/posix/tempname.c2
-rw-r--r--sysdeps/unix/sysv/linux/msgctl.c8
-rw-r--r--sysdeps/unix/sysv/linux/msgget.c8
-rw-r--r--sysdeps/unix/sysv/linux/msgrcv.c6
-rw-r--r--sysdeps/unix/sysv/linux/msgsnd.c8
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/syscalls.list1
-rw-r--r--sysdeps/unix/sysv/linux/semctl.c6
-rw-r--r--sysdeps/unix/sysv/linux/semget.c8
-rw-r--r--sysdeps/unix/sysv/linux/semop.c8
-rw-r--r--sysdeps/unix/sysv/linux/shmat.c9
-rw-r--r--sysdeps/unix/sysv/linux/shmctl.c8
-rw-r--r--sysdeps/unix/sysv/linux/shmdt.c8
-rw-r--r--sysdeps/unix/sysv/linux/shmget.c8
-rw-r--r--sysdeps/unix/sysv/linux/syscalls.list1
-rw-r--r--time/strftime.c1
-rw-r--r--time/strptime.c9
19 files changed, 645 insertions, 34 deletions
diff --git a/ChangeLog b/ChangeLog
index 82e442642c..e34f11625b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,24 @@
 1998-12-15  Ulrich Drepper  <drepper@cygnus.com>
 
+	* sysdeps/unix/sysv/linux/msgctl.c: Use INLINE_SYSCALL.
+	* sysdeps/unix/sysv/linux/msgget.c: Likewise.
+	* sysdeps/unix/sysv/linux/msgrcv.c: Likewise.
+	* sysdeps/unix/sysv/linux/msgsnd.c: Likewise.
+	* sysdeps/unix/sysv/linux/semctl.c: Likewise.
+	* sysdeps/unix/sysv/linux/semget.c: Likewise.
+	* sysdeps/unix/sysv/linux/semop.c: Likewise.
+	* sysdeps/unix/sysv/linux/shmat.c: Likewise.
+	* sysdeps/unix/sysv/linux/shmctl.c: Likewise.
+	* sysdeps/unix/sysv/linux/shmdt.c: Likewise.
+	* sysdeps/unix/sysv/linux/shmget.c: Likewise.
+	* sysdeps/unix/sysv/linux/syscalls.list: Remove ipc syscall here.
+	* sysdeps/unix/sysv/linux/powerpc/syscalls.list: Add ipc syscall here.
+
+	* time/strftime.c: Remove 'f' format.
+
+	* time/strptime.c (get_number): Ignore trailing whitespace.
+	(strptime_internal): Handle 'F' and 'k' formats.
+
 	* sysdeps/posix/tempname.c (__path_search): Add second part of the
 	patch by Andreas Jaeger.
 
diff --git a/manual/time.texi b/manual/time.texi
index 46a2832326..7b58ad4400 100644
--- a/manual/time.texi
+++ b/manual/time.texi
@@ -82,7 +82,7 @@ elapsed = ((double) (end - start)) / CLOCKS_PER_SEC;
 
 Different computers and operating systems vary wildly in how they keep
 track of processor time.  It's common for the internal processor clock
-to have a resolution somewhere between hundredths and millionths of a
+to have a resolution somewhere between hundredth and millionth of a
 second.
 
 In the GNU system, @code{clock_t} is equivalent to @code{long int} and
@@ -224,6 +224,8 @@ date and time values.
 * High-Resolution Calendar::    A time representation with greater precision.
 * Broken-down Time::            Facilities for manipulating local time.
 * Formatting Date and Time::    Converting times to strings.
+* Parsing Date and Time::       Convert textual time and date information back
+                                 into broken-down time values.
 * TZ Variable::                 How users 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
@@ -689,7 +691,6 @@ return @code{NULL}.
 
 @comment time.h
 @comment ISO
-@comment POSIX.2
 @deftypefun size_t strftime (char *@var{s}, size_t @var{size}, const char *@var{template}, const struct tm *@var{brokentime})
 This function is similar to the @code{sprintf} function (@pxref{Formatted
 Input}), but the conversion specifications that can appear in the format
@@ -789,12 +790,6 @@ The day of the month like with @code{%d}, but padded with blank (range
 
 This format is a POSIX.2 extension.
 
-@item %f
-The day of the week as a decimal number (range @code{1} through
-@code{7}), Monday being @code{1}.
-
-This format is a @w{ISO C 9X} extension.
-
 @item %F
 The date using the format @code{%Y-%m-%d}.  This is the form specified
 in the @w{ISO 8601} standard and is the preferred form for all uses.
@@ -890,7 +885,7 @@ Leap seconds are not counted unless leap second support is available.
 This format is a GNU extension.
 
 @item %S
-The second as a decimal number (range @code{00} through @code{60}).
+The seconds as a decimal number (range @code{00} through @code{60}).
 
 @item %t
 A single @samp{\t} (tabulator) character.
@@ -959,8 +954,8 @@ determinable.
 
 This format is a GNU extension.
 
-A full @w{RFC 822} timestamp is generated by the format 
-@w{@samp{"%a, %d %b %Y %H:%M:%S %z"}} (or the equivalent 
+A full @w{RFC 822} timestamp is generated by the format
+@w{@samp{"%a, %d %b %Y %H:%M:%S %z"}} (or the equivalent
 @w{@samp{"%a, %d %b %Y %T %z"}}).
 
 @item %Z
@@ -1008,6 +1003,542 @@ is examined before any output is produced.
 For an example of @code{strftime}, see @ref{Time Functions Example}.
 @end deftypefun
 
+@node Parsing Date and Time
+@subsection Convert textual time and date information back
+
+The @w{ISO C} standard does not specify any functions which can convert
+the output of the @code{strftime} function back into a binary format.
+This lead to variety of more or less successful implementations with
+different interfaces over the years.  Then the Unix standard got
+extended by two functions: @code{strptime} and @code{getdate}.  Both
+have kind of strange interfaces but at least they are widely available.
+
+@menu
+* Low-Level Time String Parsing::  Interpret string according to given format.
+* General Time String Parsing::    User-friendly function to parse data and
+                                    time strings.
+@end menu
+
+@node Low-Level Time String Parsing
+@subsubsection Interpret string according to given format
+
+The first function is a rather low-level interface.  It is nevertheless
+frequently used in user programs since it is better known.  Its
+implementation and the interface though is heavily influenced by the
+@code{getdate} function which is defined and implemented in terms of
+calls to @code{strptime}.
+
+@comment time.h
+@comment XPG4
+@deftypefun {char *} strptime (const char *@var{s}, const char *@var{fmt}, struct tm *@var{tp})
+The @code{strptime} function parses the input string @var{s} according
+to the format string @var{fmt} and stores the found values in the
+structure @var{tp}.
+
+The input string can be retrieved in any way.  It does not matter
+whether it was generated by a @code{strftime} call or made up directly
+by a program.  It is also not necessary that the content is in any
+human-recognizable format.  I.e., it is OK if a date is written like
+@code{"02:1999:9"} which is not understandable without context.  As long
+the format string @var{fmt} matches the format of the input string
+everything goes.
+
+The format string consists of the same components as the format string
+for the @code{strftime} function.  The only difference is that the flags
+@code{_}, @code{-}, @code{0}, and @code{^} are not allowed.
+@comment Is this really the intention?  --drepper
+Several of the formats which @code{strftime} handled differently do the
+same work in @code{strptime} since differences like case of the output
+do not matter.  For symmetry reasons all formats are supported, though.
+
+The modifiers @code{E} and @code{O} are also allowed everywhere the
+@code{strftime} function allows them.
+
+The formats are:
+
+@table @code
+@item %a
+@itemx %A
+The weekday name according to the current locale, in abbreviated form or
+the full name.
+
+@item %b
+@itemx %B
+@itemx %h
+The month name according to the current locale, in abbreviated form or
+the full name.
+
+@item %c
+The date and time representation for the current locale.
+
+@item %Ec
+Like @code{%c} but the locale's alternative date and time format is used.
+
+@item %C
+The century of the year.
+
+It makes sense to use this format only if the format string also
+contains the @code{%y} format.
+
+@item %EC
+The locale's representation of the period.
+
+Unlike @code{%C} it makes sometimes sense to use this format since in
+some cultures it is required to specify years relative to periods
+instead of using the Gregorian years.
+
+@item %d
+@item %e
+The day of the month as a decimal number (range @code{1} through @code{31}).
+Leading zeroes are permitted but not required.
+
+@item %Od
+@itemx %Oe
+Same as @code{%d} but the locale's alternative numeric symbols are used.
+
+Leading zeroes are permitted but not required.
+
+@item %D
+Equivalent to the use of @code{%m/%d/%y} in this place.
+
+@item %F
+Equivalent to the use of @code{%Y-%m-%d} which is the @w{ISO 8601} date
+format.
+
+This is a GNU extension following an @w{ISO C 9X} extension to
+@code{strftime}.
+
+@item %g
+The year corresponding to the ISO week number, but without the century
+(range @code{00} through @code{99}).
+
+@emph{Note:} This is not really implemented currently.  The format is
+recognized, input is consumed but no field in @var{tm} is set.
+
+This format is a GNU extension following a GNU extension of @code{strftime}.
+
+@item %G
+The year corresponding to the ISO week number.
+
+@emph{Note:} This is not really implemented currently.  The format is
+recognized, input is consumed but no field in @var{tm} is set.
+
+This format is a GNU extension following a GNU extension of @code{strftime}.
+
+@item %H
+@itemx %k
+The hour as a decimal number, using a 24-hour clock (range @code{00} through
+@code{23}).
+
+@code{%k} is a GNU extension following a GNU extension of @code{strftime}.
+
+@item %OH
+Same as @code{%H} but using the locale's alternative numeric symbols are used.
+
+@item %I
+@itemx %l
+The hour as a decimal number, using a 12-hour clock (range @code{01} through
+@code{12}).
+
+@code{%l} is a GNU extension following a GNU extension of @code{strftime}.
+
+@item %OI
+Same as @code{%I} but using the locale's alternative numeric symbols are used.
+
+@item %j
+The day of the year as a decimal number (range @code{1} through @code{366}).
+
+Leading zeroes are permitted but not required.
+
+@item %m
+The month as a decimal number (range @code{1} through @code{12}).
+
+Leading zeroes are permitted but not required.
+
+@item %Om
+Same as @code{%m} but using the locale's alternative numeric symbols are used.
+
+@item %M
+The minute as a decimal number (range @code{0} through @code{59}).
+
+Leading zeroes are permitted but not required.
+
+@item %OM
+Same as @code{%M} but using the locale's alternative numeric symbols are used.
+
+@item %n
+@itemx %t
+Matches any white space.
+
+@item %p
+@item %P
+The locale-dependent equivalent to @samp{AM} or @samp{PM}.
+
+This format is not useful unless @code{%I} or @code{%l} is also used.
+Another complication is that the locale might not define these values at
+all and therefore the conversion fails.
+
+@code{%P} is a GNU extension following a GNU extension to @code{strftime}.
+
+@item %r
+The complete time using the AM/PM format of the current locale.
+
+A complication is that the locale might not define this format at all
+and therefore the conversion fails.
+
+@item %R
+The hour and minute in decimal numbers using the format @code{%H:%M}.
+
+@code{%R} is a GNU extension following a GNU extension to @code{strftime}.
+
+@item %s
+The number of seconds since the epoch, i.e., since 1970-01-01 00:00:00 UTC.
+Leap seconds are not counted unless leap second support is available.
+
+@code{%s} is a GNU extension following a GNU extension to @code{strftime}.
+
+@item %S
+The seconds as a decimal number (range @code{0} through @code{61}).
+
+Leading zeroes are permitted but not required.
+
+Please note the nonsense with @code{61} being allowed.  This is what the
+Unix specification says.  They followed the stupid decision once made to
+allow double leap seconds.  These do not exist but the myth persists.
+
+@item %OS
+Same as @code{%S} but using the locale's alternative numeric symbols are used.
+
+@item %T
+Equivalent to the use of @code{%H:%M:%S} in this place.
+
+@item %u
+The day of the week as a decimal number (range @code{1} through
+@code{7}), Monday being @code{1}.
+
+Leading zeroes are permitted but not required.
+
+@emph{Note:} This is not really implemented currently.  The format is
+recognized, input is consumed but no field in @var{tm} is set.
+
+@item %U
+The week number of the current year as a decimal number (range @code{0}
+through @code{53}).
+
+Leading zeroes are permitted but not required.
+
+@item %OU
+Same as @code{%U} but using the locale's alternative numeric symbols are used.
+
+@item %V
+The @w{ISO 8601:1988} week number as a decimal number (range @code{1}
+through @code{53}).
+
+Leading zeroes are permitted but not required.
+
+@emph{Note:} This is not really implemented currently.  The format is
+recognized, input is consumed but no field in @var{tm} is set.
+
+@item %w
+The day of the week as a decimal number (range @code{0} through
+@code{6}), Sunday being @code{0}.
+
+Leading zeroes are permitted but not required.
+
+@emph{Note:} This is not really implemented currently.  The format is
+recognized, input is consumed but no field in @var{tm} is set.
+
+@item %Ow
+Same as @code{%w} but using the locale's alternative numeric symbols are used.
+
+@item %W
+The week number of the current year as a decimal number (range @code{0}
+through @code{53}).
+
+Leading zeroes are permitted but not required.
+
+@emph{Note:} This is not really implemented currently.  The format is
+recognized, input is consumed but no field in @var{tm} is set.
+
+@item %OW
+Same as @code{%W} but using the locale's alternative numeric symbols are used.
+
+@item %x
+The date using the locale's date format.
+
+@item %Ex
+Like @code{%x} but the locale's alternative data representation is used.
+
+@item %X
+The time using the locale's time format.
+
+@item %EX
+Like @code{%X} but the locale's alternative time representation is used.
+
+@item %y
+The year without a century as a decimal number (range @code{0} through
+@code{99}).
+
+Leading zeroes are permitted but not required.
+
+Please note that it is at least questionable to use this format without
+the @code{%C} format.  The @code{strptime} function does regard input
+values in the range @math{68} to @math{99} as the years @math{1969} to
+@math{1999} and the values @math{0} to @math{68} as the years
+@math{2000} to @math{2068}.  But maybe this heuristic fails for some
+input data.
+
+Therefore it is best to avoid @code{%y} completely and use @code{%Y}
+instead.
+
+@item %Ey
+The offset from @code{%EC} in the locale's alternative representation.
+
+@item %Oy
+The offset of the year (from @code{%C}) using the locale's alternative
+numeric symbols.
+
+@item %Y
+The year as a decimal number, using the Gregorian calendar.
+
+@item %EY
+The full alternative year representation.
+
+@item %z
+Equivalent to the use of @code{%a, %d %b %Y %H:%M:%S %z} in this place.
+This is the full @w{ISO 8601} date and time format.
+
+@item %Z
+The timezone name.
+
+@emph{Note:} This is not really implemented currently.  The format is
+recognized, input is consumed but no field in @var{tm} is set.
+
+@item %%
+A literal @samp{%} character.
+@end table
+
+All other characters in the format string must have a matching character
+in the input string.  Exceptions are white spaces in the input string
+which can match zero or more white space characters in the input string.
+
+The @code{strptime} function processes the input string from right to
+left.  Each of the three possible input elements (white space, literal,
+or format) are handled one after the other.  If the input cannot be
+matched to the format string the function stops.  The remainder of the
+format and input strings are not processed.
+
+The return value of the function is a pointer to the first character not
+processed in this function call.  In the case of an error the return
+value points to the first character not matched.  In case the input
+string contains more than required by the format string the return value
+points right after the last consumed input character.  In case the whole
+input string is consumed the return value points to the NUL byte at the
+end of the string.
+@end deftypefun
+
+The specification of the function in the XPG standard is rather vague.
+It leaves out a few important pieces of information.  Most important it
+does not specify what happens to those elements of @var{tm} which are
+not directly initialized by the different formats.  Various
+implementations on different Unix systems vary here.
+
+The GNU libc implementation does not touch those fields which are not
+directly initialized.  Exceptions are the @code{tm_wday} and
+@code{tm_yday} elements which are recomputed if any of the year, month,
+or date elements changed.  This has two implications:
+
+@itemize @bullet
+@item
+Before calling the @code{strptime} function for a new input string one
+has to prepare the structure passed in as the @var{tm}.  Normally this
+will mean that all values are initialized to zero.  Alternatively one
+can use all fields to values like @code{INT_MAX} which allows to
+determine which elements were set by the function call.  Zero does not
+work here since it is a valid value for many of the fields.
+
+Careful initialization is necessary if one wants to find out whether a
+certain field in @var{tm} was initialized by the function call.
+
+@item
+One can construct a @code{struct tm} value in several @code{strptime}
+calls in a row.  A useful application of this is for example the parsing
+of two separate strings, one containing the date information, the other
+the time information.  By parsing both one after the other without
+clearing the structure in between one can construct a complete
+broken-down time.
+@end itemize
+
+The following example shows a function which parses a string which is
+supposed to contain the date information in either US style or @w{ISO
+8601} form.
+
+@smallexample
+const char *
+parse_date (const char *input, struct tm *tm)
+@{
+  const char *cp;
+
+  /* @r{First clear the result structure.}  */
+  memset (tm, '\0', sizeof (*tm));
+
+  /* @r{Try the ISO format first.}  */
+  cp = strptime (input, "%F", tm);
+  if (cp == NULL)
+    @{
+      /* @r{Does not match.  Try the US form.}  */
+      cp = strptime (input, "%D", tm);
+    @}
+
+  return cp;
+@}
+@end smallexample
+
+@node General Time String Parsing
+@subsubsection A user-friendlier way to parse times and dates
+
+The Unix standard defines another function to parse date strings.  The
+interface is, mildly said, weird.  But if this function fits into the
+application to be written it is just fine.  It is a problem when using
+this function in multi-threaded programs or in libraries since it
+returns a pointer to a static variable, uses a global variable, and a
+global state (an environment variable).
+
+@comment time.h
+@comment Unix98
+@defvar getdate_err
+This variable of type @code{int} will contain the error code of the last
+unsuccessful call of the @code{getdate} function.  Defined values are:
+
+@table @math
+@item 1
+The environment variable @code{DATEMSK} is not defined or null.
+@item 2
+The template file denoted by the @code{DATEMSK} environment variable
+cannot be opened.
+@item 3
+Information about the template file cannot retrieved.
+@item 4
+The template file is no regular file.
+@item 5
+An I/O error occurred while reading the template file.
+@item 6
+Not enough memory available to execute the function.
+@item 7
+The template file contains no matching template.
+@item 8
+The input string is invalid for a template which would match otherwise.
+This includes error like February 31st, or return values which can be
+represented using @code{time_t}.
+@end table
+@end defvar
+
+@comment time.h
+@comment Unix98
+@deftypefun {struct tm *} getdate (const char *@var{string})
+The interface of the @code{getdate} function is the simplest possible
+for a function to parse a string and return the value.  @var{string} is
+the input string and the result is passed to the user in a statically
+allocated variable.
+
+The details about how the string is processed is hidden from the user.
+In fact, it can be outside the control of the program.  Which formats
+are recognized is controlled by the file named by the environment
+variable @code{DATEMSK}.  The content of the named file should contain
+lines of valid format strings which could be passed to @code{strptime}.
+
+The @code{getdate} function reads these format strings one after the
+other and tries to match the input string.  The first line which
+completely matches the input string is used.
+
+Elements which were not initialized through the format string get
+assigned the values of the time the @code{getdate} function is called.
+
+The format elements recognized by @code{getdate} are the same as for
+@code{strptime}.  See above for an explanation.  There are only a few
+extension to the @code{strptime} behavior:
+
+@itemize @bullet
+@item
+If the @code{%Z} format is given the broken-down time is based on the
+current time in the timezone matched, not in the current timezone of the
+runtime environment.
+
+@emph{Note}: This is not implemented (currently).  The problem is that
+timezone names are not unique.  If a fixed timezone is assumed for a
+given string (say @code{EST} meaning US East Coast time) uses for
+countries other than the USA will fail.  So far we have found no good
+solution for this.
+
+@item
+If only the weekday is specified the selected day depends on the current
+date.  If the current weekday is greater or equal to the @code{tm_wday}
+value this weeks day is selected.  Otherwise next weeks day.
+
+@item
+A similar heuristic is used if only the month is given, not the year.
+For value corresponding to the current or a later month the current year
+s used.  Otherwise the next year.  The first day of the month is assumed
+if it is not explicitly specified.
+
+@item
+The current hour, minute, and second is used if the appropriate value is
+not set through the format.
+
+@item
+If no date is given the date for the next day is used if the time is
+smaller than the current time.  Otherwise it is the same day.
+@end itemize
+
+It should be noted that the format in the template file need not only
+contain format elements.  The following is a list of possible format
+strings (taken from the Unix standard):
+
+@smallexample
+%m
+%A %B %d, %Y %H:%M:%S
+%A
+%B
+%m/%d/%y %I %p
+%d,%m,%Y %H:%M
+at %A the %dst of %B in %Y
+run job at %I %p,%B %dnd
+%A den %d. %B %Y %H.%M Uhr
+@end smallexample
+
+As one can see the template list can contain very specific strings like
+@code{run job at %I %p,%B %dnd}.  Using the above list of templates and
+assuming the current time is Mon Sep 22 12:19:47 EDT 1986 we can get the
+The results for the given input.
+
+@multitable {xxxxxxxxxxxx} {xxxxxxxx} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
+@item        Mon @tab       %a @tab    Mon Sep 22 12:19:47 EDT 1986
+@item        Sun @tab       %a @tab    Sun Sep 28 12:19:47 EDT 1986
+@item        Fri @tab       %a @tab    Fri Sep 26 12:19:47 EDT 1986
+@item        September @tab %B @tab    Mon Sep 1 12:19:47 EDT 1986
+@item        January @tab   %B @tab    Thu Jan 1 12:19:47 EST 1987
+@item        December @tab  %B @tab    Mon Dec 1 12:19:47 EST 1986
+@item        Sep Mon @tab   %b %a @tab Mon Sep 1 12:19:47 EDT 1986
+@item        Jan Fri @tab   %b %a @tab Fri Jan 2 12:19:47 EST 1987
+@item        Dec Mon @tab   %b %a @tab Mon Dec 1 12:19:47 EST 1986
+@item        Jan Wed 1989 @tab  %b %a %Y @tab Wed Jan 4 12:19:47 EST 1989
+@item        Fri 9 @tab     %a %H @tab Fri Sep 26 09:00:00 EDT 1986
+@item        Feb 10:30 @tab %b %H:%S @tab Sun Feb 1 10:00:30 EST 1987
+@item        10:30 @tab     %H:%M @tab Tue Sep 23 10:30:00 EDT 1986
+@item        13:30 @tab     %H:%M @tab Mon Sep 22 13:30:00 EDT 1986
+@end multitable
+
+The return value of the function is a pointer to a static variable of
+type @w{@code{struct tm}} or a null pointer if an error occurred.  The
+result in the variable pointed to by the return value is only valid
+until the next @code{getdate} call which makes this function unusable in
+multi-threaded applications.
+
+The @code{errno} variable is @emph{not} changed.  Error conditions are
+signalled using the global variable @code{getdate_err}.  See the
+description above for a list of the possible error values.
+@end deftypefun
+
 @node TZ Variable
 @subsection Specifying the Time Zone with @code{TZ}
 
diff --git a/manual/top-menu.texi b/manual/top-menu.texi
index f14e172794..32ee478e2b 100644
--- a/manual/top-menu.texi
+++ b/manual/top-menu.texi
@@ -768,11 +768,19 @@ Calendar Time
 * High-Resolution Calendar::    A time representation with greater precision.
 * Broken-down Time::            Facilities for manipulating local time.
 * Formatting Date and Time::    Converting times to strings.
+* Parsing Date and Time::       Convert textual time and date information back
+                                 into broken-down time values.
 * TZ Variable::                 How users 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.
 
+Parsing Date and Time
+
+* Low-Level Time String Parsing::  Interpret string according to given format.
+* General Time String Parsing::    User-friendly function to parse data and
+                                    time strings.
+
 Non-Local Exits
 
 * Intro: Non-Local Intro.        When and how to use these facilities.
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c
index c3dbf5278b..a89a73721f 100644
--- a/sysdeps/posix/tempname.c
+++ b/sysdeps/posix/tempname.c
@@ -71,7 +71,7 @@ __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
       else
 	dir = NULL;
     }
-  if (dir != NULL)
+  if (dir == NULL)
     {
       if (direxists (P_tmpdir))
 	dir = P_tmpdir;
diff --git a/sysdeps/unix/sysv/linux/msgctl.c b/sysdeps/unix/sysv/linux/msgctl.c
index 6a0b7d683d..7f0d7c55a4 100644
--- a/sysdeps/unix/sysv/linux/msgctl.c
+++ b/sysdeps/unix/sysv/linux/msgctl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -17,8 +17,12 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <errno.h>
 #include <sys/msg.h>
 
+#include <sysdep.h>
+#include <sys/syscall.h>
+
 /* Allows to control internal state and destruction of message queue
    objects.  */
 
@@ -28,5 +32,5 @@ msgctl (msqid, cmd, buf)
      int cmd;
      struct msqid_ds *buf;
 {
-  return __ipc (IPCOP_msgctl, msqid, cmd, 0, buf);
+  return INLINE_SYSCALL (ipc, 5, IPCOP_msgctl, msqid, cmd, 0, buf);
 }
diff --git a/sysdeps/unix/sysv/linux/msgget.c b/sysdeps/unix/sysv/linux/msgget.c
index c073614ef1..f9788d6e54 100644
--- a/sysdeps/unix/sysv/linux/msgget.c
+++ b/sysdeps/unix/sysv/linux/msgget.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -17,9 +17,13 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <errno.h>
 #include <sys/msg.h>
 #include <stdlib.h>		/* for definition of NULL */
 
+#include <sysdep.h>
+#include <sys/syscall.h>
+
 /* Return descriptor for message queue associated with KEY.  The MSGFLG
    parameter describes how to proceed with clashing of key values.  */
 
@@ -28,5 +32,5 @@ msgget (key, msgflg)
      key_t key;
      int msgflg;
 {
-  return __ipc (IPCOP_msgget, key, msgflg, 0, NULL);
+  return INLINE_SYSCALL (ipc, 5, IPCOP_msgget, key, msgflg, 0, NULL);
 }
diff --git a/sysdeps/unix/sysv/linux/msgrcv.c b/sysdeps/unix/sysv/linux/msgrcv.c
index a8a0dea3fe..30169fb3a6 100644
--- a/sysdeps/unix/sysv/linux/msgrcv.c
+++ b/sysdeps/unix/sysv/linux/msgrcv.c
@@ -17,8 +17,12 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <errno.h>
 #include <sys/msg.h>
 
+#include <sysdep.h>
+#include <sys/syscall.h>
+
 
 /* Kludge to work around Linux' restriction of only up to five
    arguments to a system call.  */
@@ -44,5 +48,5 @@ msgrcv (msqid, msgp, msgsz, msgtyp, msgflg)
   tmp.msgp = msgp;
   tmp.msgtyp = msgtyp;
 
-  return __ipc (IPCOP_msgrcv, msqid, msgsz, msgflg, &tmp);
+  return INLINE_SYSCALL (ipc, 5, IPCOP_msgrcv, msqid, msgsz, msgflg, &tmp);
 }
diff --git a/sysdeps/unix/sysv/linux/msgsnd.c b/sysdeps/unix/sysv/linux/msgsnd.c
index 739323495c..c279b2e52e 100644
--- a/sysdeps/unix/sysv/linux/msgsnd.c
+++ b/sysdeps/unix/sysv/linux/msgsnd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -17,8 +17,12 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <errno.h>
 #include <sys/msg.h>
 
+#include <sysdep.h>
+#include <sys/syscall.h>
+
 int
 msgsnd (msqid, msgp, msgsz, msgflg)
      int msqid;
@@ -26,5 +30,5 @@ msgsnd (msqid, msgp, msgsz, msgflg)
      size_t msgsz;
      int msgflg;
 {
-  return __ipc (IPCOP_msgsnd, msqid, msgsz, msgflg, msgp);
+  return INLINE_SYSCALL (ipc, 5, IPCOP_msgsnd, msqid, msgsz, msgflg, msgp);
 }
diff --git a/sysdeps/unix/sysv/linux/powerpc/syscalls.list b/sysdeps/unix/sysv/linux/powerpc/syscalls.list
index 33132142a6..2d95d67046 100644
--- a/sysdeps/unix/sysv/linux/powerpc/syscalls.list
+++ b/sysdeps/unix/sysv/linux/powerpc/syscalls.list
@@ -2,6 +2,7 @@
 
 # System calls with wrappers.
 s_ioctl		ioctl	ioctl		3	__syscall_ioctl
+s_ipc		msgget	ipc		5	__syscall_ipc
 s_llseek	llseek	_llseek		5	__syscall__llseek
 s_chown		chown	chown		3	__syscall_chown
 rt_sigaction	-	rt_sigaction	4	__syscall_rt_sigaction
diff --git a/sysdeps/unix/sysv/linux/semctl.c b/sysdeps/unix/sysv/linux/semctl.c
index c87b407d2c..4bc63bd71c 100644
--- a/sysdeps/unix/sysv/linux/semctl.c
+++ b/sysdeps/unix/sysv/linux/semctl.c
@@ -17,9 +17,13 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <errno.h>
 #include <stdarg.h>
 #include <sys/sem.h>
 
+#include <sysdep.h>
+#include <sys/syscall.h>
+
 /* Define a `union semun' suitable for Linux here.  */
 union semun
 {
@@ -46,5 +50,5 @@ semctl (int semid, int semnum, int cmd, ...)
 
   va_end (ap);
 
-  return __ipc (IPCOP_semctl, semid, semnum, cmd, arg);
+  return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd, arg);
 }
diff --git a/sysdeps/unix/sysv/linux/semget.c b/sysdeps/unix/sysv/linux/semget.c
index b9f41f5c7c..60a150a9fd 100644
--- a/sysdeps/unix/sysv/linux/semget.c
+++ b/sysdeps/unix/sysv/linux/semget.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -17,9 +17,13 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <errno.h>
 #include <sys/sem.h>
 #include <stdlib.h>		/* for definition of NULL */
 
+#include <sysdep.h>
+#include <sys/syscall.h>
+
 /* Return identifier for array of NSEMS semaphores associated with
    KEY.  */
 
@@ -29,5 +33,5 @@ semget (key, nsems, semflg)
      int nsems;
      int semflg;
 {
-  return __ipc (IPCOP_semget, key, nsems, semflg, NULL);
+  return INLINE_SYSCALL (ipc, 5, IPCOP_semget, key, nsems, semflg, NULL);
 }
diff --git a/sysdeps/unix/sysv/linux/semop.c b/sysdeps/unix/sysv/linux/semop.c
index 563aaae414..bd120bf4b3 100644
--- a/sysdeps/unix/sysv/linux/semop.c
+++ b/sysdeps/unix/sysv/linux/semop.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -17,8 +17,12 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <errno.h>
 #include <sys/sem.h>
 
+#include <sysdep.h>
+#include <sys/syscall.h>
+
 /* Perform user-defined atomical operation of array of semaphores.  */
 
 int
@@ -27,5 +31,5 @@ semop (semid, sops, nsops)
      struct sembuf *sops;
      unsigned int nsops;
 {
-  return __ipc (IPCOP_semop, semid, (int) nsops, 0, sops);
+  return INLINE_SYSCALL (ipc, 5, IPCOP_semop, semid, (int) nsops, 0, sops);
 }
diff --git a/sysdeps/unix/sysv/linux/shmat.c b/sysdeps/unix/sysv/linux/shmat.c
index 9d36b26aa2..9ebac49537 100644
--- a/sysdeps/unix/sysv/linux/shmat.c
+++ b/sysdeps/unix/sysv/linux/shmat.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -17,8 +17,12 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <errno.h>
 #include <sys/shm.h>
 
+#include <sysdep.h>
+#include <sys/syscall.h>
+
 /* Attach the shared memory segment associated with SHMID to the data
    segment of the calling process.  SHMADDR and SHMFLG determine how
    and where the segment is attached.  */
@@ -32,7 +36,8 @@ shmat (shmid, shmaddr, shmflg)
   int retval;
   unsigned long raddr;
 
-  retval = __ipc (IPCOP_shmat, shmid, shmflg, (int) &raddr, (void *) shmaddr);
+  retval = INLINE_SYSCALL (ipc, 5, IPCOP_shmat, shmid, shmflg, (int) &raddr,
+			   (void *) shmaddr);
   return ((unsigned long int) retval > -(unsigned long int) SHMLBA
 	  ? (void *) retval : (void *) raddr);
 }
diff --git a/sysdeps/unix/sysv/linux/shmctl.c b/sysdeps/unix/sysv/linux/shmctl.c
index f25d4194b5..890e700a30 100644
--- a/sysdeps/unix/sysv/linux/shmctl.c
+++ b/sysdeps/unix/sysv/linux/shmctl.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -17,8 +17,12 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <errno.h>
 #include <sys/shm.h>
 
+#include <sysdep.h>
+#include <sys/syscall.h>
+
 /* Provide operations to control over shared memory segments.  */
 
 int
@@ -27,5 +31,5 @@ shmctl (shmid, cmd, buf)
      int cmd;
      struct shmid_ds *buf;
 {
-  return __ipc (IPCOP_shmctl, shmid, cmd, 0, buf);
+  return INLINE_SYSCALL (ipc, 5, IPCOP_shmctl, shmid, cmd, 0, buf);
 }
diff --git a/sysdeps/unix/sysv/linux/shmdt.c b/sysdeps/unix/sysv/linux/shmdt.c
index 70526e6ae0..1d1a1847d1 100644
--- a/sysdeps/unix/sysv/linux/shmdt.c
+++ b/sysdeps/unix/sysv/linux/shmdt.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -17,8 +17,12 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <errno.h>
 #include <sys/shm.h>
 
+#include <sysdep.h>
+#include <sys/syscall.h>
+
 /* Detach shared memory segment starting at address specified by SHMADDR
    from the caller's data segment.  */
 
@@ -26,5 +30,5 @@ int
 shmdt (shmaddr)
      const void *shmaddr;
 {
-  return __ipc (IPCOP_shmdt, 0, 0, 0, (void *) shmaddr);
+  return INLINE_SYSCALL (ipc, 5, IPCOP_shmdt, 0, 0, 0, (void *) shmaddr);
 }
diff --git a/sysdeps/unix/sysv/linux/shmget.c b/sysdeps/unix/sysv/linux/shmget.c
index 8754191862..73bfe97dc7 100644
--- a/sysdeps/unix/sysv/linux/shmget.c
+++ b/sysdeps/unix/sysv/linux/shmget.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
 
@@ -17,9 +17,13 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#include <errno.h>
 #include <sys/shm.h>
 #include <stdlib.h>		/* for definition of NULL */
 
+#include <sysdep.h>
+#include <sys/syscall.h>
+
 /* Return an identifier for an shared memory segment of at least size SIZE
    which is associated with KEY.  */
 
@@ -29,5 +33,5 @@ shmget (key, size, shmflg)
      int size;
      int shmflg;
 {
-  return __ipc (IPCOP_shmget, key, size, shmflg, NULL);
+  return INLINE_SYSCALL (ipc, 5, IPCOP_shmget, key, size, shmflg, NULL);
 }
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index ccec06a861..9f6afe408c 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -19,7 +19,6 @@ getsid		-	getsid		1	getsid
 init_module	EXTRA	init_module	5	init_module
 ioperm		-	ioperm		3	ioperm
 iopl		-	iopl		1	iopl
-ipc		msgget	ipc		5	__ipc
 klogctl		EXTRA	syslog		3	klogctl
 lchown		-	lchown		3	__lchown	lchown
 mlock		EXTRA	mlock		2	__mlock	mlock
diff --git a/time/strftime.c b/time/strftime.c
index be7891d14a..bb19babc34 100644
--- a/time/strftime.c
+++ b/time/strftime.c
@@ -1041,7 +1041,6 @@ my_strftime (s, maxsize, format, tp ut_argument)
 	  add (1, *p = '\t');
 	  break;
 
-	case 'f':
 	case 'u':		/* POSIX.2 extension.  */
 	  DO_NUMBER (1, (tp->tm_wday - 1 + 7) % 7 + 1);
 
diff --git a/time/strptime.c b/time/strptime.c
index 315af83980..f4b954dfe9 100644
--- a/time/strptime.c
+++ b/time/strptime.c
@@ -86,6 +86,8 @@ localtime_r (t, tp)
 #define get_number(from, to) \
   do {									      \
     val = 0;								      \
+    while (*rp == ' ')							      \
+      ++rp;								      \
     if (*rp < '0' || *rp > '9')						      \
       return NULL;							      \
     do {								      \
@@ -405,6 +407,12 @@ strptime_internal (buf, format, tm, decided)
 	  /* Match day of month.  */
 	  get_number (1, 31);
 	  tm->tm_mday = val;
+	  want_xday = 1;
+	  break;
+	case 'F':
+	  if (!recursive ("%Y-%m-%d"))
+	    return NULL;
+	  want_xday = 1;
 	  break;
 	case 'x':
 #ifdef _NL_CURRENT
@@ -433,6 +441,7 @@ strptime_internal (buf, format, tm, decided)
 	    return NULL;
 	  want_xday = 1;
 	  break;
+	case 'k':
 	case 'H':
 	  /* Match hour in 24-hour clock.  */
 	  get_number (0, 23);