这篇教程C++ tty_reset函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中tty_reset函数的典型用法代码示例。如果您正苦于以下问题:C++ tty_reset函数的具体用法?C++ tty_reset怎么用?C++ tty_reset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了tty_reset函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: tty_cmd_clearstartofscreenvoidtty_cmd_clearstartofscreen(struct tty *tty, const struct tty_ctx *ctx){ struct window_pane *wp = ctx->wp; struct screen *s = wp->screen; u_int i, j; tty_reset(tty); tty_region_pane(tty, ctx, 0, screen_size_y(s) - 1); tty_cursor_pane(tty, ctx, 0, 0); if (ctx->xoff == 0 && screen_size_x(s) >= tty->sx && tty_term_has(tty->term, TTYC_EL)) { for (i = 0; i < ctx->ocy; i++) { tty_putcode(tty, TTYC_EL); tty_emulate_repeat(tty, TTYC_CUD, TTYC_CUD1, 1); tty->cy++; } } else { for (j = 0; j < ctx->ocy; j++) { tty_cursor_pane(tty, ctx, 0, j); for (i = 0; i < screen_size_x(s); i++) tty_putc(tty, ' '); } } for (i = 0; i <= ctx->ocx; i++) tty_putc(tty, ' ');}
开发者ID:bholt,项目名称:tmux,代码行数:29,
示例2: mp3anywhere_initint mp3anywhere_init(void){ signal_length=hw.code_length*1000000/9600; if(!tty_create_lock(hw.device)) { logprintf(LOG_ERR,"could not create lock files"); return(0); } if((hw.fd=open(hw.device,O_RDWR|O_NONBLOCK|O_NOCTTY))<0) { logprintf(LOG_ERR,"could not open %s",hw.device); logperror(LOG_ERR,"mp3anywhere_init()"); tty_delete_lock(); return(0); } if(!tty_reset(hw.fd)) { logprintf(LOG_ERR,"could not reset tty"); mp3anywhere_deinit(); return(0); } if(!tty_setbaud(hw.fd,9600)) { logprintf(LOG_ERR,"could not set baud rate"); mp3anywhere_deinit(); return(0); } return(1);}
开发者ID:fullstory-morgue,项目名称:lirc,代码行数:30,
示例3: tty_cmd_linefeedvoidtty_cmd_linefeed(struct tty *tty, const struct tty_ctx *ctx){ struct window_pane *wp = ctx->wp; struct screen *s = wp->screen; if (ctx->ocy != ctx->orlower) return; if (ctx->xoff != 0 || screen_size_x(s) < tty->sx || !tty_term_has(tty->term, TTYC_CSR)) { tty_redraw_region(tty, ctx); return; } /* * If this line wrapped naturally (ctx->num is nonzero), don't do * anything - the cursor can just be moved to the last cell and wrap * naturally. */ if (ctx->num && !(tty->term->flags & TERM_EARLYWRAP)) return; tty_reset(tty); tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower); tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); tty_putc(tty, '/n');}
开发者ID:bholt,项目名称:tmux,代码行数:30,
示例4: tty_cmd_insertcharactervoidtty_cmd_insertcharacter(struct tty *tty, const struct tty_ctx *ctx){ struct window_pane *wp = ctx->wp; struct screen *s = wp->screen; u_int i; if (ctx->xoff != 0 || screen_size_x(s) < tty->sx) { tty_draw_line(tty, wp->screen, ctx->ocy, ctx->xoff, ctx->yoff); return; } tty_reset(tty); tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); if (tty_term_has(tty->term, TTYC_ICH) || tty_term_has(tty->term, TTYC_ICH1)) tty_emulate_repeat(tty, TTYC_ICH, TTYC_ICH1, ctx->num); else if (tty_term_has(tty->term, TTYC_SMIR) && tty_term_has(tty->term, TTYC_RMIR)) { tty_putcode(tty, TTYC_SMIR); for (i = 0; i < ctx->num; i++) tty_putc(tty, ' '); tty_putcode(tty, TTYC_RMIR); } else tty_draw_line(tty, wp->screen, ctx->ocy, ctx->xoff, ctx->yoff);}
开发者ID:bholt,项目名称:tmux,代码行数:28,
示例5: bye_kids/*** bye_kids(exit-condition)**** Shutdown the terminal, clear the signals, and exit*/voidbye_kids(int n){ /* reset the tty and exit */ ignoresig(); if (send_reset_init) { if (exit_ca_mode) { tc_putp(exit_ca_mode); } if (initial_stty_query(TTY_XON_XOFF)) { if (enter_xon_mode) { tc_putp(enter_xon_mode); } } else if (exit_xon_mode) { tc_putp(exit_xon_mode); } } if (debug_fp) { fclose(debug_fp); } if (log_fp) { fclose(log_fp); } tty_reset(); fclose(stdin); fclose(stdout); fclose(stderr); if (not_a_tty) sleep(1); ExitProgram(n);}
开发者ID:SamB,项目名称:debian-tack,代码行数:35,
示例6: tty_attributesvoidtty_attributes(struct tty *tty, const struct grid_cell *gc){ struct grid_cell *tc = &tty->cell; u_char changed; u_int fg, bg; /* If any bits are being cleared, reset everything. */ if (tc->attr & ~gc->attr) tty_reset(tty); /* Filter out attribute bits already set. */ changed = gc->attr & ~tc->attr; tc->attr = gc->attr; /* Set the attributes. */ fg = gc->fg; bg = gc->bg; if (changed & GRID_ATTR_BRIGHT) tty_putcode(tty, TTYC_BOLD); if (changed & GRID_ATTR_DIM) tty_putcode(tty, TTYC_DIM); if (changed & GRID_ATTR_ITALICS) tty_putcode(tty, TTYC_SMSO); if (changed & GRID_ATTR_UNDERSCORE) tty_putcode(tty, TTYC_SMUL); if (changed & GRID_ATTR_BLINK) tty_putcode(tty, TTYC_BLINK); if (changed & GRID_ATTR_REVERSE) { if (tty_term_has(tty->term, TTYC_REV)) tty_putcode(tty, TTYC_REV); else if (tty_term_has(tty->term, TTYC_SMSO)) tty_putcode(tty, TTYC_SMSO); } if (changed & GRID_ATTR_HIDDEN) tty_putcode(tty, TTYC_INVIS); if (changed & GRID_ATTR_CHARSET) tty_putcode(tty, TTYC_SMACS); /* Set foreground colour. */ if (fg != tc->fg || (gc->flags & GRID_FLAG_FG256) != (tc->flags & GRID_FLAG_FG256)) { tty_attributes_fg(tty, gc); tc->fg = fg; tc->flags &= ~GRID_FLAG_FG256; tc->flags |= gc->flags & GRID_FLAG_FG256; } /* Set background colour. */ if (bg != tc->bg || (gc->flags & GRID_FLAG_BG256) != (tc->flags & GRID_FLAG_BG256)) { tty_attributes_bg(tty, gc); tc->bg = bg; tc->flags &= ~GRID_FLAG_BG256; tc->flags |= gc->flags & GRID_FLAG_BG256; }}
开发者ID:ThomasAdam,项目名称:tmux-ARCHIVED,代码行数:57,
示例7: check_tiraint check_tira(void){ logprintf(LOG_ERR, "Searching for Tira"); if(!tty_reset(hw.fd) || !tty_setbaud(hw.fd, 9600) || !tty_setrtscts(hw.fd, 1)) return 0; usleep (50000); return tira_setup();}
开发者ID:zenwheel,项目名称:lirc,代码行数:11,
示例8: suspendstatic SIGRETTYPE suspend(int sig) { tty_reset(tty_fd); sys_sigset(sig, SIG_DFL); /* Set signal handler to default */ sys_sigrelease(sig); /* Allow 'sig' to come through */ kill(getpid(), sig); /* Send ourselves the signal */ sys_sigblock(sig); /* Reset to old mask */ sys_sigset(sig, suspend); /* Reset signal handler */ tty_set(tty_fd);}
开发者ID:toxicgumbo,项目名称:m1,代码行数:12,
示例9: ctl_cstatic SIGRETTYPE ctl_c(int sig){ tty_reset(tty_fd); sys_sigset(sig, orig_ctl_c); /* Set ctl_c break handler to original */ sys_sigrelease(sig); /* Allow 'sig' to come through */ kill(getpid(), sig); /* Send ourselves the signal */ sys_sigblock(sig); /* Reset to old mask */ sys_sigset(sig, ctl_c); /* Reset signal handler */ tty_set(tty_fd);}
开发者ID:toxicgumbo,项目名称:m1,代码行数:12,
示例10: mainintmain(void){ int i; char c; if (signal(SIGINT, sig_catch) == SIG_ERR) /* catch signals */ err_sys("signal(SIGINT) error"); if (signal(SIGQUIT, sig_catch) == SIG_ERR) err_sys("signal(SIGQUIT) error"); if (signal(SIGTERM, sig_catch) == SIG_ERR) err_sys("signal(SIGTERM) error"); if (tty_raw(STDIN_FILENO) < 0) err_sys("tty_raw error"); printf("Enter raw mode characters, terminate with DELETE/n"); while ((i = read(STDIN_FILENO, &c, 1)) == 1) { if ((c &= 255) == 0177) /* 0177 = ASCII DELETE */ break; printf("%o/n", c); } if (tty_reset(STDIN_FILENO) < 0) err_sys("tty_reset error"); if (i <= 0) err_sys("read error"); if (tty_cbreak(STDIN_FILENO) < 0) err_sys("tty_cbreak error"); printf("/nEnter cbreak mode characters, terminate with SIGINT/n"); while ((i = read(STDIN_FILENO, &c, 1)) == 1) { c &= 255; printf("%o/n", c); } if (tty_reset(STDIN_FILENO) < 0) err_sys("tty_reset error"); if (i <= 0) err_sys("read error"); exit(0);}
开发者ID:4get,项目名称:apue.2e,代码行数:39,
示例11: tty_cmd_clearstartoflinevoidtty_cmd_clearstartofline(struct tty *tty, const struct tty_ctx *ctx){ tty_reset(tty); if (ctx->xoff == 0 && tty_term_has(tty->term, TTYC_EL1)) { tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); tty_putcode(tty, TTYC_EL1); } else { tty_cursor_pane(tty, ctx, 0, ctx->ocy); tty_repeat_space(tty, ctx->ocx + 1); }}
开发者ID:UNGLinux,项目名称:Obase,代码行数:13,
示例12: tty_destroyvoidtty_destroy(struct tty *tty){ if (tty->input_source) wl_event_source_remove(tty->input_source); wl_event_source_remove(tty->vt_source); tty_reset(tty); close(tty->fd); free(tty);}
开发者ID:anderco,项目名称:weston,代码行数:14,
示例13: mainint main(int argc, char *argv[]){ atexit(tty_atexit); int i; char c; Signal(SIGINT, sig_catch); Signal(SIGQUIT, sig_catch); Signal(SIGTERM, sig_catch); if(tty_raw(STDIN_FILENO) < 0) err_sys("tty_raw error"); printf("Enter raw mode characters, terminate with DELETE/n"); while ((i = read(STDIN_FILENO, &c, 1)) == 1) { if((c &= 255) == 0177) /* 0177 = ASCII DELETE*/ break; printf("%o/n", c ); } if(tty_reset(STDIN_FILENO) < 0) err_sys("tty_reset error"); if(i <= 0) err_sys("read error"); if(tty_cbreak(STDIN_FILENO) < 0) err_sys("tty_raw error"); printf("/n Enter cbreak mode characters, terminate with SIGINT/n"); while ( (i = read(STDIN_FILENO, &c, 1)) == 1) { c &= 255; printf("%o/n", c); } tty_reset(STDIN_FILENO); if( i < 0) err_sys("read error");; return 0;}
开发者ID:jack-lijing,项目名称:unix,代码行数:37,
示例14: tty_cmd_clearendoflinevoidtty_cmd_clearendofline(struct tty *tty, const struct tty_ctx *ctx){ struct window_pane *wp = ctx->wp; struct screen *s = wp->screen; tty_reset(tty); tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); if (tty_pane_full_width(tty, ctx) && tty_term_has(tty->term, TTYC_EL)) tty_putcode(tty, TTYC_EL); else tty_repeat_space(tty, screen_size_x(s) - ctx->ocx);}
开发者ID:UNGLinux,项目名称:Obase,代码行数:15,
示例15: tty_cmd_clearstartoflinevoidtty_cmd_clearstartofline(struct tty *tty, const struct tty_ctx *ctx){ u_int i; tty_reset(tty); if (ctx->xoff == 0 && tty_term_has(tty->term, TTYC_EL1)) { tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); tty_putcode(tty, TTYC_EL1); } else { tty_cursor_pane(tty, ctx, 0, ctx->ocy); for (i = 0; i < ctx->ocx + 1; i++) tty_putc(tty, ' '); }}
开发者ID:bholt,项目名称:tmux,代码行数:16,
示例16: tty_cmd_alignmenttestvoidtty_cmd_alignmenttest( struct tty *tty, struct window_pane *wp, unused va_list ap){ struct screen *s = wp->screen; u_int i, j; tty_reset(tty); tty_region(tty, 0, screen_size_y(s) - 1, wp->yoff); for (j = 0; j < screen_size_y(s); j++) { tty_cursor(tty, 0, j, wp->xoff, wp->yoff); for (i = 0; i < screen_size_x(s); i++) tty_putc(tty, 'E'); }}
开发者ID:ThomasAdam,项目名称:tmux-ARCHIVED,代码行数:17,
示例17: tty_cmd_deletelinevoidtty_cmd_deleteline(struct tty *tty, const struct tty_ctx *ctx){ if (!tty_pane_full_width(tty, ctx) || !tty_term_has(tty->term, TTYC_CSR) || !tty_term_has(tty->term, TTYC_DL1)) { tty_redraw_region(tty, ctx); return; } tty_reset(tty); tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower); tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); tty_emulate_repeat(tty, TTYC_DL, TTYC_DL1, ctx->num);}
开发者ID:UNGLinux,项目名称:Obase,代码行数:17,
示例18: tty_rawstatic void *watch_tty(struct watch_tty_data *wtd){ struct tcp_spec ts; char buf[256]; int nr; if (wtd->input_mode == INPUT_MODE_RAW) tty_raw(0, 1, 0); while ((nr = read(0, buf, sizeof(buf)))) { if (buf[0] == 29) /* ^] */ break; if (wtd->input_mode == INPUT_MODE_LINEECHO || wtd->input_mode == INPUT_MODE_LINEECHOR) { if (nr >= 3 && buf[0] == '^' && buf[1] == ']' && buf[2] == '/n') break; if (wtd->input_mode == INPUT_MODE_LINEECHOR && nr < sizeof(buf) && buf[nr - 1] == '/n') { buf[nr - 1] = '/r'; buf[nr++] = '/n'; } } memset(&ts, 0, sizeof(ts)); ts.saddr = wtd->ci->src_addr; ts.daddr = wtd->ci->dst_addr; ts.sport = wtd->ci->src_port; ts.dport = wtd->ci->dst_port; ts.src_mac = wtd->src_fake_mac; ts.dst_mac = wtd->ci->dst.src_mac; ts.seq = wtd->ci->dst.next_d_seq; ts.ack_seq = wtd->ci->dst.next_seq; ts.window = wtd->ci->src.window ? wtd->ci->src.window : htons(242); ts.id = htons(ntohs(wtd->ci->src.id) + 1); ts.ack = 1; ts.psh = 1; ts.rst = 0; ts.data = buf; ts.data_len = nr; send_tcp_packet(&ts); } if (wtd->input_mode == INPUT_MODE_RAW) tty_reset(0); list_produce_done(&l_hijack_conn); return NULL;}
开发者ID:jingchunzhang,项目名称:other,代码行数:46,
示例19: tty_cmd_clearlinevoidtty_cmd_clearline(struct tty *tty, struct window_pane *wp, unused va_list ap){ struct screen *s = wp->screen; u_int i; tty_reset(tty); tty_cursor(tty, 0, s->old_cy, wp->xoff, wp->yoff); if (wp->xoff == 0 && screen_size_x(s) >= tty->sx && tty_term_has(tty->term, TTYC_EL)) { tty_putcode(tty, TTYC_EL); } else { for (i = 0; i < screen_size_x(s); i++) tty_putc(tty, ' '); }}
开发者ID:ThomasAdam,项目名称:tmux-ARCHIVED,代码行数:17,
示例20: mainint main(int argc, char **argv){ treak_init(); char c; while(1) { if ( read(STDIN_FILENO, &c, 1) == 1) { std::cout << "Pressed " << c << "/n"; } } tty_reset(STDIN_FILENO); return 0;}
开发者ID:petevieira,项目名称:hubo-misc,代码行数:18,
示例21: tty_cmd_deletecharactervoidtty_cmd_deletecharacter(struct tty *tty, struct window_pane *wp, va_list ap){ struct screen *s = wp->screen; u_int ua; if (wp->xoff != 0 || screen_size_x(s) < tty->sx) { tty_draw_line(tty, wp->screen, s->old_cy, wp->xoff, wp->yoff); return; } ua = va_arg(ap, u_int); tty_reset(tty); tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff); tty_emulate_repeat(tty, TTYC_DCH, TTYC_DCH1, ua);}
开发者ID:ThomasAdam,项目名称:tmux-ARCHIVED,代码行数:18,
示例22: tty_cmd_linefeedvoidtty_cmd_linefeed(struct tty *tty, struct window_pane *wp, unused va_list ap){ struct screen *s = wp->screen; if (wp->xoff != 0 || screen_size_x(s) < tty->sx || !tty_term_has(tty->term, TTYC_CSR)) { tty_redraw_region(tty, wp); return; } tty_reset(tty); tty_region(tty, s->old_rupper, s->old_rlower, wp->yoff); if (s->old_cy == s->old_rlower) { tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff); tty_putc(tty, '/n'); }}
开发者ID:ThomasAdam,项目名称:tmux-ARCHIVED,代码行数:20,
示例23: tty_cmd_reverseindexvoidtty_cmd_reverseindex(struct tty *tty, const struct tty_ctx *ctx){ if (ctx->ocy != ctx->orupper) return; if (!tty_pane_full_width(tty, ctx) || !tty_term_has(tty->term, TTYC_CSR) || !tty_term_has(tty->term, TTYC_RI)) { tty_redraw_region(tty, ctx); return; } tty_reset(tty); tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower); tty_cursor_pane(tty, ctx, ctx->ocx, ctx->orupper); tty_putcode(tty, TTYC_RI);}
开发者ID:UNGLinux,项目名称:Obase,代码行数:20,
示例24: tty_cmd_deletecharactervoidtty_cmd_deletecharacter(struct tty *tty, const struct tty_ctx *ctx){ struct window_pane *wp = ctx->wp; if (!tty_pane_full_width(tty, ctx) || (!tty_term_has(tty->term, TTYC_DCH) && !tty_term_has(tty->term, TTYC_DCH1))) { tty_draw_line(tty, wp->screen, ctx->ocy, ctx->xoff, ctx->yoff); return; } tty_reset(tty); tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); if (tty_term_has(tty->term, TTYC_DCH) || tty_term_has(tty->term, TTYC_DCH1)) tty_emulate_repeat(tty, TTYC_DCH, TTYC_DCH1, ctx->num);}
开发者ID:UNGLinux,项目名称:Obase,代码行数:20,
示例25: tty_cmd_deletelinevoidtty_cmd_deleteline(struct tty *tty, struct window_pane *wp, va_list ap){ struct screen *s = wp->screen; u_int ua; if (wp->xoff != 0 || screen_size_x(s) < tty->sx || !tty_term_has(tty->term, TTYC_CSR)) { tty_redraw_region(tty, wp); return; } ua = va_arg(ap, u_int); tty_reset(tty); tty_region(tty, s->old_rupper, s->old_rlower, wp->yoff); tty_cursor(tty, s->old_cx, s->old_cy, wp->xoff, wp->yoff); tty_emulate_repeat(tty, TTYC_DL, TTYC_DL1, ua);}
开发者ID:ThomasAdam,项目名称:tmux-ARCHIVED,代码行数:21,
示例26: tty_draw_linevoidtty_draw_line(struct tty *tty, struct screen *s, u_int py, u_int ox, u_int oy){ const struct grid_cell *gc; const struct grid_utf8 *gu; u_int i, sx; sx = screen_size_x(s); if (sx > s->grid->size[s->grid->hsize + py]) sx = s->grid->size[s->grid->hsize + py]; if (sx > tty->sx) sx = tty->sx; tty_cursor(tty, 0, py, ox, oy); for (i = 0; i < sx; i++) { gc = grid_view_peek_cell(s->grid, i, py); gu = NULL; if (gc->flags & GRID_FLAG_UTF8) gu = grid_view_peek_utf8(s->grid, i, py); if (screen_check_selection(s, i, py)) { s->sel.cell.data = gc->data; tty_cell(tty, &s->sel.cell, gu); } else tty_cell(tty, gc, gu); } if (sx >= tty->sx) return; tty_reset(tty); tty_cursor(tty, sx, py, ox, oy); if (screen_size_x(s) >= tty->sx && tty_term_has(tty->term, TTYC_EL)) tty_putcode(tty, TTYC_EL); else { for (i = sx; i < screen_size_x(s); i++) tty_putc(tty, ' '); }}
开发者ID:ThomasAdam,项目名称:tmux-ARCHIVED,代码行数:40,
示例27: tty_cmd_linefeedvoidtty_cmd_linefeed(struct tty *tty, const struct tty_ctx *ctx){ struct window_pane *wp = ctx->wp; struct screen *s = wp->screen; if (ctx->ocy != ctx->orlower) return; if (!tty_pane_full_width(tty, ctx) || !tty_term_has(tty->term, TTYC_CSR)) { if (tty_large_region(tty, ctx)) wp->flags |= PANE_REDRAW; else if (tty_use_rect(tty)) { tty_cra_pane (tty, ctx, ctx->orupper + 1, 0, ctx->orlower, screen_size_x(s) - 1, ctx->orupper, 0); tty_cmd_clearline(tty, ctx); } else tty_redraw_region(tty, ctx); return; } /* * If this line wrapped naturally (ctx->num is nonzero), don't do * anything - the cursor can just be moved to the last cell and wrap * naturally. */ if (ctx->num && !(tty->term->flags & TERM_EARLYWRAP)) return; tty_reset(tty); tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower); tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy); tty_putc(tty, '/n');}
开发者ID:UNGLinux,项目名称:Obase,代码行数:38,
注:本文中的tty_reset函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ tty_set_operations函数代码示例 C++ tty_register_ldisc函数代码示例 |