diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/libbb.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/include/libbb.h b/include/libbb.h index 118d777bc..03fc5d44b 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -190,7 +190,7 @@ typedef unsigned long long uoff_t; | |||
190 | /* While sizeof(off_t) == sizeof(int), off_t is typedef'ed to long anyway. | 190 | /* While sizeof(off_t) == sizeof(int), off_t is typedef'ed to long anyway. |
191 | * gcc will throw warnings on printf("%d", off_t). Crap... */ | 191 | * gcc will throw warnings on printf("%d", off_t). Crap... */ |
192 | typedef unsigned long uoff_t; | 192 | typedef unsigned long uoff_t; |
193 | # define XATOOFF(a) xatoi_u(a) | 193 | # define XATOOFF(a) xatoi_positive(a) |
194 | # define BB_STRTOOFF bb_strtou | 194 | # define BB_STRTOOFF bb_strtou |
195 | # define STRTOOFF strtol | 195 | # define STRTOOFF strtol |
196 | # define OFF_FMT "l" | 196 | # define OFF_FMT "l" |
@@ -765,11 +765,16 @@ struct suffix_mult { | |||
765 | }; | 765 | }; |
766 | #include "xatonum.h" | 766 | #include "xatonum.h" |
767 | /* Specialized: */ | 767 | /* Specialized: */ |
768 | |||
768 | /* Using xatoi() instead of naive atoi() is not always convenient - | 769 | /* Using xatoi() instead of naive atoi() is not always convenient - |
769 | * in many places people want *non-negative* values, but store them | 770 | * in many places people want *non-negative* values, but store them |
770 | * in signed int. Therefore we need this one: | 771 | * in signed int. Therefore we need this one: |
771 | * dies if input is not in [0, INT_MAX] range. Also will reject '-0' etc */ | 772 | * dies if input is not in [0, INT_MAX] range. Also will reject '-0' etc. |
772 | int xatoi_u(const char *numstr) FAST_FUNC; | 773 | * It should really be named xatoi_nonnegative (since it allows 0), |
774 | * but that would be too long. | ||
775 | */ | ||
776 | int xatoi_positive(const char *numstr) FAST_FUNC; | ||
777 | |||
773 | /* Useful for reading port numbers */ | 778 | /* Useful for reading port numbers */ |
774 | uint16_t xatou16(const char *numstr) FAST_FUNC; | 779 | uint16_t xatou16(const char *numstr) FAST_FUNC; |
775 | 780 | ||