Lock your terminal for lunch

cwj at csadfa.oz cwj at csadfa.oz
Tue Sep 24 06:26:50 AEST 1985


Here is a reasonably safe way to lock your terminal for lunch,
for `csh' users.

It is immune to holding down the interrupt key,
and immune to attempts to suspend the program (^z),
because it grabs and ignores the former and has nullified the latter.
BUT it is still vulnerable to QUIT (^\) - and I don't know why!
("onintr -" is supposed to ignore all interrupts)

----------------------------------------------------------
#!/bin/csh
# lock terminal until password received
echo "TERMINAL LOCKED"
stty -echo susp '' dsusp ''
onintr -
while ("$< x" != 'YOUR_PASSWORD x')
  echo 'Please ---- ---, Chris is at lunch'
  echo -n '% '
end

# restore the terminal to a normal state
stty echo susp '^z' dsusp '^y'
----------------------------------------------------------



More information about the Comp.sources.unix mailing list