mirror of
https://github.com/jarun/nnn.git
synced 2024-12-01 02:49:44 +00:00
Minor reformat
This commit is contained in:
parent
7837cc277f
commit
1a8f9ee459
78
src/nnn.c
78
src/nnn.c
|
@ -6576,7 +6576,6 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
/* Now we are in path list mode */
|
/* Now we are in path list mode */
|
||||||
if (!isatty(STDIN_FILENO)) {
|
if (!isatty(STDIN_FILENO)) {
|
||||||
|
|
||||||
/* This is the same as g_listpath */
|
/* This is the same as g_listpath */
|
||||||
initpath = load_input();
|
initpath = load_input();
|
||||||
if (!initpath)
|
if (!initpath)
|
||||||
|
@ -6585,7 +6584,6 @@ int main(int argc, char *argv[])
|
||||||
/* We return to tty */
|
/* We return to tty */
|
||||||
dup2(STDOUT_FILENO, STDIN_FILENO);
|
dup2(STDOUT_FILENO, STDIN_FILENO);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
home = getenv("HOME");
|
home = getenv("HOME");
|
||||||
|
@ -6614,48 +6612,48 @@ int main(int argc, char *argv[])
|
||||||
return _FAILURE;
|
return _FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (initpath) {
|
if (!initpath) {
|
||||||
/* NOP */
|
if (arg) { /* Open a bookmark directly */
|
||||||
} else if (arg) { /* Open a bookmark directly */
|
if (!arg[1]) /* Bookmarks keys are single char */
|
||||||
if (!arg[1]) /* Bookmarks keys are single char */
|
initpath = get_kv_val(bookmark, NULL, *arg, BM_MAX, TRUE);
|
||||||
initpath = get_kv_val(bookmark, NULL, *arg, BM_MAX, TRUE);
|
|
||||||
|
|
||||||
if (!initpath) {
|
if (!initpath) {
|
||||||
fprintf(stderr, "%s\n", messages[MSG_INVALID_KEY]);
|
fprintf(stderr, "%s\n", messages[MSG_INVALID_KEY]);
|
||||||
return _FAILURE;
|
return _FAILURE;
|
||||||
}
|
}
|
||||||
} else if (argc == optind) {
|
} else if (argc == optind) {
|
||||||
/* Start in the current directory */
|
/* Start in the current directory */
|
||||||
initpath = getcwd(NULL, PATH_MAX);
|
initpath = getcwd(NULL, PATH_MAX);
|
||||||
if (!initpath)
|
if (!initpath)
|
||||||
initpath = "/";
|
initpath = "/";
|
||||||
} else {
|
} else {
|
||||||
arg = argv[optind];
|
arg = argv[optind];
|
||||||
DPRINTF_S(arg);
|
DPRINTF_S(arg);
|
||||||
if (strlen(arg) > 7 && !strncmp(arg, "file://", 7))
|
if (strlen(arg) > 7 && !strncmp(arg, "file://", 7))
|
||||||
arg = arg + 7;
|
arg = arg + 7;
|
||||||
initpath = realpath(arg, NULL);
|
initpath = realpath(arg, NULL);
|
||||||
DPRINTF_S(initpath);
|
DPRINTF_S(initpath);
|
||||||
if (!initpath) {
|
if (!initpath) {
|
||||||
xerror();
|
xerror();
|
||||||
return _FAILURE;
|
return _FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If nnn is set as the file manager, applications may try to open
|
* 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
|
* files by invoking nnn. In that case pass the file path to the
|
||||||
* desktop opener and exit.
|
* desktop opener and exit.
|
||||||
*/
|
*/
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
if (stat(initpath, &sb) == -1) {
|
if (stat(initpath, &sb) == -1) {
|
||||||
xerror();
|
xerror();
|
||||||
return _FAILURE;
|
return _FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (S_ISREG(sb.st_mode)) {
|
if (S_ISREG(sb.st_mode)) {
|
||||||
spawn(opener, arg, NULL, NULL, cfg.cliopener ? F_CLI : F_NOTRACE | F_NOWAIT);
|
spawn(opener, arg, NULL, NULL, cfg.cliopener ? F_CLI : F_NOTRACE | F_NOWAIT);
|
||||||
return _SUCCESS;
|
return _SUCCESS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue