Path: utzoo!utgpu!attcan!uunet!vsedev!logan From: logan@vsedev.VSE.COM (James Logan III) Newsgroups: comp.unix.questions Subject: Re: Login shell? Message-ID: <1230@vsedev.VSE.COM> Date: 7 Nov 88 23:55:16 GMT References: <3ed799bc.103e8@hi-csc.UUCP> <13851@mimsy.UUCP> <511@imec.UUCP> <25721@bu-cs.BU.EDU> <10791@ulysses.homer.nj.att.com> <1217@vsedev.VSE.COM> <1623@solo10.cs.vu.nl> Reply-To: logan@vsedev.VSE.COM (James Logan III) Organization: VSE Software Development Lab Lines: 41 In article <1623@solo10.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes: >In article <1217@vsedev.VSE.COM> logan@vsedev.VSE.COM (James Logan III) writes: >\... If you just want to find out what if the current >\shell is indeed the shell spawned by init(1M) (via getty(1M), login(1)), >\then just write a simple C program like this: >\-------- >\#include >\ >\main() >\{ >\ if (getppid() == getpgrp()) >\ exit(0); >\ exit(1); >\} > >1) > Why #include ? It's not necessary, I just always need it when I don't already have it, so it's just a habit, I guess. It doesn't hurt anything and it will only take a fraction of a second longer to compile it. In addition, if he adds an fprintf(), the program won't compile without it since the type "FILE" will be undefined. I wouldn't suggest #including every header file you might ever need, but this one is so often used, why not? >2) > This scheme won't work for rsh/rlogin. It works just fine for rlogin, thank you. I just tested it on my system. Since you don't have a true session with rsh it will indicate correctly that the program running is not your login shell. -Jim -- Jim Logan logan@vsedev.vse.com (703) 892-0002 uucp: ..!uunet!vsedev!logan inet: logan%vsedev.vse.com@uunet.uu.net