- val = 0;
- for( ; String[i] && String[i] != '.'; i++ )
- {
- if('0' > String[i] || String[i] > '9') {
- #if DEBUG
- printf("0<c<9 expected, '%c' found\n", String[i]);
- #endif
- return 0;
- }
- val = val*10 + String[i] - '0';
+ char *end;
+ unsigned long val = strtoul(pos, &end, 10);
+ if( *end && *end != '.' ) {
+ #if DEBUG
+ _SysDebug("%s: Unexpected character, '%c' found", __func__, *end);
+ #endif
+ return 0;
+ }
+ if( *pos == '.' ) {
+ #if DEBUG
+ _SysDebug("%s: Two dots in a row", __func__);
+ #endif
+ return 0;