日期:2014-05-16 浏览次数:20729 次
/*-
* Copyright (C), 1988-2014, mymtom
*
* vi:set ts=4 sw=4:
*/
#ifndef lint
static const char rcsid[] = "$Id$";
#endif /* not lint */
/**
* @file winch.c
* @brief
*/
#include <unistd.h>
#include <curses.h>
#include <signal.h>
#include <stdio.h>
static void sig_winch(int sig)
{
char buf[80];
signal(SIGWINCH, &sig_winch);
endwin();
initscr();
refresh();
sprintf(buf, "SIGWINCH: COLS=%3d LINES=%3d", COLS, LINES);
move(0, 0);
waddstr(stdscr, buf);
refresh();
}
int main(int argc, char *argv[])
{
int i;
char buf[80];
initscr();
signal(SIGWINCH, &sig_winch);
for (i = 0; i < 10; i++) {
sleep(2);
}
endwin();
return 0;
}