*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->NetBSD man pages -> cnputc (9)              



NAME    [Toc]    [Back]

     cnbell, cngetc, cngetsn, cnpollc, cnputc - console access interface

SYNOPSIS    [Toc]    [Back]

     #include <dev/cons.h>

     cnbell(u_int pitch, u_int period, u_int volume);


     cngetsn(char *cp, int size);

     cnpollc(int on);

     cnputc(int c);

DESCRIPTION    [Toc]    [Back]

     These functions operate over current console device. The console has to
     be initialized first, before these functions could be used.

     Console input polling functions cngetc(), cngetsn() and cnpollc() are
     only to be used during initial system boot, e.g. when asking for root and
     dump device or to get necessary user input within mountroothooks. Once
     the system boots, user input is read via standard tty(4) facilities.

     The following is a brief description of each function:

     cnbell()   Ring a bell at appropriate pitch, for duration of period milliseconds
 at given volume.  Note that the volume value is
                ignored commonly.

     cngetc()   Poll (busy wait) for a input and return the input key.
                cnpollc() must be called before cngetc() could be used.
                cngetc() should be used during kernel startup only.

     cngetsn()  Read one line of user input, stop reading once the newline key
                is input. Input is echoed back. This uses cnpollc() and
                cngetc().  Number of read characters is size at maximum, user
                is notified by console bell when the end of input buffer is
                reached. <Backspace> key works as expected. <@> or <CTRL>-u
                make cngetsn() discard input read so far, print newline and
                wait for next input.  cngetsn() returns number of characters
                actually read, excluding the final newline.  cp is not zeroended
 before return.  cngetsn() should be used during kernel
                startup only.

     cnpollc()  Switch the console driver to polling mode if on is nonzero, or
                back to interrupt driven mode if on is zero.  cnpollc() should
                be used during kernel startup only.

     cnputc()   Console kernel output character routine. Commonly, kernel code
                uses printf(9) rather than using this low-level interface.

EXAMPLES    [Toc]    [Back]

     This waits until a <Enter> key is pressed:

     int c;

     for(;;) {
             c = cngetc();
             if ((c == '\r' || (c == '\n')) {

SEE ALSO    [Toc]    [Back]

     pckbd(4), pcppi(4), tty(4), wscons(4), wskbd(4), printf(9), spl(9)

BSD                              June 2, 2001                              BSD
[ Back ]
 Similar pages
Name OS Title
wscons OpenBSD console access
console Tru64 Console interface
console IRIX console interface
cons OpenBSD VAX console interface
systty HP-UX system console interface
cons OpenBSD HP300 console interface
syscon HP-UX system console interface
console HP-UX system console interface
pcons OpenBSD SPARC64 PROM console interface
syslog Tru64 enables and disables printing to the console device, /dev/console, by the syslogd daemon.
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service