From owner-freebsd-questions@FreeBSD.ORG Mon Jan 18 20:21:41 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3BF0010656A3 for ; Mon, 18 Jan 2010 20:21:41 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx01.qsc.de (mx01.qsc.de [213.148.129.14]) by mx1.freebsd.org (Postfix) with ESMTP id EE6FC8FC25 for ; Mon, 18 Jan 2010 20:21:40 +0000 (UTC) Received: from r55.edvax.de (port-92-195-164-220.dynamic.qsc.de [92.195.164.220]) by mx01.qsc.de (Postfix) with ESMTP id 49C173D9EF; Mon, 18 Jan 2010 21:21:38 +0100 (CET) Received: from r55.edvax.de (localhost [127.0.0.1]) by r55.edvax.de (8.14.2/8.14.2) with SMTP id o0IKLad2001509; Mon, 18 Jan 2010 21:21:38 +0100 (CET) (envelope-from freebsd@edvax.de) Date: Mon, 18 Jan 2010 21:21:36 +0100 From: Polytropon To: Gary Kline Message-Id: <20100118212136.95b56398.freebsd@edvax.de> In-Reply-To: <20100118033426.GA7585@thought.org> References: <20100118033426.GA7585@thought.org> Organization: EDVAX X-Mailer: Sylpheed 2.4.7 (GTK+ 2.12.1; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: FreeBSD Mailing List Subject: Re: curses init in one line? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2010 20:21:41 -0000 On Sun, 17 Jan 2010 19:34:29 -0800, Gary Kline wrote: > > this is going to sound a bit off the wall, and it may have only worked > in FBSD [if I wasn't imagining it], but is there a way to get into > curses/ncurses mode in one short line? it has been years but I think > somebody sent me the magic code, for either a shell scrippt or a C > program. It's quite easy, let me demonstrate it with this example program: /* curses_attributes_test.c (-lncurses required) */ #include int main(void) { initscr(); cbreak(); noecho(); nonl(); intrflush(stdscr, FALSE); keypad(stdscr, TRUE); start_color(); attrset(A_NORMAL); printw("Normal display (no highlight)\n"); printw("\n"); attrset(A_STANDOUT); printw("Best highlighting mode of the terminal.\n"); printw("\n"); attrset(A_UNDERLINE); printw("Underlining\n"); printw("\n"); attrset(A_REVERSE); printw("Reverse video\n"); printw("\n"); attrset(A_BLINK); printw("Blinking\n"); printw("\n"); attrset(A_DIM); printw("Half bright\n"); printw("\n"); attrset(A_BOLD); printw("Extra bright or bold\n"); printw("\n"); refresh(); return 0; } The initsrc() funtion is the key. > I do not have it anywhere in my C files. But in the manpage. :-) -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...