MCPcopy Create free account
hub / github.com/coreutils/coreutils / find_int

Function find_int

src/test.c:138–169  ·  view source on GitHub ↗

If the characters pointed to by STRING constitute a valid number, return a pointer to the start of the number, skipping any blanks or leading '+'. Otherwise, report an error and exit. */

Source from the content-addressed store, hash-verified

136 return a pointer to the start of the number, skipping any blanks or
137 leading '+'. Otherwise, report an error and exit. */
138static char const *
139find_int (char const *string)
140{
141 char const *p;
142 char const *number_start;
143
144 for (p = string; isspace (to_uchar (*p)); p++)
145 continue;
146
147 if (*p == '+')
148 {
149 p++;
150 number_start = p;
151 }
152 else
153 {
154 number_start = p;
155 p += (*p == '-');
156 }
157
158 if (c_isdigit (*p++))
159 {
160 while (c_isdigit (*p))
161 p++;
162 while (isspace (to_uchar (*p)))
163 p++;
164 if (!*p)
165 return number_start;
166 }
167
168 test_syntax_error (_("invalid integer %s"), quote (string));
169}
170
171/* Return the modification time of FILENAME.
172 If unsuccessful, return an invalid timestamp that is less

Callers 2

binary_operatorFunction · 0.85
unary_operatorFunction · 0.85

Calls 2

to_ucharFunction · 0.85
test_syntax_errorFunction · 0.85

Tested by

no test coverage detected