aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis R. Rodriguez <mcgrof@do-not-panic.com>2013-05-30 15:35:41 -0700
committerLuis R. Rodriguez <mcgrof@do-not-panic.com>2013-05-30 18:56:16 -0700
commit63b639732ee266fc67b4d459e653429006bb825c (patch)
treeafa99c6199118b39271cce4180d21e6cf67f066a
parentaa5f20519b16f9ba4ec1cb76724d8bba65dde1f9 (diff)
downloadcrda-63b639732ee266fc67b4d459e653429006bb825c.tar.gz
crda: move regdbprint to its own helper
We'll later move this to reglib but first we have to clean up the print utility to make it more general. Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
-rw-r--r--regdbdump.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/regdbdump.c b/regdbdump.c
index ea14730..edf3e7c 100644
--- a/regdbdump.c
+++ b/regdbdump.c
@@ -2,26 +2,35 @@
#include <errno.h>
#include "reglib.h"
-int main(int argc, char **argv)
+static int reglib_regdbdump(char *regdb_file)
{
const struct ieee80211_regdomain *rd = NULL;
unsigned int idx = 0;
- if (argc != 2) {
- fprintf(stderr, "Usage: %s <filename>\n", argv[0]);
- return 2;
- }
-
- reglib_for_each_country(rd, idx, argv[1]) {
+ reglib_for_each_country(rd, idx, regdb_file) {
reglib_print_regdom(rd);
free((struct ieee80211_regdomain *) rd);
}
if (!idx) {
- printf("Invalid or empty regulatory file, note: "
+ fprintf(stderr, "Invalid or empty regulatory file, note: "
"a binary regulatory file should be used.\n");
return -EINVAL;
}
return 0;
}
+
+int main(int argc, char **argv)
+{
+ int r;
+
+ if (argc != 2) {
+ fprintf(stderr, "Usage: %s <regulatory-binary-file>\n", argv[0]);
+ return 2;
+ }
+
+ r = reglib_regdbdump(argv[1]);
+
+ return r;
+}