]> diplodocus.org Git - nmh/blob - sbr/geteditor.c
Make burst(1) be able to burst MIME-formatted messages with message/rfc822
[nmh] / sbr / geteditor.c
1
2 /*
3 * geteditor.c -- Determine the default editor to use
4 *
5 * This code is Copyright (c) 2013, by the authors of nmh. See the
6 * COPYRIGHT file in the root directory of the nmh distribution for
7 * complete copyright information.
8 */
9
10 #include <h/mh.h>
11 #include <h/utils.h>
12
13 static char *default_editor = NULL;
14
15 char *
16 get_default_editor(void)
17 {
18 char *str;
19
20 if (default_editor)
21 return default_editor;
22
23 if (!(str = context_find("editor")) && !(str = getenv("VISUAL")) &&
24 !(str = getenv("EDITOR"))) {
25 str = DEFAULT_EDITOR;
26 }
27
28 return (default_editor = str);
29 }