diff options
Diffstat (limited to 'include/libbb.h')
-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 a7814b75f..3a7a8f33f 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -201,7 +201,7 @@ typedef unsigned long long uoff_t; | |||
201 | /* While sizeof(off_t) == sizeof(int), off_t is typedef'ed to long anyway. | 201 | /* While sizeof(off_t) == sizeof(int), off_t is typedef'ed to long anyway. |
202 | * gcc will throw warnings on printf("%d", off_t). Crap... */ | 202 | * gcc will throw warnings on printf("%d", off_t). Crap... */ |
203 | typedef unsigned long uoff_t; | 203 | typedef unsigned long uoff_t; |
204 | # define XATOOFF(a) xatoi_u(a) | 204 | # define XATOOFF(a) xatoi_positive(a) |
205 | # define BB_STRTOOFF bb_strtou | 205 | # define BB_STRTOOFF bb_strtou |
206 | # define STRTOOFF strtol | 206 | # define STRTOOFF strtol |
207 | # define OFF_FMT "l" | 207 | # define OFF_FMT "l" |
@@ -781,11 +781,16 @@ struct suffix_mult { | |||
781 | }; | 781 | }; |
782 | #include "xatonum.h" | 782 | #include "xatonum.h" |
783 | /* Specialized: */ | 783 | /* Specialized: */ |
784 | |||
784 | /* Using xatoi() instead of naive atoi() is not always convenient - | 785 | /* Using xatoi() instead of naive atoi() is not always convenient - |
785 | * in many places people want *non-negative* values, but store them | 786 | * in many places people want *non-negative* values, but store them |
786 | * in signed int. Therefore we need this one: | 787 | * in signed int. Therefore we need this one: |
787 | * dies if input is not in [0, INT_MAX] range. Also will reject '-0' etc */ | 788 | * dies if input is not in [0, INT_MAX] range. Also will reject '-0' etc. |
788 | int xatoi_u(const char *numstr) FAST_FUNC; | 789 | * It should really be named xatoi_nonnegative (since it allows 0), |
790 | * but that would be too long. | ||
791 | */ | ||
792 | int xatoi_positive(const char *numstr) FAST_FUNC; | ||
793 | |||
789 | /* Useful for reading port numbers */ | 794 | /* Useful for reading port numbers */ |
790 | uint16_t xatou16(const char *numstr) FAST_FUNC; | 795 | uint16_t xatou16(const char *numstr) FAST_FUNC; |
791 | 796 | ||