X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=sbr%2Fcontext_read.c;h=abf666c6fc57874447fae456f1263cf04ad73442;hb=b33ba7a7953d06a123ee59811903f0eb7f69e120;hp=1e795b05fe4a84034c40d8b07d1339ee3a855197;hpb=7030d7edb099bff36ded7548bb5380f7acab4f9b;p=mmh diff --git a/sbr/context_read.c b/sbr/context_read.c index 1e795b0..abf666c 100644 --- a/sbr/context_read.c +++ b/sbr/context_read.c @@ -68,7 +68,7 @@ context_read(void) } else { mmhpath = concat(mypath, "/", mmhdir, NULL); if (stat(mmhpath, &st) == -1 || (st.st_mode & S_IFDIR) == 0) { - adios(NULL, "Doesn't look like mmh is set up for your account. Run `install-mh' to do so."); + adios(NULL, "Doesn't look like mmh is set up for your account. Run `mmh' to do so."); } } @@ -154,8 +154,8 @@ context_read(void) } /* - ** context is NULL if context_foil() was called to disable use - ** of context. We also support users setting explicitly setting + ** context is NULL if the use of the context was diabled. + ** We also support users setting explicitly setting ** MMHC to /dev/null. (If this wasn't special-cased then the ** locking would be liable to fail.) */ @@ -173,4 +173,26 @@ context_read(void) readconfig((struct node **) 0, ib, cp, 1); lkfclose(ib, ctxpath); } + + /* Set editor */ + if (!(cp = getenv("MMHEDITOR")) || !*cp) { + if (!(cp = context_find("editor")) || !*cp) { + if (!(cp = getenv("VISUAL")) || !*cp) { + if (!(cp = getenv("EDITOR")) || !*cp) { + cp = defaulteditor; + } + } + } + } + defaulteditor = cp; + + /* Set pager */ + if (!(cp = getenv("MMHPAGER")) || !*cp) { + if (!(cp = context_find("pager")) || !*cp) { + if (!(cp = getenv("PAGER")) || !*cp) { + cp = defaultpager; + } + } + } + defaultpager = cp; }