summaryrefslogtreecommitdiff
path: root/src/history.c
diff options
context:
space:
mode:
authorBernhard R. Link <brlink@debian.org>2008-06-09 23:50:27 +0200
committerShawn <sabetts@juicebox.(none)>2008-10-22 14:17:43 -0700
commitd801644502adf42570e9a5b75fcaa013f613fc5a (patch)
treea30537a038c36c0effc0ab0f6f9f6565a206b558 /src/history.c
parent22cea909c3d1b695424ef85153917b00bfb1261c (diff)
downloadratpoison-d801644502adf42570e9a5b75fcaa013f613fc5a.zip
define different history types and use them
(implementation does not separate them yet, though)
Diffstat (limited to 'src/history.c')
-rw-r--r--src/history.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/history.c b/src/history.c
index 4ec8b2e..28292f6 100644
--- a/src/history.c
+++ b/src/history.c
@@ -82,9 +82,14 @@ history_reset (void)
}
void
-history_add (char *item)
+history_add (int history_id, char *item)
{
- HIST_ENTRY *h = history_get (history_length);
+ HIST_ENTRY *h;
+
+ if (history_id == hist_NONE)
+ return;
+
+ h = history_get (history_length);
if (item == NULL || *item == '\0' || isspace (*item) || (h != NULL && !strcmp (h->line, item)))
return;
@@ -93,27 +98,33 @@ history_add (char *item)
add_history (item);
}
-char *
-history_previous (void)
+const char *
+history_previous (int history_id)
{
HIST_ENTRY *h = NULL;
+ if (history_id == hist_NONE)
+ return NULL;
+
h = previous_history();
return h ? h->line : NULL;
}
-char *
-history_next (void)
+const char *
+history_next (int history_id)
{
HIST_ENTRY *h = NULL;
+ if (history_id == hist_NONE)
+ return NULL;
+
h = next_history();
return h ? h->line : NULL;
}
-int history_expand_line (char *string, char **output)
+int history_expand_line (int history_id, char *string, char **output)
{
return history_expand (string, output);
}