/*
* Hello, sorry to bother again with lame code but...
* I get this code to build but it core dumps and gdb tells me that it
sigvfault at waddch.
* I have no idea on how to fix this.
*/
#include <stdio.h>
#include <curses.h>
#include <signal.h>
#include <time.h>
#include <stdlib.h>
static void done(int sig);
void main(void)
{
WINDOW *win[6];
unsigned seed;
int xer, yer, i;
signal(SIGINT, done);
initscr();
nonl();
noecho();
keypad(stdscr, TRUE);
cbreak();
if(has_colors())
{
start_color();
init_pair(1, COLOR_GREEN, COLOR_BLACK);
init_pair(2, COLOR_RED, COLOR_BLACK);
init_pair(3, COLOR_BLUE, COLOR_BLACK);
}
else
fprintf(stderr, "This terminal can't support colors\n"), exit(0);
seed = time((time_t *)0);
srand(seed);
for(i = 0; i < 6; ++i)
win[i] = newwin(i, i, 2, 22);
wattrset(win[1], COLOR_PAIR(1));
wattrset(win[2], COLOR_PAIR(2));
wattrset(win[3], COLOR_PAIR(3));
wattrset(win[4], COLOR_PAIR(3));
wattrset(win[5], COLOR_PAIR(2));
wattrset(win[5], COLOR_PAIR(1));
waddch(win[1], 'C');
waddch(win[2], 'a');
waddch(win[3], 'n');
waddch(win[4], 'u');
waddch(win[5], 'l');
waddch(win[6], 'y');
for(i = 0; i < 6; i++);
wrefresh(win[i]);
done(0);
}
static void done(int sig)
{
if(sig == 4)
printf("^C caught!\n"), endwin(), exit(0);
endwin();
puts(P_VERSION);
}
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com