Simplify getting editor env var

This commit is contained in:
Arun Prakash Jana 2018-11-29 01:21:08 +05:30
parent 052cd282f4
commit 32ca8ca133
No known key found for this signature in database
GPG key ID: A75979F35C080412

View file

@ -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;
}
}