]> Sergey Matveev's repositories - nnn.git/commitdiff
Merge pull request #1650 from leo-arch/master
authorArun <engineerarun@gmail.com>
Thu, 18 May 2023 20:27:34 +0000 (01:57 +0530)
committerGitHub <noreply@github.com>
Thu, 18 May 2023 20:27:34 +0000 (01:57 +0530)
Fix crash when PWD is set to empty string

Makefile
plugins/README.md
src/nnn.c

index b6930330be77f9f2f252a96ba9b3e727ddfdc5aa..c39703de924009cef46fad55ed03dde5fd8daf00 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -51,7 +51,7 @@ endif
 
 ifeq ($(strip $(O_DEBUG)),1)
        CPPFLAGS += -DDEBUG
-       CFLAGS += -g
+       CFLAGS += -g3
 endif
 
 ifeq ($(strip $(O_NORL)),1)
index 7f89921ba28bcb5f9f920dd7f3d9aea7636252de..f2a3c4e6e3f45d9ef76c60fb3a71ce93883e376c 100644 (file)
@@ -75,11 +75,11 @@ Notes:
 
 - [Installation](#installation)
 - [Configuration](#configuration)
-  - [Skip directory refresh after running a plugin](#skip-directory-refresh-after-running-a-plugin)
-- [Running commands as plugin](#running-commands-as-plugin)
-  - [Skip user confirmation after command execution](#skip-user-confirmation-after-command-execution)
-  - [Run a GUI app as plugin](#run-a-gui-app-as-plugin)
-  - [Page non-interactive command output](#page-non-interactive-command-output)
+  - [Skip directory refresh after running a plugin](#skip-directory-refresh-after-running-a-plugin--)
+- [Running commands as plugin](#running-commands-as-plugin-)
+  - [Skip user confirmation after command execution](#skip-user-confirmation-after-command-execution-)
+  - [Run a GUI app as plugin](#run-a-gui-app-as-plugin-)
+  - [Page non-interactive command output](#page-non-interactive-command-output-)
   - [Some useful key-command examples](#some-useful-key-command-examples)
 - [Access level of plugins](#access-level-of-plugins)
 - [Create your own plugins](#create-your-own-plugins)
index 2878a14911789d59dc6be211d36032b46b709e19..6bd82d2d2dd81f7fc43544b7f4191a1733bbb69b 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -728,13 +728,10 @@ static const char * const envs[] = {
 #define T_CHANGE 1
 #define T_MOD    2
 
-#ifdef __linux__
-static char cp[] = "cp   -iRp";
-static char mv[] = "mv   -i";
-#else
-static char cp[] = "cp -iRp";
-static char mv[] = "mv -i";
-#endif
+#define PROGRESS_CP   "cpg -giRp"
+#define PROGRESS_MV   "mvg -gi"
+static char cp[sizeof PROGRESS_CP] = "cp -iRp";
+static char mv[sizeof PROGRESS_MV] = "mv -i";
 
 /* Archive commands */
 static char * const archive_cmd[] = {"atool -a", "bsdtar -acvf", "zip -r", "tar -acvf"};
@@ -8588,8 +8585,8 @@ int main(int argc, char *argv[])
                        break;
                case 'r':
 #ifdef __linux__
-                       cp[2] = cp[5] = mv[2] = mv[5] = 'g'; /* cp -iRp -> cpg -giRp */
-                       cp[4] = mv[4] = '-';
+                       memcpy(cp, PROGRESS_CP, sizeof PROGRESS_CP);
+                       memcpy(mv, PROGRESS_MV, sizeof PROGRESS_MV);
 #endif
                        break;
                case 'R':