M history.c => history.c +0 -9
@@ 11,15 11,6 @@ char *history[HISTORY_SIZE];
int hist_top, hist_pos;
size_t hist_entry_size;
-const char *
-history_get(int pos)
-{
- if (pos < 0 || pos > hist_top)
- return NULL;
-
- return history[pos];
-}
-
void
history_next(void)
{
M history.h => history.h +0 -1
@@ 2,7 2,6 @@
#define HISTORY_SIZE 50
-const char *history_get(int pos);
void history_next(void);
void history_rotate(void);
void history_set(int pos, const char *input);
M sline.c => sline.c +11 -2
@@ 238,7 238,7 @@ key_up(char *buf, size_t size)
if (hist_pos > 0)
--hist_pos;
- if ((hist = history_get(hist_pos)) == NULL)
+ if ((hist = sline_history_get(hist_pos)) == NULL)
return;
ln_buf_replace(buf, size, hist);
@@ 257,7 257,7 @@ key_down(char *buf, size_t size)
else
hist_pos = hist_top;
- if ((hist = history_get(hist_pos)) == NULL)
+ if ((hist = sline_history_get(hist_pos)) == NULL)
return;
ln_buf_replace(buf, size, hist);
@@ 531,6 531,15 @@ sline_errmsg(void)
}
}
+const char *
+sline_history_get(int pos)
+{
+ if (pos < 0 || pos > hist_top)
+ return NULL;
+
+ return history[pos];
+}
+
int
sline_setup(int entry_size)
{
M sline.h => sline.h +1 -0
@@ 13,6 13,7 @@ enum {
int sline(char *buf, int size, const char *init);
void sline_end(void);
const char *sline_errmsg(void);
+const char *sline_history_get(int pos);
int sline_setup(int entry_size);
void sline_set_prompt(const char *fmt, ...);
const char *sline_version(void);