aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJahara <nschimme@gmail.com>2009-04-07 19:30:32 (GMT)
committerKalev Lember <kalev@smartlink.ee>2009-04-08 17:58:25 (GMT)
commit70beda9921c1131c178fe404543e8c49f1b48446 (patch)
tree088e755dabae6da152cb57490b3a9b314a448f18
parent71a0978128c12a4e2b36f3abb07c9070224ad373 (diff)
downloadpowwow-70beda9921c1131c178fe404543e8c49f1b48446.zip
powwow-70beda9921c1131c178fe404543e8c49f1b48446.tar.gz
powwow-70beda9921c1131c178fe404543e8c49f1b48446.tar.bz2
cmd2.c: Fixed setting alias/action groups back to default.
-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 );
}
}