From: SMTP%"titandmp@ftp-gw-1.pa.dec.com" 29-AUG-1994 17:23:08.81 To: USRC CC: Subj: v28i123: slock-1.0 - a curses screen lock with logging, screensaver, Part01/01 Resent-Date: 29 Aug 1994 14:01:57 -0700 Path: decwrl!vixie!vixie!not-for-mail From: wbachman@chop.isca.uiowa.edu (Wes Bachman) Newsgroups: comp.sources.unix Subject: v28i123: slock-1.0 - a curses screen lock with logging, screensaver, Part01/01 Date: 29 Aug 1994 14:01:57 -0700 Organization: Vixie Enterprises Lines: 1261 Sender: vixie@vix.com Approved: vixie@gw.home.vix.com Message-Id: <1.778194081.1739@gw.home.vix.com> Nntp-Posting-Host: gw.home.vix.com To: unix-sources@pa.dec.com Resent-Message-Id: <"0vthA2.0.qP.G5bOk"@ftp-gw-1.pa.dec.com> Resent-From: unix-sources@pa.dec.com X-Mailing-List: archive/latest/60 X-Loop: unix-sources@pa.dec.com Precedence: list Resent-Sender: unix-sources-request@pa.dec.com Submitted-By: wbachman@chop.isca.uiowa.edu (Wes Bachman) Posting-Number: Volume 28, Issue 123 Archive-Name: slock-1.0/part01 This message contains a complete shar archive of the source code of a program known as slock. Slock, which stands for Screen LOCK, is a program which locks ones terminal on a unix system using curses capabilities as an interface. Unlike the standard "lock" command, this package includes a number of things such as incorrect password entry logging and a screen saver to enchance security when one is away from ones computer. Feel free to send bug reports, comments and suggestions to wbachman@blue.weeg.uiowa.edu #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'BUGS' <<'END_OF_FILE' X XWhen you type the correct key after a signal of some sort has been received, Xslock will tell you that the key is invalid. It is not, of course. Type the Xkey again to get it to work right. This is also true during screen refreshes X(^L). END_OF_FILE if test 240 -ne `wc -c <'BUGS'`; then echo shar: \"'BUGS'\" unpacked with wrong size! fi # end of 'BUGS' fi if test -f 'INSTALL' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'INSTALL'\" else echo shar: Extracting \"'INSTALL'\" \(335 characters\) sed "s/^X//" >'INSTALL' <<'END_OF_FILE' X XTo install this package: X X [I'm assuming you've already extracted the archive.] X 1. Edit the file "Makefile" for your system. X 2. Edit the file "slock.h" for your system. X 3. Type "make" and cross your fingers. X 4. Type 'slock -help' to get information on options for slock. X 5. Mail bug reports to wbachman@blue.weeg.uiowa.edu END_OF_FILE if test 335 -ne `wc -c <'INSTALL'`; then echo shar: \"'INSTALL'\" unpacked with wrong size! fi # end of 'INSTALL' fi if test -f 'MANIFEST' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'MANIFEST'\" else echo shar: Extracting \"'MANIFEST'\" \(455 characters\) sed "s/^X//" >'MANIFEST' <<'END_OF_FILE' X File Name Archive # Description X----------------------------------------------------------- X BUGS 1 X INSTALL 1 X MANIFEST 1 This shipping list X Makefile 1 X README 1 X additions 1 X options 1 X slock.c 1 X slock.h 1 X slock2.c 1 X version_history 1 END_OF_FILE if test 455 -ne `wc -c <'MANIFEST'`; then echo shar: \"'MANIFEST'\" unpacked with wrong size! fi # end of 'MANIFEST' fi if test -f 'Makefile' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Makefile'\" else echo shar: Extracting \"'Makefile'\" \(688 characters\) sed "s/^X//" >'Makefile' <<'END_OF_FILE' X X# Simple Makefile for slock X XCC = /bin/cc XCFLAGS = -O X X# For this, choose ALARM to use alarm() and ITIMER to use setitimer() X# If you MUST use alarm, you will have to go down and edit the "REDO" X# variable in slock.h. <----DO NOT FORGET THIS! X XAFLAG = -DITIMER X# AFLAG = -DALARM X X# Edit everything above this line, nothing below X XOBJS = slock.o slock2.o XLDFLAGS = -lcurses -ltermcap X X.c.o: X $(CC) $(CFLAGS) $(AFLAG) -c $*.c X X Xslock: $(OBJS) X $(CC) $(CFLAGS) $(AFLAG) -o slock $(OBJS) $(LDFLAGS) X @echo 'Screen lock compiled successfully!' X X Xclean: X rm -f *.o X rm -f slock X Xexport: clean X rm -f ../slock.tar.Z X tar cf ../slock.tar ../slock X compress -v ../slock.tar X Xslock.c : slock.h END_OF_FILE if test 688 -ne `wc -c <'Makefile'`; then echo shar: \"'Makefile'\" unpacked with wrong size! fi # end of 'Makefile' fi if test -f 'README' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'README'\" else echo shar: Extracting \"'README'\" \(1763 characters\) sed "s/^X//" >'README' <<'END_OF_FILE' XLEGAL NOTE: XWES BACHMAN, PARADIGM SHIFT COMPUTING, THE UNIVERSITY OF IOWA AND ANY XOTHER AFFILIATED ORGANIZATIONS TAKE NO OBLIGATION FOR THE CONSEQUENCES XOF USE OR MISUSE OF THIS PROGRAM. BY COMPILING OR RUNNING THIS PROGRAM, YOU XTHE USER TAKE FULL RESPONSIBILITY FOR ANY LIABILITIES THAT MAY RESULT FROM THE XUSE OF THIS SOFTWARE OR ANY DATA IN THIS PACKAGE. THE ABOVE MAKE NO XWARRANTY, EXPRESS OR IMPLIED, TO THE USE OR POSESSION OF THIS SOFTWARE. X X XThis is the program Screen Lock (slock) by Wes Bachman, 1992. XAll rights reserved. You may duplicate this program in its final version X(1.0) as long as you include my name and all the files included in this Xpackage. (This program is Public Domain. You may modify it and distribute Xit, as long as you credit the original author, and do not charge anything Xfor the modified or original product.) X XThis utility is made as an alternative to the lock program, and works in Xa similar way to lock, albeit more sophisticated. It is modeled after lock Xon pine, xlock and lock. X XTo run slock, just type slock, enter the key twice, and your screen will be Xcleared, and info displayed about the lock. XSlock now allows such things as optional locking times, locking with Xeither password or key, event logging, lock countdown in seconds or Xminutes, a screen saver and screen refresh. X XScreen Lock uses the curses standard library for terminal emulation, and Xshould work with most terminal emulators. X XIf you have a problem with this package, mail wbachman@blue.weeg.uiowa.edu X XAlso, if you enjoy or use this package and would like to comment or just Xsay Hi, please mail to the above address! X XEnjoy. X XSlock is provided to you by Paradigm Shift Computing, which is an unoffical, Xunincorporated group of Unix programmers. END_OF_FILE if test 1763 -ne `wc -c <'README'`; then echo shar: \"'README'\" unpacked with wrong size! fi # end of 'README' fi if test -f 'additions' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'additions'\" else echo shar: Extracting \"'additions'\" \(575 characters\) sed "s/^X//" >'additions' <<'END_OF_FILE' X XThe following is a list of additions I would like to add to slock in Xfuture versions. (First the thing has to get out of Alpha mode...) If Xyou have any suggestions for additions, mail wbachman@blue.weeg.uiowa.edu. X X1. Ask to delete log file, if specified one already exists. X X2. Make two lines with system/process/user info. (-info option?) X X3. Make line with a "message" to anyone who walks by the screen and reads it. X X4. Lock out incoming messages like talk requests. X X5. Sense new mail and other such things, and display alert for user. X X6. Create a man1 file. END_OF_FILE if test 575 -ne `wc -c <'additions'`; then echo shar: \"'additions'\" unpacked with wrong size! fi # end of 'additions' fi if test -f 'options' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'options'\" else echo shar: Extracting \"'options'\" \(524 characters\) sed "s/^X//" >'options' <<'END_OF_FILE' X XCommand line options: X Xslock usage X Gives program usage X Xslock help X Gives brief help on command line options and usage of program. X Xslock -seconds X Allows user to view time left in seconds rather than minutes. X (Very fast. Use with caution.) X Xslock -p X Use system password instead of using a key. X Xslock -l X Log all actions to the log file. (Bad key, interrupts, etc.) X Xslock -t X Locks for time specified in minutes. X Xslock -s X Activates the screen saver after number of minutes specified. END_OF_FILE if test 524 -ne `wc -c <'options'`; then echo shar: \"'options'\" unpacked with wrong size! fi # end of 'options' fi if test -f 'slock.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'slock.c'\" else echo shar: Extracting \"'slock.c'\" \(14524 characters\) sed "s/^X//" >'slock.c' <<'END_OF_FILE' X#include X#include X#include X/* #include */ X#include X#include X#include X#include X#include "slock.h" X X/* X * Layout: X * Line 0: Title... program name, user name. X * Line 4: Who locked it and when? X * Line 8: Time left, and time locked. X * Line 11: Current time. X * Line 14: Status (Problems. Wrong key, interrupts, etc.) X * (16-18 could be system info lines....) X * Line 20: Enter key line. X */ X Xchar real_pass[21]; Xlong at = DEFAULTTIME; Xlong left = DEFAULTTIME; X X/* This is to hold screen data for redraws and stuff. See the functions X * savescr(), redraw(), and delscr() */ Xchar *screen[25]; Xchar scrlen[25]; Xchar scrpos[25]; X X/* Are we in the screen saver ? */ Xchar sson = FALSE; Xint saveat = 0; Xlong savetime = 0; X Xint hsaver(); Xint halarm(); Xint hint(); Xint hstp(); Xchar passmode = FALSE; Xchar logmode = FALSE; Xchar *logfile; Xchar seconds = FALSE; X X/* X * This is the main function. It parses the arguments, and runs the main X * loop for the entry of data. X */ X Xmain(int argc, char **argv) X{ X char one[21]; X char two[21]; X char keytry[21]; X int gotkey = FALSE; X register int i; X X for(i=2; i<=argc; i++) { X if(*argv[i-1] == '-') X argv[i-1]++; X X if(!(strcmp(argv[i-1], "usage"))) { X printf( X "Usage: %s [-p] [-s ] [seconds] [-l ", X argv[0]); X printf("] [-t