Signed-off-by: Michael Brown <mcb30@ipxe.org>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
+#include <ctype.h>
#include <errno.h>
#include <assert.h>
#include <ipxe/init.h>
unsigned long strtoul ( const char *p, char **endp, int base ) {
unsigned long ret = 0;
+ int negative = 0;
unsigned int charval;
+ while ( isspace ( *p ) )
+ p++;
+
+ if ( *p == '-' ) {
+ negative = 1;
+ p++;
+ }
+
base = strtoul_base ( &p, base );
while ( 1 ) {
p++;
}
+ if ( negative )
+ ret = -ret;
+
if ( endp )
*endp = ( char * ) p;
*/
unsigned long long strtoull ( const char *p, char **endp, int base ) {
unsigned long long ret = 0;
+ int negative = 0;
unsigned int charval;
+ while ( isspace ( *p ) )
+ p++;
+
+ if ( *p == '-' ) {
+ negative = 1;
+ p++;
+ }
+
base = strtoul_base ( &p, base );
while ( 1 ) {
p++;
}
+ if ( negative )
+ ret = -ret;
+
if ( endp )
*endp = ( char * ) p;
#include <stdint.h>
#include <assert.h>
-#include <ctype.h>
/*****************************************************************************
*
{
const char *p = *pp;
- while ( isspace ( *p ) )
- p++;
-
if ( base == 0 ) {
base = 10;
if ( *p == '0' ) {