Lines Matching +full:3 +full:base +full:- +full:x

1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
18 * 3. Neither the name of the University nor the names of its contributors
65 #define SIGNOK 0x40 /* +/- is (still) legal */
69 #define EXPOK 0x200 /* (float) exponent (e+3, etc) still legal */
71 #define PFXOK 0x100 /* 0x prefix is (still) legal */
80 #define CT_INT 3 /* integer, i.e., strtoq or strtouq */
111 int base; /* base argument to strtoq/strtouq */ in vsscanf() local
118 { 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }; in vsscanf()
125 base = 0; /* XXX just to keep gcc happy */ in vsscanf()
133 nread++, inr--, inp++; in vsscanf()
152 inr--, inp++; in vsscanf()
188 case '0': case '1': case '2': case '3': case '4': in vsscanf()
190 width = width * 10 + c - '0'; in vsscanf()
200 base = 10; in vsscanf()
206 base = 0; in vsscanf()
212 base = 8; in vsscanf()
218 base = 10; in vsscanf()
221 case 'x': in vsscanf()
222 flags |= PFXOK; /* enable 0x prefixing */ in vsscanf()
225 base = 16; in vsscanf()
247 base = 16; in vsscanf()
286 if (--inr > 0) in vsscanf()
311 width -= n; in vsscanf()
318 inr -= width; in vsscanf()
326 inr -= width; in vsscanf()
342 n++, inr--, inp++; in vsscanf()
343 if (--width == 0) in vsscanf()
356 inr--; in vsscanf()
358 if (--width == 0) in vsscanf()
366 n = p - p0; in vsscanf()
377 /* like CCL, but zero-length string OK, & no NOSKIP */ in vsscanf()
383 n++, inr--, inp++; in vsscanf()
384 if (--width == 0) in vsscanf()
393 inr--; in vsscanf()
395 if (--width == 0) in vsscanf()
401 nread += p - p0; in vsscanf()
410 if (width == 0 || width > sizeof(buf) - 1) in vsscanf()
411 width = sizeof(buf) - 1; in vsscanf()
414 if (--width > sizeof(buf) - 2) in vsscanf()
415 width = sizeof(buf) - 2; in vsscanf()
419 for (p = buf; width; width--) { in vsscanf()
431 * base==0. In that case, we should set in vsscanf()
432 * it to 8 and enable 0x prefixing. in vsscanf()
439 if (base == 0) { in vsscanf()
440 base = 8; in vsscanf()
450 case '1': case '2': case '3': in vsscanf()
452 base = basefix[base]; in vsscanf()
458 base = basefix[base]; in vsscanf()
459 if (base <= 8) in vsscanf()
469 /* no need to fix base here */ in vsscanf()
470 if (base <= 10) in vsscanf()
476 case '+': case '-': in vsscanf()
483 /* x ok iff flag still set & 2nd char */ in vsscanf()
484 case 'x': case 'X': in vsscanf()
486 base = 16; /* if %i */ in vsscanf()
503 if (--inr > 0) in vsscanf()
510 * back the sign. If the number ends in `x', in vsscanf()
511 * it was [sign] '0' 'x', so push back the x in vsscanf()
516 inp--; in vsscanf()
521 c = ((u_char *)p)[-1]; in vsscanf()
522 if (c == 'x' || c == 'X') { in vsscanf()
523 --p; in vsscanf()
524 inp--; in vsscanf()
531 res = (*ccfn)(buf, (char **)NULL, base); in vsscanf()
553 nread += p - buf; in vsscanf()
559 return (nconversions != 0 ? nassigned : -1); in vsscanf()
588 return (fmt - 1);/* format ended before closing ] */ in __sccl()
594 * The first character may be ']' (or '-') without being special; in __sccl()
595 * the last character may be '-'. in __sccl()
597 v = 1 - v; in __sccl()
604 return (fmt - 1); in __sccl()
606 case '-': in __sccl()
609 * [01+-] in __sccl()
611 * the character +, the character -', but in __sccl()
613 * [a-zA-Z0-9] in __sccl()
615 * scanf treats `a-z' as `the letters a through in __sccl()
616 * z', but treats `a-a' as `the letter a, the in __sccl()
617 * character -, and the letter a'. in __sccl()
619 * For compatibility, the `-' is not considered in __sccl()
627 c = '-'; in __sccl()
638 * such as [a-c-e] as `the letters a through e'. in __sccl()