Harald Welte has submitted this change and it was merged.

Change subject: vty: add 'default' keyword to timer config
......................................................................


vty: add 'default' keyword to timer config

Change-Id: I4e837e8bedfad7ac4fd50048ecb016ddb37c2397
---
M openbsc/src/libbsc/bsc_vty.c
1 file changed, 14 insertions(+), 3 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c
index 49ff535..31eb143 100644
--- a/openbsc/src/libbsc/bsc_vty.c
+++ b/openbsc/src/libbsc/bsc_vty.c
@@ -1541,15 +1541,26 @@
        return CMD_SUCCESS;
 }
 
+#define DEFAULT_TIMER(number) GSM_T##number##_DEFAULT
+/* Add another expansion so that DEFAULT_TIMER() becomes its value */
+#define EXPAND_AND_STRINGIFY(x) OSMO_STRINGIFY(x)
+
 #define DECLARE_TIMER(number, doc) \
     DEFUN(cfg_net_T##number,                                   \
       cfg_net_T##number##_cmd,                                 \
-      "timer t" #number  " <1-65535>",                         \
+      "timer t" #number  " (default|<1-65535>)",               \
       "Configure GSM Timers\n"                                 \
-      doc "Timer Value in seconds\n")                          \
+      doc                                                      \
+      "Set to default timer value"                             \
+         " (" EXPAND_AND_STRINGIFY(DEFAULT_TIMER(number)) " seconds)\n" \
+      "Timer Value in seconds\n")                              \
 {                                                              \
        struct gsm_network *gsmnet = gsmnet_from_vty(vty);      \
-       int value = atoi(argv[0]);                              \
+       int value;                                              \
+       if (strcmp(argv[0], "default") == 0)                    \
+               value = DEFAULT_TIMER(number);                  \
+       else                                                    \
+               value = atoi(argv[0]);                          \
                                                                \
        gsmnet->T##number = value;                              \
        return CMD_SUCCESS;                                     \

-- 
To view, visit https://gerrit.osmocom.org/3339
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4e837e8bedfad7ac4fd50048ecb016ddb37c2397
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofm...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder

Reply via email to