本文整理汇总了C++中clearok函数的典型用法代码示例。如果您正苦于以下问题:C++ clearok函数的具体用法?C++ clearok怎么用?C++ clearok使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了clearok函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: help
int
help()
{
extern int nlines;
int eof, i;
FILE *fp;
WINDOW *win;
char buf[BUFSIZ];
if ((fp = fopen(HELPFILE, "r")) == NULL)
return(-1);
win = newwin(0, 0, 0, 0);
clearok(win, 1);
eof = 0;
if (ungetc(getc(fp), fp) == EOF) {
wprintw(win, "There doesn't seem to be any help.");
eof = 1; /* Nothing there... */
}
while (!eof) {
for (i = 0; i < nlines - 3; i++) {
if (fgets(buf, sizeof(buf), fp) == (char *) NULL) {
eof = 1;
break;
}
if (buf[0] == '.' && buf[1] == '\n')
break;
wprintw(win, "%s", buf);
}
if (eof || ungetc(getc(fp), fp) == EOF) {
eof = 1;
break;
}
wmove(win, nlines - 1, 0);
wprintw(win,
"Type <space> to continue, anything else to quit...");
wrefresh(win);
if ((inputch() & 0177) != ' ')
break;
wclear(win);
}
fclose(fp);
if (eof) {
wmove(win, nlines - 1, 0);
wprintw(win, "Hit any key to continue...");
wrefresh(win);
inputch();
}
delwin(win);
clearok(stdscr, 1);
refresh();
return(0);
}
开发者ID:Kiddinglife,项目名称:4.4BSD-Lite,代码行数:55,代码来源:help.c
示例2: nc_sigwinch
static void nc_sigwinch(int s)
/* SIGWINCH signal handler */
{
mpdm_t v;
#ifdef NCURSES_VERSION
/* Make sure that window size changes... */
struct winsize ws;
int fd = open("/dev/tty", O_RDWR);
if (fd == -1)
return; /* This should never have to happen! */
if (ioctl(fd, TIOCGWINSZ, &ws) == 0)
resizeterm(ws.ws_row, ws.ws_col);
close(fd);
#else
/* restart curses */
/* ... */
#endif
/* invalidate main window */
clearok(stdscr, 1);
refresh();
/* re-set dimensions */
v = mpdm_hget_s(mp, L"window");
mpdm_hset_s(v, L"tx", MPDM_I(COLS));
mpdm_hset_s(v, L"ty", MPDM_I(LINES));
/* reattach */
signal(SIGWINCH, nc_sigwinch);
}
开发者ID:jcowgar,项目名称:mp-5.x,代码行数:35,代码来源:mpv_curses.c
示例3: displayhelp
/* Display information about the various key commands. Each element in
* the keys array contains two sequential NUL-terminated strings,
* describing the key and the associated command respectively. The
* strings are arranged to line up into two columns.
*/
void displayhelp(char const *keys[], int keycount)
{
int keywidth, descwidth;
int i, n;
keywidth = 1;
descwidth = 0;
for (i = 0 ; i < keycount ; ++i) {
n = strlen(keys[i]);
if (n > keywidth)
keywidth = n;
n = strlen(keys[i] + n + 1);
if (n > descwidth)
descwidth = n;
}
erase();
n = keywidth + descwidth + 2;
if (n < 4)
n = 4;
mvaddstr(0, n / 2 + 2, "Keys");
for (i = 0 ; i < n ; ++i)
mvaddch(1, i, ACS_HLINE);
for (i = 0 ; i < keycount ; ++i) {
n = strlen(keys[i]);
mvaddstr(i + 2, 0, keys[i]);
mvaddstr(i + 2, keywidth + 2, keys[i] + n + 1);
}
mvaddstr(lastline, 0, "Press any key to return.");
refresh();
clearok(stdscr, TRUE);
}
开发者ID:BR903,项目名称:cgames,代码行数:38,代码来源:cursesio.c
示例4: init_allwin
int init_allwin()
{
int ret =0;
int i = 0;
Win win[4] = {
// x,y,width,height,name,title,WINDOW*
{{0, 0, 60, 60}, {0, 0, 0.8, 1}, "L1", "", NULL},
{{100, 0, 20, 20}, {0.8, 0, 0.2, 0.4}, "R1", "", NULL},
{{100, 10, 20, 20}, {0.8, 0.4, 0.2, 0.4}, "R2", "", NULL},
{{100, 15, 20, 20}, {0.8, 0.8, 0.2, 0.2}, "RCMD", "", NULL},
};
for (i=0; i<4; i++) {
win[i].win = newwin(win[i].locate.y, win[i].locate.x, 0, 0);
if (NULL == win) {
printf("Init failed.\n");
ret = -1;
break;
}
if (strcmp(win[i].name, "L1") == 0) {
scrollok(win[i].win, TRUE);
} else {
clearok(win[i].win, TRUE);
}
windows.insert(Windows::value_type(win[i].name, win[i]));
Win frame;
memcpy(&frame, &win[i], sizeof(Win));
frame.win = newwin(win[i].locate.y, win[i].locate.x, 0, 0);
frames.insert(Windows::value_type(win[i].name, frame));
}
return ret;
}
开发者ID:pengyuwei,项目名称:hackathon2014,代码行数:35,代码来源:h.c
示例5: low_level_change_screen_size
static void
low_level_change_screen_size (void)
{
#if defined(HAVE_SLANG) || NCURSES_VERSION_MAJOR >= 4
#if defined TIOCGWINSZ
struct winsize winsz;
winsz.ws_col = winsz.ws_row = 0;
/* Ioctl on the STDIN_FILENO */
ioctl (0, TIOCGWINSZ, &winsz);
if (winsz.ws_col && winsz.ws_row){
#if defined(NCURSES_VERSION) && defined(HAVE_RESIZETERM)
resizeterm(winsz.ws_row, winsz.ws_col);
clearok(stdscr,TRUE); /* sigwinch's should use a semaphore! */
#else
COLS = winsz.ws_col;
LINES = winsz.ws_row;
#endif
#ifdef HAVE_SUBSHELL_SUPPORT
resize_subshell ();
#endif
}
#endif /* TIOCGWINSZ */
#endif /* defined(HAVE_SLANG) || NCURSES_VERSION_MAJOR >= 4 */
}
开发者ID:BackupTheBerlios,项目名称:mcvox,代码行数:25,代码来源:layout.c
示例6: mutt_get_field_full
/**
* mutt_get_field_full - Ask the user for a string
* @param[in] field Prompt
* @param[in] buf Buffer for the result
* @param[in] buflen Length of buffer
* @param[in] complete Flags, see #CompletionFlags
* @param[in] multiple Allow multiple selections
* @param[out] files List of files selected
* @param[out] numfiles Number of files selected
* @retval 1 Redraw the screen and call the function again
* @retval 0 Selection made
* @retval -1 Aborted
*/
int mutt_get_field_full(const char *field, char *buf, size_t buflen, CompletionFlags complete,
bool multiple, char ***files, int *numfiles)
{
int ret;
int x;
struct EnterState *es = mutt_enter_state_new();
do
{
if (SigWinch)
{
SigWinch = 0;
mutt_resize_screen();
clearok(stdscr, TRUE);
mutt_menu_current_redraw();
}
mutt_window_clearline(MuttMessageWindow, 0);
SETCOLOR(MT_COLOR_PROMPT);
addstr(field);
NORMAL_COLOR;
mutt_refresh();
mutt_window_getxy(MuttMessageWindow, &x, NULL);
ret = mutt_enter_string_full(buf, buflen, x, complete, multiple, files, numfiles, es);
} while (ret == 1);
mutt_window_clearline(MuttMessageWindow, 0);
mutt_enter_state_free(&es);
return ret;
}
开发者ID:darnir,项目名称:neomutt,代码行数:43,代码来源:curs_lib.c
示例7: tty_change_screen_size
void
tty_change_screen_size (void)
{
#if defined(TIOCGWINSZ) && NCURSES_VERSION_MAJOR >= 4
struct winsize winsz;
winsz.ws_col = winsz.ws_row = 0;
#ifndef NCURSES_VERSION
tty_noraw_mode ();
tty_reset_screen ();
#endif
/* Ioctl on the STDIN_FILENO */
ioctl (fileno (stdout), TIOCGWINSZ, &winsz);
if (winsz.ws_col != 0 && winsz.ws_row != 0)
{
#if defined(NCURSES_VERSION) && defined(HAVE_RESIZETERM)
resizeterm (winsz.ws_row, winsz.ws_col);
clearok (stdscr, TRUE); /* sigwinch's should use a semaphore! */
#else
COLS = winsz.ws_col;
LINES = winsz.ws_row;
#endif
}
#endif /* defined(TIOCGWINSZ) || NCURSES_VERSION_MAJOR >= 4 */
#ifdef ENABLE_SUBSHELL
if (mc_global.tty.use_subshell)
tty_resize (mc_global.tty.subshell_pty);
#endif
}
开发者ID:LubkaB,项目名称:mc,代码行数:32,代码来源:tty-ncurses.c
示例8: tstp
void
tstp(int ignored)
{
int y, x;
int oy, ox;
NOOP(ignored);
/*
* leave nicely
*/
getyx(curscr, oy, ox);
mvcur(0, COLS - 1, LINES - 1, 0);
endwin();
resetltchars();
fflush(stdout);
md_tstpsignal();
/*
* start back up again
*/
md_tstpresume();
raw();
noecho();
keypad(stdscr,1);
playltchars();
clearok(curscr, TRUE);
wrefresh(curscr);
getyx(curscr, y, x);
mvcur(y, x, oy, ox);
fflush(stdout);
curscr->_cury = oy;
curscr->_curx = ox;
}
开发者ID:RoguelikeRestorationProject,项目名称:rogue5.4,代码行数:34,代码来源:main.c
示例9: shell
void
shell(void)
{
/*
* Set the terminal back to original mode
*/
move(LINES-1, 0);
refresh();
endwin();
resetltchars();
putchar('\n');
in_shell = TRUE;
after = FALSE;
fflush(stdout);
/*
* Fork and do a shell
*/
md_shellescape();
noecho();
raw();
keypad(stdscr,1);
playltchars();
in_shell = FALSE;
clearok(stdscr, TRUE);
}
开发者ID:RoguelikeRestorationProject,项目名称:rogue5.4,代码行数:26,代码来源:main.c
示例10: cl_refresh
/*
* cl_refresh --
* Refresh the screen.
*
* PUBLIC: int cl_refresh __P((SCR *, int));
*/
int
cl_refresh(SCR *sp, int repaint)
{
CL_PRIVATE *clp;
WINDOW *win;
SCR *psp, *tsp;
size_t y, x;
clp = CLP(sp);
win = CLSP(sp) ? CLSP(sp) : stdscr;
/*
* If we received a killer signal, we're done, there's no point
* in refreshing the screen.
*/
if (clp->killersig)
return (0);
/*
* If repaint is set, the editor is telling us that we don't know
* what's on the screen, so we have to repaint from scratch.
*
* If repaint set or the screen layout changed, we need to redraw
* any lines separating vertically split screens. If the horizontal
* offsets are the same, then the split was vertical, and need to
* draw a dividing line.
*/
if (repaint || F_ISSET(clp, CL_LAYOUT)) {
getyx(stdscr, y, x);
for (psp = sp; psp != NULL; psp = TAILQ_NEXT(psp, q))
for (tsp = TAILQ_NEXT(psp, q); tsp != NULL;
tsp = TAILQ_NEXT(tsp, q))
if (psp->roff == tsp->roff) {
if (psp->coff + psp->cols + 1 == tsp->coff)
cl_rdiv(psp);
else
if (tsp->coff + tsp->cols + 1 == psp->coff)
cl_rdiv(tsp);
}
(void)wmove(stdscr, y, x);
F_CLR(clp, CL_LAYOUT);
}
/*
* In the curses library, doing wrefresh(curscr) is okay, but the
* screen flashes when we then apply the refresh() to bring it up
* to date. So, use clearok().
*/
if (repaint)
clearok(curscr, 1);
/*
* Only do an actual refresh, when this is the focus window,
* i.e. the one holding the cursor. This assumes that refresh
* is called for that window after refreshing the others.
* This prevents the cursor being drawn in the other windows.
*/
return (wnoutrefresh(stdscr) == ERR ||
wnoutrefresh(win) == ERR ||
(sp == clp->focus && doupdate() == ERR));
}
开发者ID:Hooman3,项目名称:minix,代码行数:66,代码来源:cl_funcs.c
示例11: curses_runio
/* Update the display and wait for an input event.
*/
int curses_runio(int *control)
{
int ch, i;
for (;;) {
render();
ch = tolower(getch());
switch (ch) {
case '\r':
case '\n':
case KEY_ENTER:
*control = ctl_button;
return 1;
case KEY_MOUSE:
if (getmouseevent(control))
return 1;
break;
case '?':
case KEY_F(1):
if (!runhelp())
return 0;
break;
case '\022':
if (!runruleshelp())
return 0;
break;
case '\026':
if (!runlicensedisplay())
return 0;
break;
case '\001':
changediechars(+1);
break;
case '\f':
clearok(stdscr, TRUE);
break;
case KEY_RESIZE:
initlayout();
break;
case '\003':
case '\030':
return 0;
case 'q':
case '\033':
if (controls[ctl_button].value == bval_newgame)
return 0;
break;
case ERR:
exit(1);
default:
for (i = 0 ; i < ctl_count ; ++i) {
if (controls[i].key == ch) {
*control = i;
return 1;
}
}
}
}
}
开发者ID:BR903,项目名称:yahtzee,代码行数:61,代码来源:iocurses.c
示例12: onresize
/* Signal handler for SIGWINCH.
*/
static void onresize(int sig)
{
if (sig == SIGWINCH) {
endwin();
clearok(stdscr, TRUE);
refresh();
}
}
开发者ID:BR903,项目名称:boggle,代码行数:10,代码来源:output.c
示例13: redraw_all
void redraw_all (void)
{
int min_lines = TITLE_WIN_LINES+SHOW_WIN_LINES+COMMAND_WIN_LINES+3;
struct winsize ws;
int save_col, save_lines;
/* get the size of the terminal connected to stdout */
ioctl(1, TIOCGWINSZ, &ws);
/*
* Do it again because GDB doesn't stop before the first ioctl
* call, we want an up-to-date size when we're
* single-stepping.
*/
if (ioctl(1, TIOCGWINSZ, &ws) == 0) {
if (ws.ws_row < min_lines)
ws.ws_row = min_lines;
if ((ws.ws_row != LINES) || (ws.ws_col != COLS)) {
wmove (show_win,2,COLS-18);
wclrtoeol(show_win);
wrefresh(show_win);
resizeterm(ws.ws_row, ws.ws_col);
wresize(title_win, TITLE_WIN_LINES,COLS);
wresize(show_win, SHOW_WIN_LINES,COLS);
wresize(command_win, COMMAND_WIN_LINES,COLS);
wresize(mt_win1, 1,COLS);
wresize(mt_win2, 1,COLS);
mvwin(mt_win2, LINES-COMMAND_WIN_LINES-1,0);
mvwin(command_win, LINES-COMMAND_WIN_LINES,0);
draw_title_win();
show_pad_info.display_lines=LINES-TITLE_WIN_LINES-SHOW_WIN_LINES-COMMAND_WIN_LINES-2;
show_pad_info.display_cols=COLS;
}
}
clearok(title_win, 1);
clearok(show_win, 1);
clearok(command_win, 1);
clearok(mt_win1, 1);
clearok(mt_win2, 1);
wrefresh(mt_win1);
wrefresh(mt_win2);
refresh_show_pad();
refresh_show_win();
refresh_title_win ();
refresh_command_win ();
}
开发者ID:0-kaladin,项目名称:external_e2fsprogs,代码行数:45,代码来源:win.c
示例14: cont_catcher
static void cont_catcher(int signo UNUSED)
{
noecho();
raw();
clearok(stdscr, 1);
move(crow, ccol);
refresh();
starttime();
}
开发者ID:kleopatra999,项目名称:bsd-games-3,代码行数:9,代码来源:mach.c
示例15: n_shell
void
n_shell()
{
WINDOW *sh_win, *newwin();
SIG_TYPE (*istat)(), (*qstat)();
int sig_status, spid, w;
char *shell, *shellpath, *getenv(), *strrchr();
unsigned int sleep();
void _exit();
/* a full window */
sh_win = newwin(LINES, COLS, 0, 0);
touchwin(sh_win);
waddstr(sh_win, "Pcomm <=> Unix gateway, use ^D or 'exit' to return\n");
wrefresh(sh_win);
/* out of curses mode */
resetterm();
shellpath = getenv("SHELL");
if (shellpath == NULL || *shellpath == '\0')
shellpath = "/bin/sh";
if (shell = strrchr(shellpath, '/'))
shell++;
else {
shellpath = "/bin/sh";
shell = "sh";
}
if (!(spid = fork())) {
signal(SIGINT, SIG_DFL);
signal(SIGQUIT, SIG_DFL);
#ifdef SETUGID
setgid(getgid());
setuid(getuid());
#endif /* SETUGID */
execl(shellpath, shell, "-i", (char *) 0);
_exit(1);
}
istat = signal(SIGINT, SIG_IGN);
qstat = signal(SIGQUIT, SIG_IGN);
while ((w = wait(&sig_status)) != spid && w != -1)
;
signal(SIGINT, istat);
signal(SIGQUIT, qstat);
/* back to curses mode */
sleep(1);
fixterm();
clearok(curscr, TRUE);
werase(sh_win);
wrefresh(sh_win);
delwin(sh_win);
return;
}
开发者ID:LambdaCalculus379,项目名称:SLS-1.02,代码行数:57,代码来源:n_shell.c
示例16: getword
// Get a valid word and put it in the buffer
void getword(char *q)
{
int ch, col, done, i, row;
char *p;
done = 0;
i = 0;
p = q;
addch('[');
refresh();
while (!done && i < MAXWORDLEN - 1) {
ch = getch() & 0177;
switch (ch) {
case '\177': // <del>
case '\010': // <bs>
if (p == q)
break;
p--;
getyx(stdscr, row, col);
move(row, col - 1);
clrtoeol();
break;
case '\025': // <^u>
case '\027': // <^w>
if (p == q)
break;
getyx(stdscr, row, col);
move(row, col - (int) (p - q));
p = q;
clrtoeol();
break;
case ' ':
case '\n':
case '\r':
done = 1;
break;
case '\014': // <^l>
case '\022': // <^r>
clearok(stdscr, 1);
refresh();
break;
default:
if (islower(ch)) {
*p++ = ch;
addch(ch);
i++;
}
break;
}
refresh();
}
*p = '\0';
addch(']');
refresh();
}
开发者ID:kleopatra999,项目名称:bsd-games-3,代码行数:56,代码来源:mach.c
示例17: restore
int
restore(char *file)
{
FILE *infd;
char *sp;
if (strcmp(file, "-r") == 0)
file = file_name;
if ((infd = fopen(file, "r")) == NULL)
{
perror(file);
return(FALSE);
}
if ( restore_file(infd) == FALSE )
return(FALSE);
/*
* we do not close the file so that we will have a hold of the inode
* for as long as possible
*/
if (remove(file) < 0)
{
printf("Cannot unlink file\n");
return(FALSE);
}
if ((sp = getenv("OPTIONS")) != NULL)
parse_opts(sp);
strcpy(file_name, file);
clearok(cw, TRUE);
touchwin(cw);
noecho();
nonl();
while(playing)
{
do_daemons(BEFORE);
do_fuses(BEFORE);
command(); /* Command execution */
if (after)
do_after_effects();
}
fatal("");
return(FALSE);
}
开发者ID:RoguelikeRestorationProject,项目名称:urogue,代码行数:54,代码来源:save.c
示例18: mutt_edit_file
void mutt_edit_file (const char *editor, const char *data)
{
char cmd[LONG_STRING];
endwin ();
mutt_expand_file_fmt (cmd, sizeof (cmd), editor, data);
if (mutt_system (cmd) == -1)
mutt_error (_("Error running \"%s\"!"), cmd);
keypad (stdscr, TRUE);
clearok (stdscr, TRUE);
}
开发者ID:kbraga111,项目名称:muttassign6-ed.purp.only-,代码行数:11,代码来源:curs_lib.c
示例19: show_win
void
show_win(WINDOW *scr, char *message)
{
mvwaddstr(scr, 0, 0, message);
touchwin(scr);
wmove(scr, hero.y, hero.x);
wrefresh(scr);
wait_for(' ');
clearok(cw, TRUE);
touchwin(cw);
}
开发者ID:RoguelikeRestorationProject,项目名称:urogue,代码行数:11,代码来源:io.c
示例20: ARGS1
PRIVATE void terminate_message ARGS1(int,sig)
{
term_message=TRUE;
#ifdef VMS
/* Reassert the AST */
signal(SIGINT, terminate_message);
/* Refresh the screen to get rid of the "interrupt" message */
clearok(curscr, TRUE);
refresh();
#endif /* VMS */
}
开发者ID:unusual-thoughts,项目名称:freebsd-1.x-ports,代码行数:11,代码来源:LYNews.c
注:本文中的clearok函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论