From deead97e23981074d0e33520558d54b6e34fa374 Mon Sep 17 00:00:00 2001 From: Omar Polo Date: Wed, 24 Nov 2021 11:40:59 +0100 Subject: [PATCH 1/2] drop unnecessary ifdef __linux__ since nnn requires gsed anyway, why don't use it? Probably forgot in #1210 --- src/nnn.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/nnn.c b/src/nnn.c index 1f020087..20a6051e 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -2729,12 +2729,7 @@ static void archive_selection(const char *cmd, const char *archive, const char * } snprintf(buf, CMD_LEN_MAX, -#ifdef __linux__ SED" -ze 's|^%s/||' '%s' | xargs -0 %s %s", curpath, selpath, cmd, archive -#else - "tr '\\0' '\n' < '%s' | "SED" -e 's|^%s/||' | tr '\n' '\\0' | xargs -0 %s %s", - selpath, curpath, cmd, archive -#endif ); spawn(utils[UTIL_SH_EXEC], buf, NULL, NULL, F_CLI | F_CONFIRM); free(buf); From fb3d3ab0efd0a1789ee1afc50cbd56f0587fc196 Mon Sep 17 00:00:00 2001 From: Omar Polo Date: Wed, 24 Nov 2021 11:44:50 +0100 Subject: [PATCH 2/2] define SED only if not already defined This allows packagers to set a custom path for sed (gsed may be simply called `gsed' or `gnu-sed' or ...) --- src/nnn.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/nnn.c b/src/nnn.c index 20a6051e..1c12e1cd 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -202,12 +202,14 @@ #define CTX_MAX 8 #endif +#ifndef SED /* BSDs or Solaris or SunOS */ #if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) || defined(sun) || defined(__sun) #define SED "gsed" #else #define SED "sed" #endif +#endif /* Large selection threshold */ #ifndef LARGESEL