summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2017-04-30 20:06:53 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2017-04-30 20:06:53 +0200
commit48e74865011722a7ac0ca3e1b45ea407f8c79db5 (patch)
tree389e78263b0a7a6646acd26224f22a27dbc4bf94
parentce2ba103a904ee69c02253bef30faf81a28e3fb3 (diff)
downloadaports-cache-48e74865011722a7ac0ca3e1b45ea407f8c79db5.tar.bz2
aports-cache-48e74865011722a7ac0ca3e1b45ea407f8c79db5.tar.xz
only print vars that has value
-rw-r--r--aports-cache.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/aports-cache.c b/aports-cache.c
index 7a50e6e..c14860a 100644
--- a/aports-cache.c
+++ b/aports-cache.c
@@ -46,8 +46,8 @@ 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 ":'\n" \
+#define ECHO_STR(var) "[ -n \"$" #var "\" ] && echo \" " #var ": $" #var "\"\n"
+#define ECHO_LIST(var) "[ -n \"$" #var "\" ] && echo ' " #var ":' && " \
"for i in $" #var "; do\n" \
"\techo \" - \\\"$i\\\"\"\n" \
"done\n"