|
Tor
0.4.7.0-alpha-dev
|
Locale-independent minimal implementation of sscanf(). More...
#include "lib/string/scanf.h"#include "lib/string/compat_ctype.h"#include "lib/cc/torint.h"#include "lib/err/torerr.h"#include <stdlib.h>Go to the source code of this file.
Macros | |
| #define | MAX_SCANF_WIDTH 9999 |
Functions | |
| static int | digit_to_num (char d) |
| static int | scan_unsigned (const char **bufp, unsigned long *out, int width, unsigned base) |
| static int | scan_signed (const char **bufp, long *out, int width) |
| static int | scan_double (const char **bufp, double *out, int width) |
| static int | scan_string (const char **bufp, char *out, int width) |
| int | tor_vsscanf (const char *buf, const char *pattern, va_list ap) |
| int | tor_sscanf (const char *buf, const char *pattern,...) |
Locale-independent minimal implementation of sscanf().
Definition in file scanf.c.
|
static |
Helper: given an ASCII-encoded decimal digit, return its numeric value. NOTE: requires that its input be in-bounds.
Definition at line 23 of file scanf.c.
Referenced by tor_vsscanf().
|
static |
|
static |
|
static |
|
static |
| int tor_sscanf | ( | const char * | buf, |
| const char * | pattern, | ||
| ... | |||
| ) |
Minimal sscanf replacement: parse buf according to pattern and store the results in the corresponding argument fields. Differs from sscanf in that:
(As with other locale-independent functions, we need this to parse data that is in ASCII without worrying that the C library's locale-handling will make miscellaneous characters look like numbers, spaces, and so on.)
Definition at line 309 of file scanf.c.
Referenced by parse_http_time(), parse_iso_time_(), tor_inet_aton(), and tor_inet_pton().
| int tor_vsscanf | ( | const char * | buf, |
| const char * | pattern, | ||
| va_list | ap | ||
| ) |
Locale-independent, minimal, no-surprises scanf variant, accepting only a restricted pattern format. For more info on what it supports, see tor_sscanf() documentation.
Definition at line 179 of file scanf.c.
Referenced by tor_sscanf().