tSimplify reading arguments or stdin - pm - barely a pack manager
HTML git clone git://z3bra.org/pm
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit 7f7c044bcd9ba084b1b40b31e32efa4ff03ca72e
DIR parent 9971c62e398790939966c62bb1af1fa98fc5c4c2
HTML Author: z3bra <willyatmailoodotorg>
Date: Sun, 24 Apr 2016 20:32:40 +0200
Simplify reading arguments or stdin
Diffstat:
M pm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
---
DIR diff --git a/pm.c b/pm.c
t@@ -761,8 +761,7 @@ main (int argc, char **argv)
case ACTION_UPDATE:
case ACTION_DELETE:
/* These action require a read from stdin if no arg is given */
- while ((argc>0 && (n=strdup(*argv++))!=NULL) || (n=slurp(0))!=NULL) {
-
+ while ((n = (argc > 0) ? *argv ? strdup(*argv++) : NULL : slurp(0))) {
if (action == ACTION_INSTALL)
r += install(rootfs, datadir, n);
if (action == ACTION_UPDATE)