From 9ecb87f3e6b0ec184d5a4bd2d0703ac7880cb06a Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Sun, 15 May 2016 20:33:20 +0200 Subject: [PATCH] Fixing station ID command line parameter --- src/cnetz/main.c | 7 +++++++ src/nmt/main.c | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/cnetz/main.c b/src/cnetz/main.c index f9ed9bf..acab04f 100644 --- a/src/cnetz/main.c +++ b/src/cnetz/main.c @@ -79,6 +79,8 @@ void print_help(const char *arg0) printf(" Enable authentication on the base station. Since we cannot\n"); printf(" authenticate, because we don't know the secret key and the algorithm,\n"); printf(" we just accept any card. With this we get the vendor IDs of the phone.\n"); + printf("\nstation-id: Give 7 digit station-id, you don't need to enter it for every\n"); + printf(" start of this program.\n"); } static int handle_options(int argc, char **argv) @@ -195,6 +197,11 @@ int main(int argc, char *argv[]) argv += skip_args; if (argc > 1) { + station_id = argv[1]; + if (strlen(station_id) != 7) { + printf("Given station ID '%s' does not have 7 digits\n", station_id); + return 0; + } } if (!num_kanal) { diff --git a/src/nmt/main.c b/src/nmt/main.c index 210a790..afd049c 100644 --- a/src/nmt/main.c +++ b/src/nmt/main.c @@ -202,8 +202,13 @@ int main(int argc, char *argv[]) argc -= skip_args; argv += skip_args; - if (argc > 1) + if (argc > 1) { station_id = argv[1]; + if (strlen(station_id) != 7) { + printf("Given station ID '%s' does not have 7 digits\n", station_id); + return 0; + } + } if (!num_kanal) { printf("No channel (\"Kanal\") is specified, I suggest channel 1 (-k 1).\n\n");