Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site umcp-cs.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxj!ihnp4!zehntel!hplabs!hao!seismo!umcp-cs!chris From: chris@umcp-cs.UUCP (Chris Torek) Newsgroups: net.unix-wizards Subject: Re: Logout from inside a program - help! Message-ID: <114@umcp-cs.UUCP> Date: Tue, 25-Sep-84 21:27:48 EDT Article-I.D.: umcp-cs.114 Posted: Tue Sep 25 21:27:48 1984 Date-Received: Fri, 28-Sep-84 05:47:49 EDT References: <12340@sri-arpa.UUCP> Organization: U of Maryland, Computer Science Dept., College Park, MD Lines: 22 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