ipa: Make it possible to specify -w and -f in any order
Currently one has to put -w in front of -f to really write the
firmware file to disk. Change the config handling to first take
all parameters and then execute on them. This means -f can now
be used with any other parameter.
diff --git a/openbsc/src/ipaccess/ipaccess-config.c b/openbsc/src/ipaccess/ipaccess-config.c
index 93fe442..870950d 100644
--- a/openbsc/src/ipaccess/ipaccess-config.c
+++ b/openbsc/src/ipaccess/ipaccess-config.c
@@ -58,6 +58,7 @@
static int sw_load_state = 0;
static int oml_state = 0;
static int dump_files = 0;
+static char *firmware_analysis = NULL;
struct sw_load {
u_int8_t file_id[255];
@@ -677,8 +678,8 @@
exit(0);
break;
case 'f':
- analyze_firmware(optarg);
- exit(0);
+ firmware_analysis = optarg;
+ break;
case 'w':
dump_files = 1;
break;
@@ -689,8 +690,13 @@
}
};
+ if (firmware_analysis)
+ analyze_firmware(firmware_analysis);
+
if (optind >= argc) {
- fprintf(stderr, "you have to specify the IP address of the BTS. Use --help for more information\n");
+ /* only warn if we have not done anything else */
+ if (!firmware_analysis)
+ fprintf(stderr, "you have to specify the IP address of the BTS. Use --help for more information\n");
exit(2);
}