lib: Add flag definitions to control the internal string to int conversion routines
authorSwen Schillig <swen@linux.ibm.com>
Tue, 25 Jun 2019 08:25:08 +0000 (10:25 +0200)
committerRalph Boehme <slow@samba.org>
Sun, 30 Jun 2019 11:32:18 +0000 (11:32 +0000)
The following flags are defined intially

    SMB_STR_STANDARD # raise error if negative or non-numeric
    SMB_STR_ALLOW_NEGATIVE # allow strings with a leading "-"
    SMB_STR_FULL_STR_CONV # entire string must be converted
    SMB_STR_ALLOW_NO_CONVERSION # allow empty strings or non-numeric
    SMB_STR_GLIBC_STANDARD # act exactly as the standard glibc strtoul

Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
lib/util/util.h

index fcd81759b9ce25002dc6cea9e3b89a6989488b37..2ed036358d042204f113c8b3f3a4d97999ec5ab5 100644 (file)
 #ifndef __UTIL_SAMBA_UTIL_H__
 #define __UTIL_SAMBA_UTIL_H__
 
+#define SMB_STR_STANDARD  0x00
+#define SMB_STR_ALLOW_NEGATIVE 0x01
+#define SMB_STR_FULL_STR_CONV  0x02
+#define SMB_STR_ALLOW_NO_CONVERSION 0x04
+#define SMB_STR_GLIBC_STANDARD (SMB_STR_ALLOW_NO_CONVERSION | \
+                               SMB_STR_ALLOW_NEGATIVE)
+
 unsigned long int
 strtoul_err(const char *nptr, char **endptr, int base, int *err);