TheGNUGeneralPublicLicenseisoftenshippedwithGNUsoftware,and isgenerallykeptinafilecalledCOPYINGorLICENSE.Ifyoudonot haveacopyofthelicense,writetotheFreeSoftwareFoundation,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA. */ #define READLINE_LIBRARY
#ifdefined (HAVE_CONFIG_H) # include "config_readline.h" #endif
/* If the calling application sets this to a non-zero value, readline will usethe$LINESand$COLUMNSenvironmentvariablestosetitsideaofthe
window size before interrogating the kernel. */ int rl_prefer_env_winsize = 0;
/* Some strings to control terminal actions. These are output by tputs (). */ constchar *_rl_term_clreol; constchar *_rl_term_clrpag; constchar *_rl_term_cr; constchar *_rl_term_backspace; char _rl_term_backspace_default[2] = { '\b', 0 }; constchar *_rl_term_goto; constchar *_rl_term_pc;
/* Non-zero if we determine that the terminal can do character insertion. */ int _rl_terminal_can_insert = 0;
/* How to insert characters. */ constchar *_rl_term_im; constchar *_rl_term_ei; constchar *_rl_term_ic; constchar *_rl_term_ip; constchar *_rl_term_IC;
/* How to delete characters. */ constchar *_rl_term_dc; constchar *_rl_term_DC;
constchar *_rl_term_forward_char;
/* How to go up a line. */ constchar *_rl_term_up; char _rl_term_up_default[2] = { 0, 0 };
/* A visible bell; char if the terminal can be made to flash the screen. */ staticconstchar *_rl_visible_bell;
/* Non-zero means the terminal can auto-wrap lines. */ int _rl_term_autowrap = -1;
/* Non-zero means that this terminal has a meta key. */ staticint term_has_meta;
/* The sequences to write to turn on and off the meta key, if this
terminal has one. */ staticconstchar *_rl_term_mm; staticconstchar *_rl_term_mo;
/* The key sequences output by the arrow keys, if this terminal has any. */ staticconstchar *_rl_term_ku; staticconstchar *_rl_term_kd; staticconstchar *_rl_term_kr; staticconstchar *_rl_term_kl;
/* How to initialize and reset the arrow keys, if this terminal has any. */ staticconstchar *_rl_term_ks; staticconstchar *_rl_term_ke;
/* The key sequences sent by the Home and End keys, if any. */ staticconstchar *_rl_term_kh; staticconstchar *_rl_term_kH; staticconstchar *_rl_term_at7; /* @7 */
/* Delete key */ staticconstchar *_rl_term_kD;
/* Insert key */ staticconstchar *_rl_term_kI;
/* Cursor control */ staticconstchar *_rl_term_vs; /* very visible */ staticconstchar *_rl_term_ve; /* normal */
/* Get readline's idea of the screen size. TTY is a file descriptor open totheterminal.IfIGNORE_ENVistrue,wedonotpayattentiontothe valuesof$LINESand$COLUMNS.ThetestsforTERM_STRING_BUFFERbeing
non-null serve to check whether or not we have initialized termcap. */ void
_rl_get_screen_size (tty, ignore_env) int tty, ignore_env;
{ char *ss; #ifdefined (TIOCGWINSZ) struct winsize window_size; #endif/* TIOCGWINSZ */ int wr, wc;
/* Environment variable COLUMNS overrides setting of "co" if IGNORE_ENV isunset.Ifweprefertheenvironment,checkitfirstbefore
assigning the value returned by the kernel. */ if (_rl_screenwidth <= 0)
{ if (ignore_env == 0 && (ss = sh_get_env_value ("COLUMNS")))
_rl_screenwidth = atoi (ss);
/* If all else fails, default to 80x24 terminal. */ if (_rl_screenwidth <= 1)
_rl_screenwidth = 80;
if (_rl_screenheight <= 0)
_rl_screenheight = 24;
/* If we're being compiled as part of bash, set the environment variables$LINESand$COLUMNStonewvalues.Otherwise,just
do a pair of putenv () or setenv () calls. */
sh_set_lines_and_columns (_rl_screenheight, _rl_screenwidth);
/* Read the desired terminal capability strings into BP. The capabilities
are described in the TC_STRINGS table. */ staticvoid
get_term_capabilities (bp) char **bp;
{ #if !defined (__DJGPP__) /* XXX - doesn't DJGPP have a termcap library? */ registerunsignedint i;
for (i = 0; i < NUM_TC_STRINGS; i++)
*(tc_strings[i].tc_value) = tgetstr ((char *)tc_strings[i].tc_var, bp); #endif
tcap_initialized = 1;
}
int
_rl_init_terminal_io (terminal_name) constchar *terminal_name;
{ constchar *term; char *buffer; int tty, tgetent_ret;
/* I've separated this out for later work on not calling tgetent at all ifthecallingapplicationhassuppliedacustomredisplayfunction,
(and possibly if the application has supplied a custom input function). */ if (CUSTOM_REDISPLAY_FUNC())
{
tgetent_ret = -1;
} else
{ if (term_string_buffer == 0)
term_string_buffer = (char *)xmalloc(2032);
if (term_buffer == 0)
term_buffer = (char *)xmalloc(4080);
/* Reasonable defaults for tgoto(). Readline currently only uses tgotoif_rl_term_ICor_rl_term_DCisdefined,butjustincasewe
change that later... */
PC = '\0';
_rl_term_backspace = _rl_term_backspace_default;
BC = (char*)_rl_term_backspace;
UP = (char*)_rl_term_up;
return0;
}
get_term_capabilities (&buffer);
/* Set up the variables that the termcap library expects the application
to provide. */
PC = _rl_term_pc ? *_rl_term_pc : 0;
BC = (char*)_rl_term_backspace;
UP = (char*)_rl_term_up;
/* Allow calling application to set default height and width, using
rl_set_screen_size */ if (_rl_screenwidth <= 0 || _rl_screenheight <= 0)
_rl_get_screen_size (tty, 0);
/* "An application program can assume that the terminal can do characterinsertionif*anyoneof*thecapabilities`IC', `im',`ic'or`ip'isprovided."Butwecan'tdoanythingif
only `ip' is provided, so... */
_rl_terminal_can_insert = (_rl_term_IC || _rl_term_im || _rl_term_ic);
/* Check to see if this terminal has a meta key and clear the capability
variables if there is none. */
term_has_meta = (tgetflag ((char *)"km") || tgetflag ((char *)"MT")); if (!term_has_meta)
_rl_term_mm = _rl_term_mo = (char *)NULL;
/* Attempt to find and bind the arrow keys. Do not override already
bound keys in an overzealous attempt, however. */
if (tcap_initialized == 0) return ((char *)NULL); for (i = 0; i < NUM_TC_STRINGS; i++)
{ if (tc_strings[i].tc_var[0] == cap[0] && strcmp (tc_strings[i].tc_var, cap) == 0) return *(tc_strings[i].tc_value);
} return ((char *)NULL);
}
/* Re-initialize the terminal considering that the TERM/TERMCAP variable
has changed. */ int
rl_reset_terminal (terminal_name) constchar *terminal_name;
{
_rl_screenwidth = _rl_screenheight = 0;
_rl_init_terminal_io (terminal_name); return0;
}
/* A function for the use of tputs () */ #ifdef _MINIX void
_rl_output_character_function (c) int c;
{
putc (c, _rl_out_stream);
} #else/* !_MINIX */ int
_rl_output_character_function (c) int c;
{ return putc (c, _rl_out_stream);
} #endif/* !_MINIX */
/* Write COUNT characters from STRING to the output stream. */ void
_rl_output_some_chars (string, count) constchar *string; int count;
{ if (fwrite (string, 1, count, _rl_out_stream) != (size_t)count)
fprintf(stderr, "Write failed\n");
}
/* Move the cursor back. */ int
_rl_backspace (count) int count;
{ registerint i;
if (_rl_term_backspace) for (i = 0; i < count; i++)
tputs (_rl_term_backspace, 1, _rl_output_character_function); else for (i = 0; i < count; i++)
putc ('\b', _rl_out_stream); return0;
}
/* Move to the start of the next line. */ int
rl_crlf ()
{ #ifdefined (NEW_TTY_DRIVER) if (_rl_term_cr)
tputs (_rl_term_cr, 1, _rl_output_character_function); #endif/* NEW_TTY_DRIVER */
putc ('\n', _rl_out_stream); return0;
}
/* Ring the terminal bell. */ int
rl_ding ()
{ if (readline_echoing_p)
{ switch (_rl_bell_preference)
{ case NO_BELL: default: break; case VISIBLE_BELL: if (_rl_visible_bell)
{
tputs (_rl_visible_bell, 1, _rl_output_character_function); break;
} /* FALLTHROUGH */ case AUDIBLE_BELL:
fprintf (stderr, "\007");
fflush (stderr); break;
} return (0);
} return (-1);
}
/* **************************************************************** */ /* */ /* Controlling the Meta Key and Keypad */ /* */ /* **************************************************************** */
/* Set the cursor appropriately depending on IM, which is one of the insertmodes(insertoroverwrite).Insertmodegetsthenormal cursor.Overwritemodegetsaveryvisiblecursor.Onlydoes
anything if we have both capabilities. */ void
_rl_set_cursor (im, force) int im, force;
{ if (_rl_term_ve && _rl_term_vs)
{ if (force || im != rl_insert_mode)
{ if (im == RL_IM_OVERWRITE)
tputs (_rl_term_vs, 1, _rl_output_character_function); else
tputs (_rl_term_ve, 1, _rl_output_character_function);
}
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.13 Sekunden
(vorverarbeitet am 2026-10-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.