[asterisk-commits] kmoore: branch 11 r396746 - in /branches/11: ./ main/asterisk.c main/cli.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Aug 15 11:29:58 CDT 2013


Author: kmoore
Date: Thu Aug 15 11:29:56 2013
New Revision: 396746

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=396746
Log:
Remove leading spaces from the CLI command before parsing

If you've mistakenly put a space before typing in a command, the
leading space will be included as part of the command, and the command
parser will not find the corresponding command. This patch rectifies
that situation by stripping the leading spaces on commands.

Review: https://reviewboard.asterisk.org/r/2709/
Patch-by: Tilghman Lesher
........

Merged revisions 396745 from http://svn.asterisk.org/svn/asterisk/branches/1.8

Modified:
    branches/11/   (props changed)
    branches/11/main/asterisk.c
    branches/11/main/cli.c

Propchange: branches/11/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: branches/11/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/main/asterisk.c?view=diff&rev=396746&r1=396745&r2=396746
==============================================================================
--- branches/11/main/asterisk.c (original)
+++ branches/11/main/asterisk.c Thu Aug 15 11:29:56 2013
@@ -1977,6 +1977,11 @@
 	/* Called when readline data is available */
 	if (!ast_all_zeros(s))
 		ast_el_add_history(s);
+
+	while (isspace(*s)) {
+		s++;
+	}
+
 	/* The real handler for bang */
 	if (s[0] == '!') {
 		if (s[1])

Modified: branches/11/main/cli.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/main/cli.c?view=diff&rev=396746&r1=396745&r2=396746
==============================================================================
--- branches/11/main/cli.c (original)
+++ branches/11/main/cli.c Thu Aug 15 11:29:56 2013
@@ -2299,6 +2299,13 @@
 		return NULL;
 
 	cur = duplicate;
+
+	/* Remove leading spaces from the command */
+	while (isspace(*s)) {
+		cur++;
+		s++;
+	}
+
 	/* scan the original string copying into cur when needed */
 	for (; *s ; s++) {
 		if (x >= max - 1) {




More information about the asterisk-commits mailing list