Browse Source

adding get_int_value() function for parsing parameters

Richard Garnier 9 years ago
parent
commit
8226747791
1 changed files with 7 additions and 0 deletions
  1. 7 0
      src/apps/relay/mainrelay.c

+ 7 - 0
src/apps/relay/mainrelay.c

@@ -878,6 +878,13 @@ static const struct myoption admin_long_options[] = {
 				{ NULL, no_argument, NULL, 0 }
 				{ NULL, no_argument, NULL, 0 }
 };
 };
 
 
+static int get_int_value(const char* s, int default_value)
+{
+	if (!s || !(s[0]))
+		return default_value;
+	return atoi(s);
+}
+
 static int get_bool_value(const char* s)
 static int get_bool_value(const char* s)
 {
 {
 	if(!s || !(s[0])) return 1;
 	if(!s || !(s[0])) return 1;