|
|
DataMuseum.dkPresents historical artifacts from the history of: Regnecentalen RC-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Regnecentalen RC-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T U l
Length: 1900 (0x76c)
Types: TextFile
Notes: UNIX file
Names: »lockfilter«
└─⟦c93a30372⟧ Bits:30004169/disk3.imd Uniplex II+ V.6 release 1.0 (dansk)
└─⟦c93a30372⟧ UNIX Filesystem
└─⟦this⟧ »up/new/usr/UAP/unsupported/lockfilter«
: '
lockfilter - noddy locking filter
(for spooler-less systems)
'
USAGE='
Usage: lockfilter [-V] [-addcr] [-bg] [lockname]
lockname arbitrary name. Defaults to "lockprint"
-addcr adds CR before every LF
-bg Background: No interactive control of locks
Standard UNIX filter mechanisms. eg:
uprint -p file | lockfilter >/dev/tty12
'
: Argument scan/default
ADDCR=
BG=
for ARG do
case "$ARG" in
-[Vv] ) echo "$0: Vs. AP.03" >&2; exit 1;;
-addcr) ADDCR=YES;;
-bg ) BG=YES;;
*) case "$LOCKNAME" in
'') LOCKNAME="$ARG";;
*) echo "Unexpected argument: \"$ARG\"$USAGE" >&2
exit 1;;
esac
;;
esac
done
LOCKNAME=${LOCKNAME-lockprint}
: Work in lock direcory
LOCKDIR=/tmp/.Ulocks
if ( cd $LOCKDIR ) >/dev/null 2>&1; then
cd $LOCKDIR
else
mkdir $LOCKDIR >/dev/null 2>&1
cd $LOCKDIR ||
{ echo "$0: Can't create/enter $LOCKDIR" >&2
exit 1
}
chmod 777 $LOCKDIR
fi
: Hold on lock. User interaction must be on stderr
if test -f "$LOCKNAME"; then
case "$BG" in
YES) echo "
Device is locked (LOCKNAME=$LOCKNAME). Please retry later" >&2
exit 1;;
esac
( STILL=
while test -f "$LOCKNAME"; do
echo "
Device is$STILL locked (LOCKNAME=$LOCKNAME). Options available:
1 - Try to proceed (eg: someone else has freed the lock now)
2 - Abort operation
3 - Remove the lock
Please enter choice number follwed by <RETURN>
(or just <RETURN> for choice 1)"
STILL=" still"
read RSP SCRAP
case "$RSP" in
''|1) ;;
2) exit 1;;
3) rm -f "$LOCKNAME";;
*) echo "Invalid response, \"$RSP\"";;
esac
done
exit 0
) <&2 >&2 || exit
fi
>"$LOCKNAME"
case "$ADDCR" in
YES) CR=`echo | tr '\012' '\015'`
sed "s/$/$CR/"
;;
*) cat;;
esac
rm -f "$LOCKNAME"