news@to.rushpc (Usenet news administrator) (02/19/91)
In article <1991Feb18.035149.369@convex.com> tchrist@convex.COM (Tom Christiansen) writes: >:In article <8531@castle.ed.ac.uk> james@castle.ed.ac.uk (J Gillespie) writes: >:> >:>Does anyone know of a way to prevent characters being echoed as they >:>are typed in? Like when you log in, your password doesn't get echoed. >:>I have a nasty feeling this may involve sending control codes to the >:>terminal. > >This is *not* a C-related question. It's an OS-related question, and >cannot be answered portably. It's very closely related to "how do I get >one character from the keyboard," which doesn't belong here either. > Seems like a perfectly legitimate subject for this news group to me but, let me have it if I'm wrong. Recently I've seen postings discussing the composition of functions in this group, I think they belong in math.college. algebra.f(x) o g(x) - just kidding. I've also wondered how to turn off echo while writing a C program. I've RTFM, AT&T's, on ioctl(2) and termio(7). Finally, I gave up and used the curses library. Curses attempts to have portability in it's middle name. You can turn off echo, make a terminal belch, blink, and ring using curses. I would not suggest using system("stty raw"). I tried it, just for grins, and ended up having to power cycle my terminal. If you must use system(), try system("stty -echo") to turn off echo, and then system("stty echo") to turn it back on. In the original question, he asked how /bin/login managed to turn off echo. I believe /bin/login uses getpass(3). getpass(3), after issuing a prompt, turns off echo and then accepts up to eight characters typed in from the keyboard. Now I'm sure that the subroutine getpass(3) and the command stty(1), having been written in C Language, use the lower level ioctl(2) system call. I myself would like to see an example of it's use in a C program. John Rushford. I had trouble posting this and I hope multiple copies were not sent to the net. My apologies if this is the case.
mcdonald@aries.scs.uiuc.edu (Doug McDonald) (02/23/91)
In article <1991Feb23.014700.16507@ico.isc.com> rcd@ico.isc.com (Dick Dunn) writes: >james@castle.ed.ac.uk (J Gillespie) writes: > Does anyone know of a way to prevent characters being echoed... >.... >2. It's not a good subject for the C language group because the answer >isn't related to C, The original question, cut down to the one sentence quoted above, **IS** a good subject for comp.lang.c. That is because it SHOULD be possible to do such very common things as non-echo reading or reading single characters without terminating carriage returns. We should be discussing how to put this into the next standardized version of the language. It SHOULD have been in the present version. Doug McDonald
rcd@ico.isc.com (Dick Dunn) (02/23/91)
news@to.rushpc (Usenet news administrator [who knows???]) writes: > tchrist@convex.COM (Tom Christiansen) writes: > >james@castle.ed.ac.uk (J Gillespie) writes: > >:>Does anyone know of a way to prevent characters being echoed... ... > >This is *not* a C-related question. It's an OS-related question,... ... > Seems like a perfectly legitimate subject for this news group to me but, > let me have it if I'm wrong... 1. We can't "let you have it" if you're wrong, because your news system is putting out such badly-broken headers that there's no way to reply to you. 2. It's not a good subject for the C language group because the answer isn't related to C, just as Christiansen said. It depends on the OS. Why would you think that language-independent, OS-dependent questions should be asked in an OS-independent language-specific newsgroup??? -- Dick Dunn rcd@ico.isc.com -or- ico!rcd Boulder, CO (303)449-2870 ...But is it art?
gwyn@smoke.brl.mil (Doug Gwyn) (02/24/91)
In article <1991Feb23.170142.538@ux1.cso.uiuc.edu> mcdonald@aries.scs.uiuc.edu (Doug McDonald) writes: >That is because it SHOULD be possible to do such very common things >as non-echo reading or reading single characters without terminating >carriage returns. We should be discussing how to put this into the >next standardized version of the language. It SHOULD have been in the >present version. I don't think you would find many (if any) people among those who have carefully considered what needed to go into the C standard, who would agree with you. This is clearly a very system-specific notion; there are C environments where the notion makes no sense. The C standard addresses (for hosted environments only) just the minimum universally- implementable support necessary for useful applications across all hosted environments. There are other standards, such as POSIX.1, that address more system-specific features, and that is an appropriate way to deal with them.
peter@ficc.ferranti.com (Peter da Silva) (02/26/91)
In article <1991Feb23.170142.538@ux1.cso.uiuc.edu> mcdonald@aries.scs.uiuc.edu (Doug McDonald) writes: > That is because it SHOULD be possible to do such very common things > as non-echo reading or reading single characters without terminating > carriage returns. Even on operating systems that don't support such operations? > We should be discussing how to put this into the > next standardized version of the language. It SHOULD have been in the > present version. No, it should be in an O/S independent extension library, somewhere between X3J11 and 1003.1. -- Peter da Silva. `-_-' peter@ferranti.com +1 713 274 5180. 'U` "Have you hugged your wolf today?"