aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-07-14 21:05:24 +0000
committerUlrich Drepper <drepper@redhat.com>1999-07-14 21:05:24 +0000
commit0050ad5f64b2f4b3732e59eaa070a954c2335824 (patch)
tree0e1dd5582c4cfe9635de50e08467206bdbdbd9d9
parent965e02a29067cac71f1d82f801177c3e4f64638f (diff)
downloadglibc-0050ad5f64b2f4b3732e59eaa070a954c2335824.zip
glibc-0050ad5f64b2f4b3732e59eaa070a954c2335824.tar.gz
glibc-0050ad5f64b2f4b3732e59eaa070a954c2335824.tar.bz2
Update.
* time/tst-strptime.c (main): Add one more test case. Produce output even when result is ok.
-rw-r--r--ChangeLog3
-rw-r--r--manual/string.texi25
-rw-r--r--time/tst-strptime.c11
3 files changed, 26 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index c645f33..888d6dc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
1999-07-14 Ulrich Drepper <drepper@cygnus.com>
+ * time/tst-strptime.c (main): Add one more test case. Produce
+ output even when result is ok.
+
* time/strptime.c (get_number): Handle number parsing more
consistent with strftime. Only parse a given number of digits.
(get_alt_number): Fix implementation. Was broken.
diff --git a/manual/string.texi b/manual/string.texi
index 45b2bc8..a151ddd 100644
--- a/manual/string.texi
+++ b/manual/string.texi
@@ -1331,18 +1331,19 @@ which support multi-threading.
@comment string.h
@comment BSD
@deftypefun {char *} strsep (char **@var{string_ptr}, const char *@var{delimiter})
-This function is just @code{strtok_r} with the @var{newstring} argument
-replaced by the @var{save_ptr} argument. The initialization of the
-moving pointer has to be done by the user. Successive calls to
-@code{strsep} move the pointer along the tokens separated by
-@var{delimiter}, returning the address of the next token and updating
-@var{string_ptr} to point to the beginning of the next token.
-
-If the input string contains more than one character from
-@var{delimiter} in a row @code{strsep} returns an empty string for each
-pair of characters from @var{delimiter}. This means that a program
-normally should test for @code{strsep} returning an empty string before
-processing it.
+This function has a similar functionality as @code{strtok_r} with the
+@var{newstring} argument replaced by the @var{save_ptr} argument. The
+initialization of the moving pointer has to be done by the user.
+Successive calls to @code{strsep} move the pointer along the tokens
+separated by @var{delimiter}, returning the address of the next token
+and updating @var{string_ptr} to point to the beginning of the next
+token.
+
+One difference between @code{strsep} and @code{strtok_r} is that if the
+input string contains more than one character from @var{delimiter} in a
+row @code{strsep} returns an empty string for each pair of characters
+from @var{delimiter}. This means that a program normally should test
+for @code{strsep} returning an empty string before processing it.
This function was introduced in 4.3BSD and therefore is widely available.
@end deftypefun
diff --git a/time/tst-strptime.c b/time/tst-strptime.c
index 52a7054..f92cb0c 100644
--- a/time/tst-strptime.c
+++ b/time/tst-strptime.c
@@ -1,5 +1,5 @@
/* Test for strptime.
- Copyright (C) 1998 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -34,6 +34,7 @@ static const struct
{ "2000-01-01", "%Y-%m-%d", 6, 0 },
{ "03/03/00", "%D", 5, 62 },
{ "9/9/99", "%x", 4, 251 },
+ { "19990502123412", "%Y%m%d%H%M%S", 0, 121 },
};
@@ -53,6 +54,14 @@ main (int argc, char *argv[])
printf ("not all of `%s' read\n", day_tests[i].input);
result = 1;
}
+
+ printf ("strptime (\"%s\", \"%s\", ...)\n"
+ "\tshould be: wday = %d, yday = %3d\n"
+ "\t is: wday = %d, yday = %3d\n",
+ day_tests[i].input, day_tests[i].format,
+ day_tests[i].wday, day_tests[i].yday,
+ tm.tm_wday, tm.tm_yday);
+
if (tm.tm_wday != day_tests[i].wday)
{
printf ("weekday for `%s' incorrect: %d instead of %d\n",