Mercurial > hg > toybox
changeset 1322:b91284c2e569 draft
Make "losetup /dev/loop0 filename" work.
Sigh. Implement the complex cases and you screw up the simple cases you already tested...
author | Rob Landley <rob@landley.net> |
---|---|
date | Thu, 29 May 2014 06:29:12 -0500 |
parents | 4d898affda0c |
children | c3061b237c4c |
files | toys/other/losetup.c |
diffstat | 1 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/toys/other/losetup.c Thu May 29 05:22:02 2014 -0500 +++ b/toys/other/losetup.c Thu May 29 06:29:12 2014 -0500 @@ -179,10 +179,13 @@ } else { char *file = (toys.optflags & (FLAG_d|FLAG_c)) ? NULL : toys.optargs[1]; - if (!toys.optc || (file && toys.optc>1)) { + if (!toys.optc || (file && toys.optc != 2)) { toys.exithelp++; - perror_exit("needs 1 arg"); + perror_exit("needs %d arg%s", 1+!!file, file ? "s" : ""); } - for (s = toys.optargs; *s; s++) loopback_setup(*s, file); + for (s = toys.optargs; *s; s++) { + loopback_setup(*s, file); + if (file) break; + } } }