aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gsm_data.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@netfilter.org>2009-08-08 16:12:58 +0200
committerHarald Welte <laforge@netfilter.org>2009-08-08 16:12:58 +0200
commit42581829ec2a79ef82c813b8212da76f514aa4f4 (patch)
tree0fb73c2964b6a6a97e998cd361389fa8887c1eca /openbsc/src/gsm_data.c
parent3c5cb256c2937d3671fda0daeb2c324105b0627c (diff)
the actual config file code (not just config files)
this was missing from commit a08a9acdb6bff0ee4fdf0f58b78b6525017a1f9f
Diffstat (limited to 'openbsc/src/gsm_data.c')
-rw-r--r--openbsc/src/gsm_data.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/openbsc/src/gsm_data.c b/openbsc/src/gsm_data.c
index 370c41097..edf1b3d05 100644
--- a/openbsc/src/gsm_data.c
+++ b/openbsc/src/gsm_data.c
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <string.h>
#include <errno.h>
+#include <ctype.h>
#include <openbsc/gsm_data.h>
#include <openbsc/talloc.h>
@@ -295,9 +296,15 @@ char *gsm_band_name(enum gsm_band band)
return "invalid";
}
-enum gsm_band gsm_band_parse(int mhz)
+enum gsm_band gsm_band_parse(const char* mhz)
{
- switch (mhz) {
+ while (*mhz && !isdigit(*mhz))
+ mhz++;
+
+ if (*mhz == '\0')
+ return -EINVAL;
+
+ switch (atoi(mhz)) {
case 400:
return GSM_BAND_400;
case 850: