summaryrefslogtreecommitdiff
path: root/flash_unlock.c
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2015-08-27 14:57:58 -0700
committerBrian Norris <computersforpeace@gmail.com>2015-11-11 14:05:36 -0800
commita21f42860f739653deb886a46c8fb6cbb9302e83 (patch)
tree2201ee5dd9086b45cd49dd08ebd3ea1ab004ad9b /flash_unlock.c
parent5b906ca06bd08fffb50afb64c68e161556bbfcbd (diff)
flash_{un,}lock: move args processing to its own function
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'flash_unlock.c')
-rw-r--r--flash_unlock.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/flash_unlock.c b/flash_unlock.c
index ce72e49..6727749 100644
--- a/flash_unlock.c
+++ b/flash_unlock.c
@@ -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)