make it optional where the hlr database is stored
Add --database to define where the database is stored. The default
was changed to not store the file in /tmp anymore.
diff --git a/src/bsc_hack.c b/src/bsc_hack.c
index 274a9cf..3076758 100644
--- a/src/bsc_hack.c
+++ b/src/bsc_hack.c
@@ -46,6 +46,7 @@
/* MCC and MNC for the Location Area Identifier */
static int MCC = 1;
static int MNC = 1;
+static const char *database_name = "hlr.sqlite3";
/* The following definitions are for OM and NM packets that we cannot yet
@@ -653,6 +654,7 @@
printf(" -s --disable-color\n");
printf(" -n --network-code number(MNC) \n");
printf(" -c --country-code number (MCC) \n");
+ printf(" -l --database db-name The database to use\n");
printf(" -h --help this text\n");
}
@@ -666,6 +668,7 @@
{"disable-color", 0, 0, 's'},
{"network-code", 1, 0, 'n'},
{"country-code", 1, 0, 'c'},
+ {"database", 1, 0, 'l'},
{0, 0, 0, 0}
};
@@ -691,6 +694,9 @@
case 'c':
MCC = atoi(optarg);
break;
+ case 'l':
+ database_name = strdup(optarg);
+ break;
default:
/* ignore */
break;
@@ -771,7 +777,7 @@
/* parse options */
handle_options(argc, argv);
- if (db_init()) {
+ if (db_init(database_name)) {
printf("DB: Failed to init database. Please check the option settings.\n");
return 1;
}