Xref: utzoo unix-pc.general:6028 comp.sys.att:10358 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!rpi!uupsi!oswego!news From: ostroff@Oswego.EDU (Boyd Ostroff) Newsgroups: unix-pc.general,comp.sys.att Subject: Re: More Window Questions (was: ** Windows Answers **) Message-ID: <1990Sep7.222509.26761@oswego.Oswego.EDU> Date: 7 Sep 90 22:25:09 GMT References: <1990Sep3.175649.15834@mercury.cair.du.edu> <589@quad.sialis.mn.org> <1199@glyph.UUCP> Reply-To: ostroff@oswego.Oswego.EDU (Boyd Ostroff) Organization: Instructional Computing Center, SUNY at Oswego, Oswego, NY Lines: 51 In article <1199@glyph.UUCP> ahh@glyph.UUCP (Andy Heffernan) writes: >I'm no expert on this, but I've been doing the multiple console getty >thing for awhile now and find it quite handy. The biggest problem I've >found, however, is that some library code (like getlogin(), cuserid() -- >basically the /etc/utmp grokkers) doesn't understand that this is possible. >Apparently when they scan utmp looking for your login name when you're >logged onto a console window, they stop after seeing the first user name >on any console window, even if it's the wrong window. I'm also a big fan of multiple windows. I wrote a little getty replacement for the console (wlogin) which facilitates this by allowing multiple, overlapping 24x80 windows that utilize a smaller font, and have been using it for a couple years without problems. Send me mail if you'd like a copy. As far as the getlogin() problem, I did a quick hack to fix this awhile ago. Substitute the following get_login() routine for the stock getlogin() and it will fix your problems... ||| Boyd Ostroff - Tech Director - Dept of Theatre - SUNY Oswego ||| Sys Admin - "The CallBoard" - (315) 947-6414 - 1200/2400 baud ||| ostroff@oswego.oswego.edu - cboard!ostroff@oswego.oswego.edu #include #include #include #include #include #include char *get_login() /* this function replaces getlogin() */ { /* which doesn't work properly with multiple */ struct utmp *getutent(); /* windows on the Unix-PC system console */ struct utmp *u; /* Boyd Ostroff (ostroff@oswego.oswego.edu) */ char *ttyname(); char *where; where = 1 + strrchr(ttyname(0), '/'); setutent(); while ((u = getutent()) != NULL) { if (u->ut_type == 7) /* only check user processes */ { if (strcmp(where, u->ut_line) ==0) { return(u->ut_user); } } } endutent(); }