aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-01-17 00:46:59 +0000
committerRoland McGrath <roland@gnu.org>1996-01-17 00:46:59 +0000
commitda128169aaa250809ed2b143487d062708548fe3 (patch)
tree2946b976d7bbc97a2450da3eb4c5de80c73c29da
parent294897f4a6c1ef2fe408e37670e2bfbb0bf8a77d (diff)
downloadglibc-da128169aaa250809ed2b143487d062708548fe3.tar
glibc-da128169aaa250809ed2b143487d062708548fe3.tar.gz
glibc-da128169aaa250809ed2b143487d062708548fe3.tar.bz2
glibc-da128169aaa250809ed2b143487d062708548fe3.zip
Sun Jan 14 01:01:10 1996 Ulrich Drepper <drepper@ipd.info.uni-karlsruhe.de>
* stdlib/strtol.c: Return correct pointer for strings like "0xyz" and base 0 or 16. * string/strxfrm.c: Handle case for LENGTH == 0 correct. * sunrpc/etc.rpc: Add some more known protocols. Sun Jan 14 01:01:10 1996 Ulrich Drepper <drepper@ipd.info.uni-karlsruhe.de> * stdlib/strtol.c: Return correct pointer for strings like "0xyz" and base 0 or 16. * string/strxfrm.c: Handle case for LENGTH == 0 correct. * sunrpc/etc.rpc: Add some more known protocols.
-rw-r--r--ChangeLog9
-rw-r--r--stdlib/strtol.c14
-rw-r--r--string/strxfrm.c3
-rw-r--r--sunrpc/etc.rpc3
4 files changed, 26 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index c5a460a1ab..9febaf1555 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Sun Jan 14 01:01:10 1996 Ulrich Drepper <drepper@ipd.info.uni-karlsruhe.de>
+
+ * stdlib/strtol.c: Return correct pointer for strings
+ like "0xyz" and base 0 or 16.
+
+ * string/strxfrm.c: Handle case for LENGTH == 0 correct.
+
+ * sunrpc/etc.rpc: Add some more known protocols.
+
Fri Jan 12 13:40:01 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* posix/gnu/types.h: Moved to sysdeps/generic/gnu/types.h.
diff --git a/stdlib/strtol.c b/stdlib/strtol.c
index d52f338c84..b06063c2c5 100644
--- a/stdlib/strtol.c
+++ b/stdlib/strtol.c
@@ -150,7 +150,7 @@ INTERNAL (strtol) (nptr, endptr, base, group)
if (base < 0 || base == 1 || base > 36)
base = 10;
- s = nptr;
+ save = s = nptr;
/* Skip white space. */
while (isspace (*s))
@@ -269,9 +269,17 @@ INTERNAL (strtol) (nptr, endptr, base, group)
return (negative ? -i : i);
noconv:
- /* There was no number to convert. */
+ /* We must handle a special case here: the base is 0 or 16 and the
+ first two characters and '0' and 'x', but the rest are no
+ hexadecimal digits. This is no error case. We return 0 and
+ ENDPTR points to the `x`. */
if (endptr != NULL)
- *endptr = (char *) nptr;
+ if (save - nptr >= 2 && tolower (save[-1]) == 'x' && save[-2] == '0')
+ *endptr = (char *) &save[-1];
+ else
+ /* There was no number to convert. */
+ *endptr = (char *) nptr;
+
return 0L;
}
diff --git a/string/strxfrm.c b/string/strxfrm.c
index 513a4b6a1a..e40ae1c433 100644
--- a/string/strxfrm.c
+++ b/string/strxfrm.c
@@ -32,5 +32,8 @@ strxfrm (dest, src, n)
const char *src;
size_t n;
{
+ if (n == 0)
+ return strlen (src);
+
return __stpncpy (dest, src, n) - dest;
}
diff --git a/sunrpc/etc.rpc b/sunrpc/etc.rpc
index bebfb51b73..6367ff42cc 100644
--- a/sunrpc/etc.rpc
+++ b/sunrpc/etc.rpc
@@ -31,3 +31,6 @@ keyserv 100029 keyserver
tfsd 100037
nsed 100038
nsemntd 100039
+pcnfsd 150001
+amd 300019 amq
+bwnfsd 545580417