README.md | 6 +++--- src/nnn.c | 34 +++++++++++++++------------------- diff --git a/README.md b/README.md index 4c82a0cfbbb003df5a4b54a8467d38c8abc4dd85..f5e5d3dbb6f27e5410fce791a53b72bfa95a1662 100644 --- a/README.md +++ b/README.md @@ -173,9 +173,9 @@ -f run filter as cmd on prompt key -H show hidden files -i nav-as-you-type mode -n version sort - -o press Enter to open files - -p file selection file (stdout if '-') - -r show cp, mv progress on Linux + -o open files on Enter + -p file selection file [stdout if '-'] + -r use advcpmv patched cp, mv -s string filters [default: regex] -S du mode -t disable dir auto-select diff --git a/src/nnn.c b/src/nnn.c index 6fa3bbe32e6b38423257f5aa1ce5152ad38d56a0..9344d9933919cd66205f2b8a9312acbc608be084 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -391,8 +391,8 @@ "no traversal", "invalid key", "%F %T %z", "/.nnnXXXXXX", - "empty selection", - "utility missing", + "0 selected", + "missing dep", }; /* Supported configuration environment variables */ @@ -775,7 +775,12 @@ static int create_tmp_file() { xstrlcpy(g_tmpfpath + g_tmpfplen - 1, messages[STR_TMPFILE], TMP_LEN_MAX - g_tmpfplen); - return mkstemp(g_tmpfpath); + + int fd = mkstemp(g_tmpfpath); + if (fd == -1) { + DPRINTF_S(strerror(errno)); + } + return fd; } /* Writes buflen char(s) from buf to a file */ @@ -854,10 +859,8 @@ if (!selbufpos) return FALSE; fd = create_tmp_file(); - if (fd == -1) { - DPRINTF_S("mkstemp failed!"); + if (fd == -1) return FALSE; - } pos = seltofile(fd, NULL); @@ -2849,7 +2852,7 @@ * string because the number of bytes in help was increasing * the binary size by around a hundred bytes. This would only * have increased as we keep adding new options. */ -static bool show_help(const char *path) +static void show_help(const char *path) { int i, fd; const char *start, *end; @@ -2889,7 +2892,7 @@ "b^P Prompt/run cmd L Lock\n"}; fd = create_tmp_file(); if (fd == -1) - return FALSE; + return; start = end = helpstr; while (*end) { @@ -2931,7 +2934,6 @@ close(fd); spawn(pager, g_tmpfpath, NULL, NULL, F_CLI); unlink(g_tmpfpath); - return TRUE; } static int sum_bsizes(const char *fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf) @@ -4015,7 +4017,6 @@ case SEL_LOCK: { if (ndents) mkpath(path, dents[cur].name, newpath); - r = TRUE; switch (sel) { case SEL_ARCHIVELS: @@ -4037,7 +4038,7 @@ goto nochange; } break; case SEL_HELP: - r = show_help(path); + show_help(path); break; case SEL_RUNEDIT: spawn(editor, dents[cur].name, NULL, path, F_CLI); @@ -4048,11 +4049,6 @@ break; default: /* SEL_LOCK */ lock_terminal(); break; - } - - if (!r) { - printwait(messages[UTIL_MISSING], &presel); - goto nochange; } /* In case of successful operation, reload contents */ @@ -4617,9 +4613,9 @@ " -f run filter as cmd on prompt key\n" " -H show hidden files\n" " -i nav-as-you-type mode\n" " -n version sort\n" - " -o press Enter to open files\n" - " -p file selection file (stdout if '-')\n" - " -r show cp, mv progress on Linux\n" + " -o open files on Enter\n" + " -p file selection file [stdout if '-']\n" + " -r use advcpmv patched cp, mv\n" " -s string filters [default: regex]\n" " -S du mode\n" " -t disable dir auto-select\n"