int def_prog_mode(void) { T((T_CALLED("def_prog_mode()"))); if (_nc_get_curterm(&cur_term->Nttyb) != OK) returnCode(ERR); #ifdef TERMIOS cur_term->Nttyb.c_oflag &= ~tabs; #else cur_term->Nttyb.sg_flags &= ~XTABS; #endif returnCode(OK); }
int def_shell_mode(void) { T((T_CALLED("def_shell_mode()"))); /* * Turn off the XTABS bit in the tty structure if it was on. If XTABS * was on, remove the tab and backtab capabilities. */ if (_nc_get_curterm(&cur_term->Ottyb) != OK) returnCode(ERR); #ifdef TERMIOS if (cur_term->Ottyb.c_oflag & tabs) tab = back_tab = NULL; #else if (cur_term->Ottyb.sg_flags & XTABS) tab = back_tab = NULL; #endif returnCode(OK); }
/* ** curses_setup(exec_name) ** ** Startup ncurses */ void curses_setup( char *exec_name) { int status; static TERMTYPE term; char tty_filename[2048]; tty_init(); /** See if the terminal is in the terminfo data base. This call has two useful benefits, 1) it returns the filename of the terminfo entry, and 2) it searches only terminfo's. This allows us to abort before ncurses starts scanning the termcap file. **/ if ((status = _nc_read_entry(tty_basename, tty_filename, &term)) == 0) { const TERMTYPE *fallback = _nc_fallback(tty_basename); if (fallback) { term = *fallback; sprintf(tty_filename, "(fallback)%s", tty_basename); status = 1; } else { fprintf(stderr, "Terminal not found: TERM=%s\n", tty_basename); show_usage(exec_name); exit(1); } } if (status == -1) { fprintf(stderr, "Terminfo database is inaccessible\n"); exit(1); } /** This call will load the terminfo data base and set the cur-term variable. Only terminals that actually exist will get here so its OK to ignore errors. This is a good thing since ncurses does not permit (os) or (gn) to be set. **/ setupterm(tty_basename, 1, &status); /** Get the current terminal definitions. This must be done before getting the baudrate. **/ _nc_get_curterm(&cur_term->Nttyb); tty_baud_rate = baudrate(); tty_cps = (tty_baud_rate << 1) / tty_frame_size; /* set up the defaults */ replace_mode = TRUE; scan_mode = 0; char_count = 0; select_delay_type = debug_level = 0; char_mask = (meta_on && meta_on[0] == '\0') ? ALLOW_PARITY : STRIP_PARITY; /* Don't change the XON/XOFF modes yet. */ select_xon_xoff = initial_stty_query(TTY_XON_XOFF) ? 1 : needs_xon_xoff; fflush(stdout); /* flush any output */ tty_set(); go_home(); /* set can_go_home */ put_clear(); /* set can_clear_screen */ if (send_reset_init) { reset_init(); } /* I assume that the reset and init strings may not have the correct pads. (Because that part of the test comes much later.) Because of this, I allow the terminal some time to catch up. */ fflush(stdout); /* waste some time */ sleep(1); /* waste more time */ charset_can_test(); can_test("lines cols cr nxon rf if iprog rmp smcup rmcup", FLAG_CAN_TEST); edit_init(); /* initialize the edit data base */ if (send_reset_init && enter_ca_mode) { tc_putp(enter_ca_mode); put_clear(); /* just in case we switched pages */ } put_crlf(); ptext("Using terminfo from: "); ptextln(tty_filename); put_crlf(); if (tty_can_sync == SYNC_NEEDED) { verify_time(); } display_basic(); }