shithub: riscv

ref: 0964bf7162f9c9a275a871da6897ae3b3c11dae7
dir: /rc/bin/xargs/

View raw version
#!/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
if(! ~ $#x 0)
	$* $x