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