Change in libosmocore[master]: vty: Allow using hex and octal representations in cmd numeric ranges

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Tue Jul 28 15:55:31 UTC 2020


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/19422 )


Change subject: vty: Allow using hex and octal representations in cmd numeric ranges
......................................................................

vty: Allow using hex and octal representations in cmd numeric ranges

Change-Id: Ia2b7fbbf5502c28374c21dbff548232680da27d4
---
M src/vty/command.c
1 file changed, 6 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/22/19422/1

diff --git a/src/vty/command.c b/src/vty/command.c
index 9b32d22..256f1db 100644
--- a/src/vty/command.c
+++ b/src/vty/command.c
@@ -1276,7 +1276,7 @@
 	if (range[1] == '-') {
 		signed long min = 0, max = 0, val;
 
-		val = strtol(str, &endptr, 10);
+		val = strtol(str, &endptr, 0);
 		if (*endptr != '\0')
 			return 0;
 
@@ -1288,7 +1288,7 @@
 			return 0;
 		strncpy(buf, range, p - range);
 		buf[p - range] = '\0';
-		min = -strtol(buf, &endptr, 10);
+		min = -strtol(buf, &endptr, 0);
 		if (*endptr != '\0')
 			return 0;
 
@@ -1300,7 +1300,7 @@
 			return 0;
 		strncpy(buf, range, p - range);
 		buf[p - range] = '\0';
-		max = strtol(buf, &endptr, 10);
+		max = strtol(buf, &endptr, 0);
 		if (*endptr != '\0')
 			return 0;
 
@@ -1309,7 +1309,7 @@
 	} else {
 		unsigned long min, max, val;
 
-		val = strtoul(str, &endptr, 10);
+		val = strtoul(str, &endptr, 0);
 		if (*endptr != '\0')
 			return 0;
 
@@ -1321,7 +1321,7 @@
 			return 0;
 		strncpy(buf, range, p - range);
 		buf[p - range] = '\0';
-		min = strtoul(buf, &endptr, 10);
+		min = strtoul(buf, &endptr, 0);
 		if (*endptr != '\0')
 			return 0;
 
@@ -1333,7 +1333,7 @@
 			return 0;
 		strncpy(buf, range, p - range);
 		buf[p - range] = '\0';
-		max = strtoul(buf, &endptr, 10);
+		max = strtoul(buf, &endptr, 0);
 		if (*endptr != '\0')
 			return 0;
 

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/19422
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ia2b7fbbf5502c28374c21dbff548232680da27d4
Gerrit-Change-Number: 19422
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200728/9a8ebd8f/attachment.htm>


More information about the gerrit-log mailing list