chris@umcp-cs.UUCP (Chris Torek) (09/26/84)
The following subroutine will log you out of a 4.1 or 4.2BSD system
(don't know about 2.9 but probably that too):
logout () {
(void) lseek (0, -16L, 0);
exit (0);
}
The reason (in case you care) is that lseeks to negative offsets
are allowed on character special devices (to accomodate major device
#3) yet reads from these with a negative offset will (with the notable
exception of cdevsw[3] of course) fail.
The C shell, upon getting a failed read, quickly gives up and logs
you out. (Presumably the Bourne shell does the same thing. I haven't
tried it.)
--
(This page accidently left blank.)
In-Real-Life: Chris Torek, Univ of MD Comp Sci (301) 454-7690
UUCP: {seismo,allegra,brl-bmd}!umcp-cs!chris
CSNet: chris@umcp-cs ARPA: chris@maryland
jbn@wdl1.UUCP (jbn ) (09/27/84)
The old "stty 0" trick is sometimes useful, but it doesn't do anything for PTYs.
john@physiol.OZ (John M) (10/10/84)
. Relay-Version: version B UNSW 1.0 3/14/84; site physiol.OZ From: mcb%lll-tis.arpa@lll-tis.ARPA Date: Mon, 1-Oct-84 08:27:34 AEST Newsgroups: net.unix-wizards Subject: Logout from inside a program - help! Message-ID: <12340@sri-arpa.UUCP> Path: physiol!psych44!basser!munnari!mulga!decvax!genrad!wjh12!harvard!seismo!hao!hplabs!sri-unix!mcb%lll-tis.arpa@lll-tis.ARPA Date-Received: Thu, 27 Sep 84 12:36:42 AEST Lines: 39 From: "Michael C. Berch" <mcb%lll-tis.arpa@lll-tis.ARPA> > The rationale for a logout() system call makes more sense to me > now, considering that many people are writing applications that > involve logging out from inside programs such as menus, integrated > software packages, etc., that do not run as login shells. WHY? If they don't run as login shells, they should!!!!