Date: Tue, 19 Jan 2010 16:52:18 +0100 From: Polytropon <freebsd@edvax.de> To: Gary Kline <kline@thought.org> Cc: FreeBSD Mailing List <freebsd-questions@freebsd.org> Subject: Re: curses init in one line? Message-ID: <20100119165218.0f6473e5.freebsd@edvax.de> In-Reply-To: <20100119002838.GB11545@thought.org> References: <20100118033426.GA7585@thought.org> <20100118212136.95b56398.freebsd@edvax.de> <20100119002838.GB11545@thought.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 18 Jan 2010 16:28:38 -0800, Gary Kline <kline@thought.org> wrote: > ps: re Subject line, I remember it let you use /bin/sh without hittin > enter or <cr>. there's no easy way of doing that in C! In one line? initscr(); cbreak(); noecho(); nonl(); intrflush(stdscr, FALSE); keypad(stdscr, TRUE); start_color(); :-) The meaning of this "init dance" is explained in the manpage of curs_inopts - "curses input options": cbreak, nocbreak, echo, noecho, halfdelay, intrflush, keypad, meta, nodelay, notimeout, raw, noraw, noqiflush, qiflush, timeout, wtimeout, typeahead The start_color() function is mentioned in "man curs_color" and is only needed if you want to use colors. For shell scripts, the use of the dialog programs is a good idea: #!/bin/sh DIALOG=${DIALOG=/usr/bin/dialog} This is some kind of "init ncurses in one line". More examples here: /usr/share/examples/dialog/ -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100119165218.0f6473e5.freebsd>