diff options
author | Arun Prakash Jana <engineerarun@gmail.com> | 2018-11-29 01:21:08 +0530 |
---|---|---|
committer | Arun Prakash Jana <engineerarun@gmail.com> | 2018-11-29 01:21:08 +0530 |
commit | 32ca8ca1339eb8152abc76ec7716a4b6747ea3c5 (patch) | |
tree | f9c3ec87887e4eac4f1284e0c87c84f7bfe95256 | |
parent | 052cd282f45705ae50e855cffbd32e1c5ded0ef6 (diff) | |
download | nnn-32ca8ca1339eb8152abc76ec7716a4b6747ea3c5.tar.gz |
Simplify getting editor env var
-rw-r--r-- | src/nnn.c | 22 |
1 files changed, 8 insertions, 14 deletions
@@ -3577,20 +3577,14 @@ int main(int argc, char *argv[]) /* Edit text in EDITOR, if opted */ if (getenv("NNN_USE_EDITOR")) { - editor = xgetenv("VISUAL", NULL); - if (!editor) - editor = xgetenv("EDITOR", "vi"); - if (editor) { - /* copier used as a temp var */ - copier = editor; - while (*copier) { - if (*copier == ' ') { - *copier = '\0'; - editor_arg = ++copier; - break; - } - ++copier; - } + editor = xgetenv("VISUAL", xgetenv("EDITOR", "vi")); + /* copier used as a temp var */ + copier = editor; + while (*copier && *copier != ' ') + ++copier; + if (*copier == ' ') { + *copier = '\0'; + editor_arg = ++copier; } } |