aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2018-11-29 01:21:08 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2018-11-29 01:21:08 +0530
commit32ca8ca1339eb8152abc76ec7716a4b6747ea3c5 (patch)
treef9c3ec87887e4eac4f1284e0c87c84f7bfe95256
parent052cd282f45705ae50e855cffbd32e1c5ded0ef6 (diff)
downloadnnn-32ca8ca1339eb8152abc76ec7716a4b6747ea3c5.tar.gz
Simplify getting editor env var
-rw-r--r--src/nnn.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/nnn.c b/src/nnn.c
index ec023df..f59a453 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -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;
}
}