jayduhon / inferno-os

Automatically exported from code.google.com/p/inferno-os
2 stars 0 forks source link

/appl/cmd/mk/mksubdirs: bad syntax #290

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
There is a problem with "else" branch in /appl/cmd/mk/mksubdirs:

    for j in $DIRS {
        if { ftest -d $j } {
            echo 'cd' $j '; mk' $MKFLAGS $stem
            cd $j; mk $MKFLAGS $stem; cd ..
        } else {
            ! { ftest -e $j }
        }
    }

1) Word "else" produce syntax error in Inferno.
2) Test in else branch looks like supposed to return error to mk in case 
non-directory with that name exists. Not sure is this test makes sense at all, 
but it will work only for last directory in $DIRS.

Possible fix is:

    for j in $DIRS {
        if { ftest -d $j } {
            echo 'cd' $j '; mk' $MKFLAGS $stem
            cd $j; mk $MKFLAGS $stem; cd ..
        } {
            ! ftest -e $j || raise $j^' not a directory'
        }
    }

Original issue reported on code.google.com by powerman...@gmail.com on 5 Dec 2012 at 4:56

GoogleCodeExporter commented 9 years ago
thanks. we'd removed the else (though not pushed it), but still needed the 
other change.
committed changeset 548:ceb0d7749239

Original comment by Charles....@gmail.com on 5 Dec 2012 at 5:50