Plan 9 from Bell Labs’s /usr/web/sources/plan9/sys/src/cmd/postscript/grabit/grabit.rc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc
# Print a listing of an object, often a dictionary or an array. Something
# like ==, but the output is often easier to read and closer to PostScript
# that can be sent back through the interpreter.
#

POSTLIB=/sys/lib/postscript/prologues
PROLOGUE=$POSTLIB/grabit.ps

COPYFILE=
RECURSIVE=true
OMITNAMES='/Grabit /GrabitDict'

NONCONFORMING='%!PS'
ENDPROLOG='%%EndProlog'
BEGINSETUP='%%BeginSetup'
ENDSETUP='%%EndSetup'
TRAILER='%%Trailer'

SETUP=GrabitSetup

while (! ~ $#* 0 && ~ $1 -*) {
	switch ($1) {
	case -d;  RECURSIVE=false

	case -o;  shift; OMITNAMES=$OMITNAMES' '$1
	case -o*; OMITNAMES=$OMITNAMES' '`{echo $1 | sed s/-o//}

	case -C;  shift; COPYFILE=$COPYFILE' '$1
	case -C*; COPYFILE=$COPYFILE' '`{echo $1 | sed s/-C//}

	case -L;  shift; PROLOGUE=$1
	case -L*; PROLOGUE=`{echo $1 | sed s/-L//}

	case --;

	case -*;  echo $0: illegal option $1 >[1=2]; exit 1
    }
    shift
done

echo $NONCONFORMING
cat $PROLOGUE
echo $ENDPROLOG
echo $BEGINSETUP
if (~ $COPYFILE '') COPYFILE=/dev/null
cat $COPYFILE
echo 'GrabitDict begin'
echo '/recursive '$RECURSIVE' def'

echo mark
for (i in $OMITNAMES) {
	switch ($i) {
	case /*; echo $i
	case ?*; echo /$i
	}
}
echo GrabitSetup

echo end
echo $ENDSETUP

for (i) echo $i Grabit


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.