summaryrefslogtreecommitdiff
path: root/pith/hist.c
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2016-05-12 19:51:05 -0600
committerEduardo Chappa <chappa@washington.edu>2016-05-12 19:51:05 -0600
commitb74b7a0d9eb48dbe3ea773885135ecb924d8a902 (patch)
tree9e3fc62f881d9829f080d99622b46e214fcfb69e /pith/hist.c
parent0e2f2446b8b91184bcaa92760d77a06c2c97fcc2 (diff)
downloadalpine-b74b7a0d9eb48dbe3ea773885135ecb924d8a902.tar.xz
* Minor fix to documentation.
* Add the configuration variable "default-directories", which is called "Extra Directories for Save" in the configuration screen. This variable saves a list of directories that are readily accessible for save or export of attachments. This makes it easier to save attachments in directories that are hard to navigate to, or that are accessed frequently.
Diffstat (limited to 'pith/hist.c')
-rw-r--r--pith/hist.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/pith/hist.c b/pith/hist.c
index d42b67a6..9d5022c9 100644
--- a/pith/hist.c
+++ b/pith/hist.c
@@ -57,6 +57,57 @@ free_hist(HISTORY_S **history)
}
}
+char *
+hist_in_pos(int pos, char **list, int llen, HISTORY_S *hist, int n)
+{
+ char *p;
+ int i;
+
+ if(pos < 0 || pos > llen + n)
+ return NULL;
+
+ if(pos < llen)
+ return list[pos];
+
+ hist->curindex = hist->origindex; /* reset history */
+ for(i = 0; i < n-1; i++)
+ p = get_prev_hist_dir(hist);
+ p = get_prev_hist_dir(hist);
+ for(i = 0; i < pos - llen; i++)
+ p = get_next_hist_dir(hist);
+ return p;
+}
+
+
+char *
+get_next_hist_dir(HISTORY_S *history)
+{
+ return get_next_hist(history, NULL, 0, NULL);
+}
+
+
+char *
+get_prev_hist_dir(HISTORY_S *history)
+{
+ int nextcurindex;
+
+ if(!(history && history->histsize > 0))
+ return NULL;
+
+ nextcurindex = (history->curindex + 1) % history->histsize;
+
+ /* already at start of history */
+ if(nextcurindex == history->origindex
+ || !(history->hist[nextcurindex] && history->hist[nextcurindex]->str
+ && history->hist[nextcurindex]->str[0]))
+ return NULL;
+
+ history->curindex = nextcurindex;
+
+ return((history->hist[history->curindex] && history->hist[history->curindex]->str)
+ ? history->hist[history->curindex]->str : NULL);
+}
+
char *
get_prev_hist(HISTORY_S *history, char *savethis, unsigned saveflags, void *cntxt)