From 1bed5ddd3e05299ab30efc48995d7a3cd5471ad3 Mon Sep 17 00:00:00 2001 From: sabetts Date: Tue, 22 Feb 2005 03:04:40 +0000 Subject: * src/main.c (read_startup_files): use xsprintf when generating path to ratpoisonrc. * src/input.c (get_more_input): Use HAVE_HISTORY to ifdef out history_reset. * src/actions.c (command): new variable, raw, which records whether to tell parse_args not to parse the last arg. (cmd_set): likewise --- ChangeLog | 12 ++++++++++++ src/actions.c | 10 ++++++---- src/input.c | 2 +- src/main.c | 4 ++-- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 13620bf..50a515a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2005-02-22 sabetts + + * src/main.c (read_startup_files): use xsprintf when generating + path to ratpoisonrc. + + * src/input.c (get_more_input): Use HAVE_HISTORY to ifdef out + history_reset. + + * src/actions.c (command): new variable, raw, which records + whether to tell parse_args not to parse the last arg. + (cmd_set): likewise + 2005-02-10 Shawn Betts * src/actions.c (parse_keydesc): return a cmdret error in the diff --git a/src/actions.c b/src/actions.c index e7ec191..0687d5b 100644 --- a/src/actions.c +++ b/src/actions.c @@ -2305,7 +2305,7 @@ command (int interactive, char *data) struct cmdarg *acur; struct list_head *iter, *tmp; struct list_head head, args; - int i, nargs = -1; + int i, nargs = 0, raw = 0; INIT_LIST_HEAD (&args); INIT_LIST_HEAD (&head); @@ -2316,12 +2316,13 @@ command (int interactive, char *data) || uc->args[i].type == arg_SHELLCMD || uc->args[i].type == arg_RAW) { + raw = 1; nargs = i; break; } /* Parse the arguments and call the function. */ - result = parse_args (rest, &head, nargs, uc->args[nargs].type == arg_RAW); + result = parse_args (rest, &head, nargs, raw); if (result) goto free_lists; @@ -4740,7 +4741,7 @@ cmd_set (int interactive, struct cmdarg **args) struct cmdarg *acur; struct list_head *iter, *tmp; struct list_head head, arglist; - int i, nargs = -1; + int i, nargs = 0, raw = 0; int parsed_args; cmdret *result = NULL; struct cmdarg **cmdargs; @@ -4755,6 +4756,7 @@ cmd_set (int interactive, struct cmdarg **args) || ARG(0,variable)->args[i].type == arg_SHELLCMD || ARG(0,variable)->args[i].type == arg_RAW) { + raw = 1; nargs = i; break; } @@ -4764,7 +4766,7 @@ cmd_set (int interactive, struct cmdarg **args) input = xstrdup (args[1]->string); else input = xstrdup (""); - result = parse_args (input, &head, nargs, ARG(0,variable)->args[i].type == arg_RAW); + result = parse_args (input, &head, nargs, raw); free (input); if (result) diff --git a/src/input.c b/src/input.c index dbfd5db..df94d84 100644 --- a/src/input.c +++ b/src/input.c @@ -426,7 +426,7 @@ get_more_input (char *prompt, char *preinput, char *final_input; edit_status status; -#ifdef HAVE_READLINE_HISTORY_H +#ifdef HAVE_HISTORY history_reset(); #endif /* HAVE_READLINE_HISTORY_H */ diff --git a/src/main.c b/src/main.c index 5b7bb25..32f28e5 100644 --- a/src/main.c +++ b/src/main.c @@ -388,8 +388,8 @@ read_startup_files (char *alt_rcfile) } else { - char *filename = (char*)xmalloc (strlen (homedir) + strlen ("/.ratpoisonrc") + 1); - sprintf (filename, "%s/.ratpoisonrc", homedir); + char *filename; + filename = xsprintf ("%s/.ratpoisonrc", homedir); if ((fileptr = fopen (filename, "r")) == NULL) { -- cgit v1.2.3