patch-2.4.0-test12 linux/lib/vsprintf.c
Next file: linux/mm/filemap.c
Previous file: linux/kernel/user.c
Back to the patch index
Back to the overall index
- Lines: 39
- Date:
Mon Nov 27 17:44:26 2000
- Orig file:
v2.4.0-test11/linux/lib/vsprintf.c
- Orig date:
Tue Jun 20 14:32:27 2000
diff -u --recursive --new-file v2.4.0-test11/linux/lib/vsprintf.c linux/lib/vsprintf.c
@@ -48,6 +48,38 @@
return simple_strtoul(cp,endp,base);
}
+unsigned long long simple_strtoull(const char *cp,char **endp,unsigned int base)
+{
+ unsigned long long result = 0,value;
+
+ if (!base) {
+ base = 10;
+ if (*cp == '0') {
+ base = 8;
+ cp++;
+ if ((*cp == 'x') && isxdigit(cp[1])) {
+ cp++;
+ base = 16;
+ }
+ }
+ }
+ while (isxdigit(*cp) && (value = isdigit(*cp) ? *cp-'0' : (islower(*cp)
+ ? toupper(*cp) : *cp)-'A'+10) < base) {
+ result = result*base + value;
+ cp++;
+ }
+ if (endp)
+ *endp = (char *)cp;
+ return result;
+}
+
+long long simple_strtoll(const char *cp,char **endp,unsigned int base)
+{
+ if(*cp=='-')
+ return -simple_strtoull(cp+1,endp,base);
+ return simple_strtoull(cp,endp,base);
+}
+
static int skip_atoi(const char **s)
{
int i=0;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)