Merge pull request #322 from KlzXS/awk

Replaced 'sed' with 'awk'
This commit is contained in:
Mischievous Meerkat 2019-08-12 21:44:54 +05:30 committed by GitHub
commit 0cf77c2ac6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 6 deletions

View File

@ -1299,12 +1299,7 @@ static void archive_selection(const char *cmd, const char *archive, const char *
{
char *buf = (char *)malloc(CMD_LEN_MAX * sizeof(char));
snprintf(buf, CMD_LEN_MAX,
#ifdef __linux__
"sed -ze 's|^%s/||' '%s' | xargs -0 %s %s", curpath, g_cppath, cmd, archive);
#else
"cat '%s' | tr '\\0' '\n' | sed -e 's|^%s/||' | tr '\n' '\\0' | xargs -0 %s %s",
g_cppath, curpath, cmd, archive);
#endif
"awk 'BEGIN{RS=\"\\0\"} {gsub(\"%s/\", \"\", $0); printf \"%%s\\0\", $0}' %s | xargs -0 %s %s", curpath, g_cppath, cmd, archive);
spawn("sh", "-c", buf, curpath, F_NORMAL);
free(buf);
}