home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.unix.programmer:4003 comp.unix.sysv386:12611
- Newsgroups: comp.unix.programmer,comp.unix.sysv386
- Path: sparky!uunet!usc!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!wariat!erica
- From: erica@wariat.org (Lady of the BitMode)
- Subject: I/O of login shell
- Message-ID: <1992Jul29.220116.1634@wariat.org>
- Organization: Akademia Pana Kleksa, Public Access Uni* Site
- Distribution: usa
- Date: Wed, 29 Jul 1992 22:01:16 GMT
- Lines: 49
-
- Hi.
-
- I'm running SVR4. First a very very brief to help along the way.
- When a person logins into a unix system the system must first:
- 1) spawn a getty from teriminal
- 2) getty runs login
- 3) then getty exec users specified shell, resorting to default, usually bourne,
- if none specified.
- 4) user gets 3 basic file handles:
- stdout 0, stdin 1, stderr 2.
-
- Now, what I want to do is run a background process that's basically
- listens to file des #1 for a specified key sequence it will then
- wakeup specific processes, that are sleeping in background, and
- susend whatever the user is doing.
-
- I know that the suspensions and wakeups are straight forward but the is
- there a nice way for a process to hang around in the background and
- listen to file descript. #1 for specific key sequence. I think that
- the following code might doit:
-
- #include <stdio.h>
- void main( void ) ;
- void main( void )
- {
- int fd_in = 1 ;
- for ( ;; )
- {
- TOP:
- if ( (read( fd_in, &c, 1 )) && (c == KEY1) )
- {
- /* do whatever */
- }
- }
- }
-
- Then run from command shell like :
- $ peekaboo & # run in background
-
- Will this do the job or is there another function, technique already
- proven, or is it just impossible.
-
- PS: I'm gonna go try the above. I know it's not going tobe a trivial task! :(
-
- Thankyou:
-
- Erica C. Ramsey
-
- QuickBits & Turbo Nets Vroommmmmmmm!!!!
-