]> www.infradead.org Git - mtd-utils.git/commitdiff
flash_{un,}lock: move args processing to its own function
authorBrian Norris <computersforpeace@gmail.com>
Thu, 27 Aug 2015 21:57:58 +0000 (14:57 -0700)
committerBrian Norris <computersforpeace@gmail.com>
Wed, 11 Nov 2015 22:05:36 +0000 (14:05 -0800)
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
flash_unlock.c

index ce72e49d4ba6912437822fa9847ed124bfba8381..67277493d4b3dde6b0f3b931d3f3758dac3b3ca0 100644 (file)
@@ -48,13 +48,11 @@ static const struct option long_opts[] = {
        { NULL,         0,              0, 0 },
 };
 
-int main(int argc, char *argv[])
+/* Program arguments */
+static const char *dev, *offs_s, *count_s;
+
+static void process_args(int argc, char *argv[])
 {
-       int fd, request;
-       struct mtd_info_user mtdInfo;
-       struct erase_info_user mtdLockInfo;
-       int count;
-       const char *dev, *offs_s, *count_s;
        int arg_idx;
 
        for (;;) {
@@ -103,6 +101,17 @@ int main(int argc, char *argv[])
        else
                count_s = NULL;
 
+}
+
+int main(int argc, char *argv[])
+{
+       int fd, request;
+       struct mtd_info_user mtdInfo;
+       struct erase_info_user mtdLockInfo;
+       int count;
+
+       process_args(argc, argv);
+
        /* Get the device info to compare to command line sizes */
        fd = open(dev, O_RDWR);
        if (fd < 0)