summaryrefslogtreecommitdiffstats
path: root/man3/strtoul.3
diff options
context:
space:
mode:
Diffstat (limited to 'man3/strtoul.3')
-rw-r--r--man3/strtoul.335
1 files changed, 20 insertions, 15 deletions
diff --git a/man3/strtoul.3 b/man3/strtoul.3
index a9a8d60..99b5a47 100644
--- a/man3/strtoul.3
+++ b/man3/strtoul.3
@@ -11,7 +11,7 @@
.\" Fixed typo, aeb, 950823
.\" 2002-02-22, joey, mihtjel: Added strtoull()
.\"
-.TH strtoul 3 2023-07-20 "Linux man-pages 6.05.01"
+.TH strtoul 3 2023-12-19 "Linux man-pages 6.7"
.SH NAME
strtoul, strtoull, strtouq \- convert a string to an unsigned long integer
.SH LIBRARY
@@ -20,18 +20,18 @@ Standard C library
.SH SYNOPSIS
.nf
.B #include <stdlib.h>
-.PP
+.P
.BI "unsigned long strtoul(const char *restrict " nptr ,
.BI " char **restrict " endptr ", int " base );
.BI "unsigned long long strtoull(const char *restrict " nptr ,
.BI " char **restrict " endptr ", int " base );
.fi
-.PP
+.P
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.RE
-.PP
+.P
.BR strtoull ():
.nf
_ISOC99_SOURCE
@@ -50,7 +50,7 @@ given
.IR base ,
which must be between 2 and 36 inclusive, or be
the special value 0.
-.PP
+.P
The string may begin with an arbitrary amount of white space (as
determined by
.BR isspace (3))
@@ -64,7 +64,7 @@ zero
.I base
is taken as 10 (decimal) unless the next character
is \[aq]0\[aq], in which case it is taken as 8 (octal).
-.PP
+.P
The remainder of the string is converted to an
.I "unsigned long"
value in the obvious manner,
@@ -73,10 +73,13 @@ valid digit in the given base.
(In bases above 10, the letter \[aq]A\[aq] in
either uppercase or lowercase represents 10, \[aq]B\[aq] represents 11, and so
forth, with \[aq]Z\[aq] representing 35.)
-.PP
+.P
If
.I endptr
is not NULL,
+and the
+.I base
+is supported,
.BR strtoul ()
stores the address of the
first invalid character in
@@ -94,7 +97,7 @@ In particular, if
is not \[aq]\e0\[aq] but
.I **endptr
is \[aq]\e0\[aq] on return, the entire string is valid.
-.PP
+.P
The
.BR strtoull ()
function works just like the
@@ -124,6 +127,9 @@ Precisely the same holds for
instead of
.BR ULONG_MAX ).
.SH ERRORS
+This function does not modify
+.I errno
+on success.
.TP
.B EINVAL
(not in C99)
@@ -133,7 +139,7 @@ contains an unsupported value.
.TP
.B ERANGE
The resulting value was out of range.
-.PP
+.P
The implementation may also set
.I errno
to
@@ -156,7 +162,6 @@ T{
.BR strtouq ()
T} Thread safety MT-Safe locale
.TE
-.sp 1
.SH STANDARDS
C11, POSIX.1-2008.
.SH HISTORY
@@ -180,26 +185,26 @@ to 0 before the call,
and then determine if an error occurred by checking whether
.I errno
has a nonzero value after the call.
-.PP
+.P
In locales other than the "C" locale, other strings may be accepted.
(For example, the thousands separator of the current locale may be
supported.)
-.PP
+.P
BSD also has
-.PP
+.P
.in +4n
.EX
.BI "u_quad_t strtouq(const char *" nptr ", char **" endptr ", int " base );
.EE
.in
-.PP
+.P
with completely analogous definition.
Depending on the wordsize of the current architecture, this
may be equivalent to
.BR strtoull ()
or to
.BR strtoul ().
-.PP
+.P
Negative values are considered valid input and are
silently converted to the equivalent
.I "unsigned long"