From b28dd9a135da2d62073840d05de430ec8dd8a58d Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 7 Nov 1999 18:49:58 +0000 Subject: First stab at text backend configurability [originally from svn r276] --- ustring.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'ustring.c') diff --git a/ustring.c b/ustring.c index f00a476..a6690c1 100644 --- a/ustring.c +++ b/ustring.c @@ -94,6 +94,36 @@ wchar_t *ustrlow(wchar_t *s) { return s; } +int utoi(wchar_t *s) { + int sign = +1; + int n; + + if (*s == L'-') { + s++; + sign = -1; + } + + n = 0; + while (*s && *s >= L'0' && *s <= L'9') { + n *= 10; + n += (*s - '0'); + s++; + } + + return n; +} + +int utob(wchar_t *s) { + if (!ustricmp(s, L"yes") || !ustricmp(s, L"y") || + !ustricmp(s, L"true") || !ustricmp(s, L"t")) + return TRUE; + return FALSE; +} + +int uisdigit(wchar_t c) { + return c >= L'0' && c <= L'9'; +} + #define USTRFTIME_DELTA 128 wchar_t *ustrftime(wchar_t *wfmt, struct tm *timespec) { void *blk = NULL; -- cgit v1.1