aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.old4
-rw-r--r--cmd2.c11
2 files changed, 13 insertions, 2 deletions
diff --git a/ChangeLog.old b/ChangeLog.old
index 6ef8952..f9c8f7e 100644
--- a/ChangeLog.old
+++ b/ChangeLog.old
@@ -1,3 +1,7 @@
+2009-04-07 jahara
+
+ * cmd2.c: Fixed setting alias/action groups back to default.
+
2009-03-25 kalev
* autogen.sh: New script to regenerate autotools files.
diff --git a/cmd2.c b/cmd2.c
index 8267058..0c00202 100644
--- a/cmd2.c
+++ b/cmd2.c
@@ -191,11 +191,14 @@ void parse_alias __P1 (char *,str)
/* get alias again to add group (if needed)
* don't take the lookup penalty though if not changing groups */
- if( group != NULL && *group != '\0' ) {
+ if( group != NULL ) {
np = lookup_alias(left);
if( (*np)->group != NULL )
free((*np)->group);
+ if (*group == '\0')
+ group = NULL;
+
(*np)->group = my_strdup(group);
}
@@ -563,7 +566,7 @@ void parse_action __P2 (char *,str, int,onprompt)
type, regexp);
}
- if( group != NULL && *group != '\0' ) {
+ if( group != NULL ) {
/* I don't know why but we need to clip this because somehow
* the original string is restored to *p at some point instead
* of the null-clipped one we used waaaay at the top. */
@@ -572,6 +575,10 @@ void parse_action __P2 (char *,str, int,onprompt)
np = lookup_action(label);
if( (*np)->group != NULL )
free( (*np)->group );
+
+ if (*group == '\0')
+ group = NULL;
+
(*np) -> group = my_strdup( group );
}
}