]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man3/strtol.3
Various pages: Add missing commas in SEE ALSO part II
[thirdparty/man-pages.git] / man3 / strtol.3
index bd05667d9403b419319b8de4593239cdc0e56483..02598b9832faaf6a6670e7cb586919ed6690883d 100644 (file)
 .\"     386BSD man pages
 .\" Modified Sun Jul 25 10:53:39 1993 by Rik Faith (faith@cs.unc.edu)
 .\" Added correction due to nsd@bbc.com (Nick Duffek) - aeb, 950610
-.TH STRTOL 3  2015-08-08 "GNU" "Linux Programmer's Manual"
+.TH STRTOL 3  2019-10-10 "GNU" "Linux Programmer's Manual"
 .SH NAME
 strtol, strtoll, strtoq \- convert a string to a long integer
 .SH SYNOPSIS
 .nf
 .B #include <stdlib.h>
-.sp
+.PP
 .BI "long int strtol(const char *" nptr ", char **" endptr ", int " base );
-.sp
+.PP
 .BI "long long int strtoll(const char *" nptr ", char **" endptr \
 ", int " base );
 .fi
-.sp
+.PP
 .in -4n
 Feature Test Macro Requirements for glibc (see
 .BR feature_test_macros (7)):
 .in
-.sp
+.PP
 .ad l
 .BR strtoll ():
 .RS 4
@@ -70,7 +70,7 @@ followed by a single optional \(aq+\(aq or \(aq\-\(aq sign.
 If
 .I base
 is zero or 16, the string may then include a
-"0x" prefix, and the number will be read in base 16; otherwise, a
+"0x" or "0X" prefix, and the number will be read in base 16; otherwise, a
 zero
 .I base
 is taken as 10 (decimal) unless the next character
@@ -102,9 +102,9 @@ in
 (and returns 0).
 In particular, if
 .I *nptr
-is not \(aq\\0\(aq but
+is not \(aq\e0\(aq but
 .I **endptr
-is \(aq\\0\(aq on return, the entire string is valid.
+is \(aq\e0\(aq on return, the entire string is valid.
 .PP
 The
 .BR strtoll ()
@@ -148,7 +148,7 @@ contains an unsupported value.
 .TP
 .B ERANGE
 The resulting value was out of range.
-.LP
+.PP
 The implementation may also set
 .IR errno
 to
@@ -172,7 +172,7 @@ T}  Thread safety   MT-Safe locale
 .SH CONFORMING TO
 .BR strtol ():
 POSIX.1-2001, POSIX.1-2008, C89, C99 SVr4, 4.3BSD.
-
+.PP
 .BR strtoll ():
 POSIX.1-2001, POSIX.1-2008, C99.
 .SH NOTES
@@ -193,20 +193,20 @@ 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
 According to POSIX.1,
 in locales other than the "C" and "POSIX",
 these functions may accept other,
 implementation-defined numeric strings.
-.LP
+.PP
 BSD also has
-.sp
+.PP
 .in +4n
-.nf
+.EX
 .BI "quad_t strtoq(const char *" nptr ", char **" endptr ", int " base );
-.sp
+.EE
 .in
-.fi
+.PP
 with completely analogous definition.
 Depending on the wordsize of the current architecture, this
 may be equivalent to
@@ -227,9 +227,9 @@ a function that performs no error checking and
 has a simpler interface than
 .BR strtol ().)
 Some examples of the results produced by this program are the following:
+.PP
 .in +4n
-.nf
-
+.EX
 .RB "$" " ./a.out 123"
 strtol() returned 123
 .RB "$" " ./a.out \(aq    123\(aq"
@@ -243,11 +243,11 @@ strtol: Invalid argument
 No digits were found
 .RB "$" " ./a.out 4000000000"
 strtol: Numerical result out of range
-.fi
+.EE
 .in
 .SS Program source
 \&
-.nf
+.EX
 #include <stdlib.h>
 #include <limits.h>
 #include <stdio.h>
@@ -261,7 +261,7 @@ main(int argc, char *argv[])
     long val;
 
     if (argc < 2) {
-        fprintf(stderr, "Usage: %s str [base]\\n", argv[0]);
+        fprintf(stderr, "Usage: %s str [base]\en", argv[0]);
         exit(EXIT_FAILURE);
     }
 
@@ -280,23 +280,24 @@ main(int argc, char *argv[])
     }
 
     if (endptr == str) {
-        fprintf(stderr, "No digits were found\\n");
+        fprintf(stderr, "No digits were found\en");
         exit(EXIT_FAILURE);
     }
 
     /* If we got here, strtol() successfully parsed a number */
 
-    printf("strtol() returned %ld\\n", val);
+    printf("strtol() returned %ld\en", val);
 
-    if (*endptr != \(aq\\0\(aq)        /* Not necessarily an error... */
-        printf("Further characters after number: %s\\n", endptr);
+    if (*endptr != \(aq\e0\(aq)        /* Not necessarily an error... */
+        printf("Further characters after number: %s\en", endptr);
 
     exit(EXIT_SUCCESS);
 }
-.fi
+.EE
 .SH SEE ALSO
 .BR atof (3),
 .BR atoi (3),
 .BR atol (3),
 .BR strtod (3),
-.BR strtoul (3)
+.BR strtoimax (3),
+.BR strtoul (3),