Rev 4874 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4874 | Rev 4921 | ||
---|---|---|---|
1 | /* |
1 | /* |
2 | FUNCTION |
2 | FUNCTION |
3 | < |
3 | < |
4 | 4 | ||
5 | INDEX |
5 | INDEX |
6 | strtoll |
6 | strtoll |
7 | INDEX |
7 | INDEX |
8 | _strtoll_r |
8 | _strtoll_r |
9 | 9 | ||
10 | ANSI_SYNOPSIS |
10 | ANSI_SYNOPSIS |
11 | #include |
11 | #include |
12 | long long strtoll(const char *<[s]>, char **<[ptr]>,int <[base]>); |
12 | long long strtoll(const char *restrict <[s]>, char **restrict <[ptr]>,int <[base]>); |
13 | 13 | ||
14 | long long _strtoll_r(void *<[reent]>, |
14 | long long _strtoll_r(void *<[reent]>, |
15 | const char *<[s]>, char **<[ptr]>,int <[base]>); |
15 | const char *restrict <[s]>, char **restrict <[ptr]>,int <[base]>); |
16 | 16 | ||
17 | TRAD_SYNOPSIS |
17 | TRAD_SYNOPSIS |
18 | #include |
18 | #include |
19 | long long strtoll (<[s]>, <[ptr]>, <[base]>) |
19 | long long strtoll (<[s]>, <[ptr]>, <[base]>) |
20 | const char *<[s]>; |
20 | const char *<[s]>; |
21 | char **<[ptr]>; |
21 | char **<[ptr]>; |
22 | int <[base]>; |
22 | int <[base]>; |
23 | 23 | ||
24 | long long _strtoll_r (<[reent]>, <[s]>, <[ptr]>, <[base]>) |
24 | long long _strtoll_r (<[reent]>, <[s]>, <[ptr]>, <[base]>) |
25 | char *<[reent]>; |
25 | char *<[reent]>; |
26 | const char *<[s]>; |
26 | const char *<[s]>; |
27 | char **<[ptr]>; |
27 | char **<[ptr]>; |
28 | int <[base]>; |
28 | int <[base]>; |
29 | 29 | ||
30 | DESCRIPTION |
30 | DESCRIPTION |
31 | The function < |
31 | The function < |
32 | a < |
32 | a < |
33 | leading whitespace, which is ignored; a subject string consisting |
33 | leading whitespace, which is ignored; a subject string consisting |
34 | of characters resembling an integer in the radix specified by <[base]>; |
34 | of characters resembling an integer in the radix specified by <[base]>; |
35 | and a trailing portion consisting of zero or more unparseable characters, |
35 | and a trailing portion consisting of zero or more unparseable characters, |
36 | and always including the terminating null character. Then, it attempts |
36 | and always including the terminating null character. Then, it attempts |
37 | to convert the subject string into a < |
37 | to convert the subject string into a < |
38 | result. |
38 | result. |
39 | 39 | ||
40 | If the value of <[base]> is 0, the subject string is expected to look |
40 | If the value of <[base]> is 0, the subject string is expected to look |
41 | like a normal C integer constant: an optional sign, a possible `<<0x>>' |
41 | like a normal C integer constant: an optional sign, a possible `<<0x>>' |
42 | indicating a hexadecimal base, and a number. If <[base]> is between |
42 | indicating a hexadecimal base, and a number. If <[base]> is between |
43 | 2 and 36, the expected form of the subject is a sequence of letters |
43 | 2 and 36, the expected form of the subject is a sequence of letters |
44 | and digits representing an integer in the radix specified by <[base]>, |
44 | and digits representing an integer in the radix specified by <[base]>, |
45 | with an optional plus or minus sign. The letters <>--< |
45 | with an optional plus or minus sign. The letters <>--< |
46 | equivalently, <>--< |
46 | equivalently, <>--< |
47 | only letters whose ascribed values are less than <[base]> are |
47 | only letters whose ascribed values are less than <[base]> are |
48 | permitted. If <[base]> is 16, a leading <<0x>> is permitted. |
48 | permitted. If <[base]> is 16, a leading <<0x>> is permitted. |
49 | 49 | ||
50 | The subject sequence is the longest initial sequence of the input |
50 | The subject sequence is the longest initial sequence of the input |
51 | string that has the expected form, starting with the first |
51 | string that has the expected form, starting with the first |
52 | non-whitespace character. If the string is empty or consists entirely |
52 | non-whitespace character. If the string is empty or consists entirely |
53 | of whitespace, or if the first non-whitespace character is not a |
53 | of whitespace, or if the first non-whitespace character is not a |
54 | permissible letter or digit, the subject string is empty. |
54 | permissible letter or digit, the subject string is empty. |
55 | 55 | ||
56 | If the subject string is acceptable, and the value of <[base]> is zero, |
56 | If the subject string is acceptable, and the value of <[base]> is zero, |
57 | < |
57 | < |
58 | string with a leading <<0x>> is treated as a hexadecimal value; a string with |
58 | string with a leading <<0x>> is treated as a hexadecimal value; a string with |
59 | a leading 0 and no < |
59 | a leading 0 and no < |
60 | treated as decimal. If <[base]> is between 2 and 36, it is used as the |
60 | treated as decimal. If <[base]> is between 2 and 36, it is used as the |
61 | conversion radix, as described above. If the subject string begins with |
61 | conversion radix, as described above. If the subject string begins with |
62 | a minus sign, the value is negated. Finally, a pointer to the first |
62 | a minus sign, the value is negated. Finally, a pointer to the first |
63 | character past the converted subject string is stored in <[ptr]>, if |
63 | character past the converted subject string is stored in <[ptr]>, if |
64 | <[ptr]> is not < |
64 | <[ptr]> is not < |
65 | 65 | ||
66 | If the subject string is empty (or not in acceptable form), no conversion |
66 | If the subject string is empty (or not in acceptable form), no conversion |
67 | is performed and the value of <[s]> is stored in <[ptr]> (if <[ptr]> is |
67 | is performed and the value of <[s]> is stored in <[ptr]> (if <[ptr]> is |
68 | not < |
68 | not < |
69 | 69 | ||
70 | The alternate function <<_strtoll_r>> is a reentrant version. The |
70 | The alternate function <<_strtoll_r>> is a reentrant version. The |
71 | extra argument <[reent]> is a pointer to a reentrancy structure. |
71 | extra argument <[reent]> is a pointer to a reentrancy structure. |
72 | 72 | ||
73 | RETURNS |
73 | RETURNS |
74 | < |
74 | < |
75 | made, 0 is returned. |
75 | made, 0 is returned. |
76 | 76 | ||
77 | < |
77 | < |
78 | the converted value is too large, and sets < |
78 | the converted value is too large, and sets < |
79 | 79 | ||
80 | PORTABILITY |
80 | PORTABILITY |
81 | < |
81 | < |
82 | 82 | ||
83 | No supporting OS subroutines are required. |
83 | No supporting OS subroutines are required. |
84 | */ |
84 | */ |
85 | 85 | ||
86 | /*- |
86 | /*- |
87 | * Copyright (c) 1990 The Regents of the University of California. |
87 | * Copyright (c) 1990 The Regents of the University of California. |
88 | * All rights reserved. |
88 | * All rights reserved. |
89 | * |
89 | * |
90 | * Redistribution and use in source and binary forms, with or without |
90 | * Redistribution and use in source and binary forms, with or without |
91 | * modification, are permitted provided that the following conditions |
91 | * modification, are permitted provided that the following conditions |
92 | * are met: |
92 | * are met: |
93 | * 1. Redistributions of source code must retain the above copyright |
93 | * 1. Redistributions of source code must retain the above copyright |
94 | * notice, this list of conditions and the following disclaimer. |
94 | * notice, this list of conditions and the following disclaimer. |
95 | * 2. Redistributions in binary form must reproduce the above copyright |
95 | * 2. Redistributions in binary form must reproduce the above copyright |
96 | * notice, this list of conditions and the following disclaimer in the |
96 | * notice, this list of conditions and the following disclaimer in the |
97 | * documentation and/or other materials provided with the distribution. |
97 | * documentation and/or other materials provided with the distribution. |
98 | * 3. All advertising materials mentioning features or use of this software |
98 | * 3. All advertising materials mentioning features or use of this software |
99 | * must display the following acknowledgement: |
99 | * must display the following acknowledgement: |
100 | * This product includes software developed by the University of |
100 | * This product includes software developed by the University of |
101 | * California, Berkeley and its contributors. |
101 | * California, Berkeley and its contributors. |
102 | * 4. Neither the name of the University nor the names of its contributors |
102 | * 4. Neither the name of the University nor the names of its contributors |
103 | * may be used to endorse or promote products derived from this software |
103 | * may be used to endorse or promote products derived from this software |
104 | * without specific prior written permission. |
104 | * without specific prior written permission. |
105 | * |
105 | * |
106 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
106 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
107 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
107 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
108 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
108 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
109 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
109 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
110 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
110 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
111 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
111 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
112 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
112 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
113 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
113 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
114 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
114 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
115 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
115 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
116 | * SUCH DAMAGE. |
116 | * SUCH DAMAGE. |
117 | */ |
117 | */ |
118 | 118 | ||
119 | 119 | ||
120 | #include <_ansi.h> |
120 | #include <_ansi.h> |
121 | #include |
121 | #include |
122 | #include |
122 | #include |
123 | #include |
123 | #include |
124 | #include |
124 | #include |
125 | #include |
125 | #include |
126 | 126 | ||
127 | #ifndef _REENT_ONLY |
127 | #ifndef _REENT_ONLY |
128 | 128 | ||
129 | long long |
129 | long long |
130 | _DEFUN (strtoll, (s, ptr, base), |
130 | _DEFUN (strtoll, (s, ptr, base), |
131 | _CONST char *s _AND |
131 | _CONST char *__restrict s _AND |
132 | char **ptr _AND |
132 | char **__restrict ptr _AND |
133 | int base) |
133 | int base) |
134 | { |
134 | { |
135 | return _strtoll_r (_REENT, s, ptr, base); |
135 | return _strtoll_r (_REENT, s, ptr, base); |
136 | } |
136 | } |
137 | 137 | ||
138 | #endif |
138 | #endif |