Merge pull request #1243 from omar-polo/sed-misc

misc sed tweaks
This commit is contained in:
Arun 2021-11-24 18:25:13 +05:30 committed by GitHub
commit c87b67e073
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
@ -2729,12 +2731,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);