DataMuseum.dk

Presents historical artifacts from the history of:

Regnecentalen RC-900

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Regnecentalen RC-900

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download

⟦9626b7e57⟧ TextFile

    Length: 3968 (0xf80)
    Types: TextFile
    Notes: UNIX file
    Names: »check.COMMANDS«

Derivation

└─⟦bee8f15db⟧ Bits:30004169/disk2.imd Uniplex II+ V.6 release 1.0 (dansk)
└─⟦bee8f15db⟧ UNIX Filesystem
    └─⟦this⟧ »up/new/usr/UAP/install.cmds/check.COMMANDS« 

TextFile


: '
install.cmds/check.COMMANDS - briefly check functionality of commands
                              used by UNIPLEX package
L..T..T..T..T..T..T..T..T..T..T..T..T..T..T..T..T..T..T..T..T..T..T..T..T..T..T..T..T..T..T..T..T..T..R

Usage:  check.COMMANDS

Exits:  0 - OK, or warning
        1 - Specified command fails to operate in the way expected
            by install processing scripts.
            Error message displayed.


Notes:
1. Some of the commands may actually be built-in, depending on the
   SHELL in use (eg: TEST)
2. The structure:  "if (command .... ; exit 0) >/dev/null 2.&1"
   is used to test if the command is executable, on the basis that if
   it isnt, or is not found, the sub-shell will not process the "exit 0",
   and will abort with a non-0 exit code.
3. Set list for loop processing. This is to facilitate ease of expansion to
   allow this program to be called to check certain programs only
'
PGM='chown chmod chgrp cp cmp expr find ln mv sed sort tr test'

TMPFILE=chk.C$$
for PGM do
   BAD="Standard system utility \"$PGM\" does not operate correctly
$BELL"
   case "$PGM" in

     cp) : Just test this is invokable
         if ( cp /etc/passwd /tmp; exit 0 ) >/dev/null 2>&1 ; then
            : Ran $PGM OK
         else
            echo "$BAD"; exit 1
         fi
         ;;

    cmp) cp /etc/passwd $TMPFILE
         if cmp /etc/passwd $TMPFILE; then
            : OK
         else
            echo "$BAD"; exit 1
         fi
         ;;


  chown|chmod|chgrp)
         : Just test these are invokable
         >$TMPFILE
         if ( $PGM 0 $TMPFILE ) ; then
            : Ran $PGM OK
         else
            echo "$BAD(\"$PGM 0 $TMPFILE\" failed!)"; exit 1
         fi
         ;;

   expr) case `expr 1 + 2` in
           3) ;;
           *) echo "$BAD(Cannot add 1 + 2 = 3!)"; exit 1;;
         esac
         ;;

   find) : No test - NOT.superuser will bomb if find failure!!
         ;;

     ln) cp /etc/passwd $TMPFILE
         rm -f $TMPFILE.
         if ( ln $TMPFILE $TMPFILE. ; exit 0 ) >/dev/null 2>&1 ; then
            : Ran $PGM OK - check the same
            cp $TMPFILE $TMPFILE,
            if cmp $TMPFILE, $TMPFILE. >/dev/null 2>&1 ; then
               : OK
            else
               echo "$BAD"; exit 1
            fi
         else
            echo "$BAD"; exit 1
         fi
         ;;

     mv) >$TMPFILE
         rm -f $TMPFILE.
         if ( mv $TMPFILE $TMPFILE. ; exit 0 ) >/dev/null 2>&1  ; then
            : Ran $PGM OK
         else
            echo "$BAD"; exit 1
         fi
         ;;

    sed) F="`echo AB-CD-EF | sed 's/..-\(..\)-.*/\1/'`"
         case "$F" in
           CD) ;;
            *) echo "$BAD"; exit 1;;
         esac
         ;;

    sed) echo "A
C
B" | sort > $TMPFILE
         echo "A
B
C"       | cmp - $TMPFILE
         case $? in
            0) : OK;;
            *) echo "$BAD"; exit 1;;
         esac
         ;;


    tr)  F="`echo aABD | tr ABD def`"
         case "$F" in
          adef) ;;
             *) echo "$BAD"; exit 1;;
         esac
         ;;

 'test') F=/etc/passwd
         if test -f $F; then
            if test ! -f $F; then
               echo "$BAD(\"test ! -f $F\" passed!)"
               exit 1
            fi
         else
            echo "$BAD(\"test -f $F\" failed!)"
            exit 1
         fi

         F=/etc
         if test -d $F; then
            if test ! -d $F; then
               echo "$BAD(\"test ! -d $F\" passed!)"
               exit 1
            fi
         else
            echo "$BAD(\"test -d $F\" failed!)"
            exit 1
         fi

         if test -z "$F"; then
            echo "$BAD(\"test -z $F\" passed!)"
            exit 1
         fi
         F=''
         if test ! -z "$F"; then
            echo "$BAD(\"test ! -z <null string>\" passed!)"
            exit 1
         fi

         ;;

     * ) echo "Warning: untested command - \"$PGM\""
         ;;
   esac
done
rm -f $TMPFILE*
exit 0