summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2017-04-30 19:50:39 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2017-04-30 20:02:42 +0200
commitce2ba103a904ee69c02253bef30faf81a28e3fb3 (patch)
tree69b190a43ec6a74a460b0c5c559a4058ed1934ae
parent141fe72708cfe1d2d0643290242825cf31772027 (diff)
downloadaports-cache-ce2ba103a904ee69c02253bef30faf81a28e3fb3.tar.bz2
aports-cache-ce2ba103a904ee69c02253bef30faf81a28e3fb3.tar.xz
quote strings and generate lists
-rw-r--r--aports-cache.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/aports-cache.c b/aports-cache.c
index 728acef..7a50e6e 100644
--- a/aports-cache.c
+++ b/aports-cache.c
@@ -46,8 +46,12 @@ int spawn_shell_pipe(char *const argv[], pid_t *pid)
int read_apkbuild(int shellfd, int aportfd, size_t size, const char *name)
{
-#define ECHO_STR(var) "echo \" " #var ": $" #var "\"\n"
-#define ECHO_LIST(var) "echo \" " #var ": \"$" #var "\n"
+#define ECHO_STR(var) "echo \" " #var ": $" #var "\"\n"
+#define ECHO_LIST(var) "echo ' " #var ":'\n" \
+ "for i in $" #var "; do\n" \
+ "\techo \" - \\\"$i\\\"\"\n" \
+ "done\n"
+
char *fmtbuf =
"unset pkgname"
" pkgver"