plan9fox/rc/bin/xargs

24 lines
254 B
Text
Raw Normal View History

2011-05-11 14:12:25 +00:00
#!/bin/rc
fn usage {
echo usage: $0 [-n num] program [arguments]
exit usage
}
rfork e
ifs='
'
nargs=1
while(~ $1 -*) {
switch($1) {
case -n
nargs=$2
shift 2
case *
echo bla
usage
}
}
while(x = `{read -n $nargs})
$* $x
2011-05-16 22:16:56 +00:00
if(! ~ $#x 0)
$* $x