Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 (Tek) 9/28/84 based on 9/17/84; site dadla.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!harvard!talcott!panda!genrad!decvax!tektronix!teklds!dadla!jamesa From: jamesa@dadla.UUCP (James Akiyama) Newsgroups: net.sources Subject: Setidle Program Message-ID: <329@dadla.UUCP> Date: Fri, 19-Jul-85 14:00:47 EDT Article-I.D.: dadla.329 Posted: Fri Jul 19 14:00:47 1985 Date-Received: Thu, 25-Jul-85 08:22:00 EDT Distribution: net Organization: Tektronix, Beaverton OR Lines: 46 This is a program which allows a user to set and maintain a specified idle time on his tty. The default (giving no parameters) sets the idle time to zero every 10 minutes. It is useful for those who need to maintain control on their idle time without being present at their terminals. To use the program one types: setidle [idle time] [update time] I hope this finds use with some of you out there. --------CUT HERE----------------------------------------------------------- #include #include main(argc,argv) int argc; char **argv; { long now; long idle[2]; long i; int k; nice(20); if (argc == 1) { i = 0; k = 600; } else if (argc == 3) { sscanf(argv[1],"%d",&i); sscanf(argv[2],"%d",&k); } else { fprintf(stderr,"Useage: setidle [idle time] [update time]\n"); exit(1); } while (getppid() != 1) { time(&now); idle[0] = now - i; idle[1] = now - i; utime(ttyname(1),idle); sleep(k); } exit(0); }