Skip to content

Commit

Permalink
check for number of arguments, as opposed to only checking wether $2 …
Browse files Browse the repository at this point in the history
…is empty or not
  • Loading branch information
hovercats committed Sep 3, 2024
1 parent 2660c89 commit 12d5a0a
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions rcsm
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@ fn usage {
}

fn run {
if (test -z $2) {
for (serv in $basedir/run/*) {
$serv $1 >/dev/null >[2=1] &
}
}
if not {
$basedir/avail/$2 $1 >/dev/null >[2=1] &
switch($#*) {
case 1
for (serv in $basedir/run/*) {
$serv $1 >/dev/null >[2=1] &
}
case 2
$basedir/avail/$2 $1 >/dev/null >[2=1] &
}
}

switch($1) {
case -a
if (test -z $2) {
find $basedir/run -type l
}
if not {
if (test -e $basedir/avail/$2) {
ln -sf $basedir/avail/$2 $basedir/run/
}
if not {
printf 'Service not found\n'
exit 1
}
switch($#*) {
case 1
find $basedir/run -type l
case 2
if (test -e $basedir/avail/$2) {
ln -sf $basedir/avail/$2 $basedir/run/
}
if not {
printf 'Service not found\n'
exit 1
}
}
case -c
test -d $basedir/run || mkdir -p $basedir/run
Expand Down

0 comments on commit 12d5a0a

Please sign in to comment.