cranor@udel.edu (Chuck Cranor) (11/01/89)
This is a quick hack I had to put together for use at my new school (wustl). It prevents the Purdue "untamo" daemon from logging you out when you are idle. Since I run the "screen" program from comp.sources.unix I never logout my main logins...I just "detach" from my screens and then re-attach to them when ever I login. I've included a "Makefile" generated by the "mkmf" program... ################# CUT HERE ######################### # This is a shar archive. Extract with sh, not csh. # The rest of this file will extract: # un_untamo.c Makefile echo x un_untamo.c sed 's/^X//' > un_untamo.c << 'xEOF' X/* X * un_untamo.c 11-Sep-89 Chuck Cranor <cranor@udel.edu> X * This program defeats part of the "untamo" daemon from Purdue. X * It has run correctly under SunOS 4.0 and Mt Xinu 4.3+NFS unix. X * X * "untamo" can be configured to logout "idle terminals". X * This "feature" of the program may not always be desirable. X * The "un_untamo" program (designed to be run by your login shell via .login X * or whatever ...) runs in the background and touches your terminal X * device every 5 minutes. This prevents your idle time from going X * above 5 minutes. The program exits when it detects that X * it's parent has exited/died (e.g. you logout). [It does this with X * kill(0,pid)] X * X * Please send comments/bug reports to: chuck@maria.wustl.edu or X * cranor@udel.edu (no flames please!). X * X */ X X#include <stdio.h> X#include <sys/types.h> X Xextern char *ttyname(); X Xmain() X X{ X int pp = getppid(); X if (fork()) X exit(0); X if (ttyname(0) == NULL) { X printf("Not a tty.\n"); X exit(1); X } X while (kill(pp, 0) != -1) { X sleep(300); X utime(ttyname(0), NULL); X } X printf("Done!\n"); X} xEOF echo x Makefile sed 's/^X//' > Makefile << 'xEOF' XDEST = . X XHDRS = X XCFLAGS = -O X XLDFLAGS = X XLIBS = X XLINKER = cc X XMAKEFILE = Makefile X XOBJS = un_untamo.o X XPRINT = pr X XPROGRAM = un_untamo X XSRCS = un_untamo.c X Xall: $(PROGRAM) X X$(PROGRAM): $(OBJS) $(LIBS) X @echo -n "Loading $(PROGRAM) ... " X @$(LINKER) $(LDFLAGS) $(OBJS) $(LIBS) -o $(PROGRAM) X @echo "done" X Xclean:; @rm -f $(OBJS) X Xdepend:; @mkmf -f $(MAKEFILE) PROGRAM=$(PROGRAM) DEST=$(DEST) X Xindex:; @ctags -wx $(HDRS) $(SRCS) X Xinstall: $(PROGRAM) X @echo Installing $(PROGRAM) in $(DEST) X @install -s $(PROGRAM) $(DEST) X Xprint:; @$(PRINT) $(HDRS) $(SRCS) X Xprogram: $(PROGRAM) X Xtags: $(HDRS) $(SRCS); @ctags $(HDRS) $(SRCS) X Xupdate: $(DEST)/$(PROGRAM) X X$(DEST)/$(PROGRAM): $(SRCS) $(LIBS) $(HDRS) X @make -f $(MAKEFILE) DEST=$(DEST) install X### xEOF -- Chuck Cranor University of Delaware PHONE: (314)-849-8676, E-Mail: chuck@maria.wustl.edu E-Mail: cranor@udel.EDU, UUCP: ...!<your_favorite_arpa_gateway>!udel.edu!cranor "I'd like to see John the Baptist's impersonation of Graham Hill." - R.J. Gumby