fsck_minix: stop using data/bss
[oweals/busybox.git] / util-linux / losetup.c
index 54a160119cc2cc705334cf220752d8930cf247d7..e2d4e4d79162571f910ed09cd31ad41979eec091 100644 (file)
@@ -8,17 +8,17 @@
  */
 
 #include <getopt.h>
-#include <stdlib.h>
 
-#include "busybox.h"
+#include "libbb.h"
 
+int losetup_main(int argc, char **argv);
 int losetup_main(int argc, char **argv)
 {
-       unsigned long opt;
+       unsigned opt;
        char *opt_o;
-       int offset = 0;
+       unsigned long long offset = 0;
 
-       opt = bb_getopt_ulflags(argc, argv, "do:", &opt_o);
+       opt = getopt32(argc, argv, "do:", &opt_o);
        argc -= optind;
        argv += optind;
 
@@ -35,7 +35,7 @@ int losetup_main(int argc, char **argv)
        }
 
        if (opt == 0x2) // -o
-               offset = bb_xparse_number(opt_o, NULL);
+               offset = xatoull(opt_o);
 
        /* -o or no option */
 
@@ -44,9 +44,11 @@ int losetup_main(int argc, char **argv)
                        bb_perror_nomsg_and_die();
        } else if (argc == 1) {
                char *s = query_loop(argv[0]);
-               if (!s) bb_perror_nomsg_and_die();
+               if (!s)
+                       bb_perror_nomsg_and_die();
                printf("%s: %s\n", argv[0], s);
-               if (ENABLE_FEATURE_CLEAN_UP) free(s);
+               if (ENABLE_FEATURE_CLEAN_UP)
+                       free(s);
        } else {
                char dev[sizeof(LOOP_NAME"0")] = LOOP_NAME"0";
                char c;
@@ -56,7 +58,8 @@ int losetup_main(int argc, char **argv)
                        s = query_loop(dev);
                        if (s) {
                                printf("%s: %s\n", dev, s);
-                               if (ENABLE_FEATURE_CLEAN_UP) free(s);
+                               if (ENABLE_FEATURE_CLEAN_UP)
+                                       free(s);
                        }
                }
        }