From 1a8f9ee45928486339726cbf652cacb2f2dd4216 Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Mon, 17 Feb 2020 19:51:24 +0530 Subject: [PATCH] Minor reformat --- src/nnn.c | 78 +++++++++++++++++++++++++++---------------------------- 1 file changed, 38 insertions(+), 40 deletions(-) diff --git a/src/nnn.c b/src/nnn.c index 3c818215..d6be43c5 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -6576,7 +6576,6 @@ int main(int argc, char *argv[]) /* Now we are in path list mode */ if (!isatty(STDIN_FILENO)) { - /* This is the same as g_listpath */ initpath = load_input(); if (!initpath) @@ -6585,7 +6584,6 @@ int main(int argc, char *argv[]) /* We return to tty */ dup2(STDOUT_FILENO, STDIN_FILENO); } - } home = getenv("HOME"); @@ -6614,48 +6612,48 @@ int main(int argc, char *argv[]) return _FAILURE; } - if (initpath) { - /* NOP */ - } else if (arg) { /* Open a bookmark directly */ - if (!arg[1]) /* Bookmarks keys are single char */ - initpath = get_kv_val(bookmark, NULL, *arg, BM_MAX, TRUE); + if (!initpath) { + if (arg) { /* Open a bookmark directly */ + if (!arg[1]) /* Bookmarks keys are single char */ + initpath = get_kv_val(bookmark, NULL, *arg, BM_MAX, TRUE); - if (!initpath) { - fprintf(stderr, "%s\n", messages[MSG_INVALID_KEY]); - return _FAILURE; - } - } else if (argc == optind) { - /* Start in the current directory */ - initpath = getcwd(NULL, PATH_MAX); - if (!initpath) - initpath = "/"; - } else { - arg = argv[optind]; - DPRINTF_S(arg); - if (strlen(arg) > 7 && !strncmp(arg, "file://", 7)) - arg = arg + 7; - initpath = realpath(arg, NULL); - DPRINTF_S(initpath); - if (!initpath) { - xerror(); - return _FAILURE; - } + if (!initpath) { + fprintf(stderr, "%s\n", messages[MSG_INVALID_KEY]); + return _FAILURE; + } + } else if (argc == optind) { + /* Start in the current directory */ + initpath = getcwd(NULL, PATH_MAX); + if (!initpath) + initpath = "/"; + } else { + arg = argv[optind]; + DPRINTF_S(arg); + if (strlen(arg) > 7 && !strncmp(arg, "file://", 7)) + arg = arg + 7; + initpath = realpath(arg, NULL); + DPRINTF_S(initpath); + if (!initpath) { + xerror(); + return _FAILURE; + } - /* - * If nnn is set as the file manager, applications may try to open - * files by invoking nnn. In that case pass the file path to the - * desktop opener and exit. - */ - struct stat sb; + /* + * If nnn is set as the file manager, applications may try to open + * files by invoking nnn. In that case pass the file path to the + * desktop opener and exit. + */ + struct stat sb; - if (stat(initpath, &sb) == -1) { - xerror(); - return _FAILURE; - } + if (stat(initpath, &sb) == -1) { + xerror(); + return _FAILURE; + } - if (S_ISREG(sb.st_mode)) { - spawn(opener, arg, NULL, NULL, cfg.cliopener ? F_CLI : F_NOTRACE | F_NOWAIT); - return _SUCCESS; + if (S_ISREG(sb.st_mode)) { + spawn(opener, arg, NULL, NULL, cfg.cliopener ? F_CLI : F_NOTRACE | F_NOWAIT); + return _SUCCESS; + } } }