Annotation of coherent/g/usr/bin/mlp/lpstat.s, revision 1.1

1.1     ! root        1: :
        !             2: # MLP script to report the despooler's status in a Unix V manner.
        !             3: #
        !             4: # The following options are not supported:
        !             5: #
        !             6: #    -a[list]  There is no such thing as a printer's "acceptance" status.
        !             7: #    -c[list]  Printers are not lumped into classes.
        !             8: #
        !             9: 
        !            10: MLPDIR=/usr/spool/mlp
        !            11: All=""
        !            12: 
        !            13: for Next in $*      # See if they want everything...
        !            14: do
        !            15:    case "$Next" in
        !            16:       -t) All=" -r -d ";;
        !            17:    esac
        !            18: done
        !            19: 
        !            20: 
        !            21: 
        !            22: for Next in $* $All    # Process the various arguments...
        !            23: do
        !            24:    case "$Next" in
        !            25:       -d)  # Print the system default destination
        !            26: 
        !            27:            dest=`awk -F= '/^[ ]*(DEFAULT|default)/ { print $2; next }
        !            28:                 ' $MLPDIR/controls`
        !            29: 
        !            30:            echo "system default destination: $dest";;
        !            31: 
        !            32: 
        !            33:       -r)  # Print the despooler (scheduler) status
        !            34: 
        !            35:            sched1=`ps -xfn | awk '{ if ($3 == "despooler") { print $2 }}'`
        !            36: 
        !            37:            sched2=`awk -F= '/^[ ]*(DESPOOLER|despooler)/ { i = $2; 
        !            38:                 printf "%d", i; next } ' $MLPDIR/status`
        !            39: 
        !            40:            pid=`expr "$sched2" + 0`
        !            41: 
        !            42:            if [ "$sched1" = "" ]    # despooler's PID will never be -1
        !            43:            then
        !            44:               sched1=-1
        !            45:            fi
        !            46: 
        !            47:            if test "$pid" -ne "$sched1"
        !            48:            then
        !            49:               echo "scheduler is not running"
        !            50:            else
        !            51:               echo "scheduler is running"
        !            52:            fi;;
        !            53: 
        !            54: 
        !            55:       -o)  # Print the status of each printer
        !            56:            awk -F= '/^[ ]*(PRINTER|printer)/ {
        !            57:                        split($2,ln,","); d = ln[2]
        !            58:                        dev[d] = ln[1];
        !            59: 
        !            60:                        printf "---> ln[%s] = %s\n", d, dev[d]; next }
        !            61:                     { lines[$1] = $0 }
        !            62:            END {
        !            63:               for (n in dev) {
        !            64:                  printf "%s (%s) ", dev[n], lines[n]
        !            65: 
        !            66:                  if ( lines[n] != "") 
        !            67:                     printf "%s\n", lines[n] 
        !            68:                  else 
        !            69:                     printf "is idle\n" 
        !            70:               }
        !            71:            }' $MLPDIR/controls $MLPDIR/status 
        !            72:            ;;
        !            73:            
        !            74:    esac
        !            75: done

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.