]> mj.ucw.cz Git - libucw.git/blobdiff - ucw/strtonum-test.c
XTypes: Added support to configuration and option parser.
[libucw.git] / ucw / strtonum-test.c
index fd15714db9109ee86212c307f9f896b9b18c4439..53cd771f8ff579f529d820435dfee94e3c7cb2e2 100644 (file)
@@ -7,15 +7,15 @@
  *     of the GNU Lesser General Public License.
  */
 
  *     of the GNU Lesser General Public License.
  */
 
-#include "ucw/lib.h"
-#include "ucw/chartype.h"
-#include "ucw/strtonum.h"
+#include <ucw/lib.h>
+#include <ucw/chartype.h>
+#include <ucw/strtonum.h>
 
 #include <stdio.h>
 
 
 #include <stdio.h>
 
-static uns str_to_flags(const char *str)
+static uint str_to_flags(const char *str)
 {
 {
-   uns flags = 0;
+   uint flags = 0;
    for(const char *p = str; *p; ++p)
      {
        switch(*p)
    for(const char *p = str; *p; ++p)
      {
        switch(*p)
@@ -39,6 +39,9 @@ static uns str_to_flags(const char *str)
            case 'o':
              flags |= STN_OCT;
              break;
            case 'o':
              flags |= STN_OCT;
              break;
+           case 'O':
+             flags |= STN_OCT0;
+             break;
            case 'B':
              flags |= STN_BIN;
              break;
            case 'B':
              flags |= STN_BIN;
              break;
@@ -61,8 +64,8 @@ static uns str_to_flags(const char *str)
            case 's':
              flags |= STN_SIGNED;
              break;
            case 's':
              flags |= STN_SIGNED;
              break;
-           case 'Z':
-             flags |= STN_ZCHAR;
+           case 'W':
+             flags |= STN_WHOLE;
              break;
          }
      }
              break;
          }
      }
@@ -72,12 +75,12 @@ static uns str_to_flags(const char *str)
 
 static void convert(const char *str_flags, const char *str_num)
 {
 
 static void convert(const char *str_flags, const char *str_num)
 {
-  const uns flags = str_to_flags(str_flags);
+  const uint flags = str_to_flags(str_flags);
+
   const char *next1, *next2;
   const char *next1, *next2;
-  uns ux = 1234567890;
+  uint ux = 1234567890;
   uintmax_t um = 1234567890;
   uintmax_t um = 1234567890;
-  const char *err1 = str_to_uns(&ux, str_num, &next1, flags);
+  const char *err1 = str_to_uint(&ux, str_num, &next1, flags);
   const char *err2 = str_to_uintmax(&um, str_num, &next2, flags);
 
   if (flags & STN_SIGNED)
   const char *err2 = str_to_uintmax(&um, str_num, &next2, flags);
 
   if (flags & STN_SIGNED)