summaryrefslogtreecommitdiff
path: root/rc/bin/xargs
blob: 4255b34403252c6f41f3d603eb22d0d7b0e269df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/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