#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
#include <sys/types.h>
#include <termios.h>
#include <signal.h>
#include "fallback.h"
#include "util.h"
#include "wutil.h"
#include "builtin.h"
#include "common.h"
#include "wgetopt.h"
#include "reader.h"
#include "proc.h"
#include "parser.h"
#include "tokenizer.h"
#include "input_common.h"
#include "input.h"
#include "parse_util.h"
Enumerations | |
| enum | { STRING_MODE = 1, JOB_MODE, PROCESS_MODE, TOKEN_MODE } |
| Which part of the comandbuffer are we operating on. More... | |
| enum | { REPLACE_MODE = 1, INSERT_MODE, APPEND_MODE } |
| For text insertion, how should it be done. More... | |
Functions | |
| static wchar_t * | get_buffer () |
| Returns the current commandline buffer. | |
| static int | get_cursor_pos () |
| Returns the position of the cursor. | |
| static void | replace_part (const wchar_t *begin, const wchar_t *end, wchar_t *insert, int append_mode) |
| Replace/append/insert the selection with/at/after the specified string. | |
| static void | write_part (const wchar_t *begin, const wchar_t *end, int cut_at_cursor, int tokenize) |
| Output the specified selection. | |
| static int | builtin_commandline (wchar_t **argv) |
| The commandline builtin. | |
Variables | |
| static wchar_t * | current_buffer = 0 |
| Pointer to what the commandline builtin considers to be the current contents of the command line buffer. | |
| static int | current_cursor_pos = -1 |
| What the commandline builtin considers to be the current cursor position. | |
Functions used for implementing the commandline builtin.
| anonymous enum |
| anonymous enum |
| static int builtin_commandline | ( | wchar_t ** | argv | ) | [static] |
The commandline builtin.
It is used for specifying a new value for the commandline.
References _, APPEND_MODE, buffer::buff, buff, builtin_complete_get_temporary_buffer(), builtin_count_args(), BUILTIN_ERR_COMBO, BUILTIN_ERR_COMBO2, BUILTIN_ERR_MISSING, BUILTIN_ERR_UNKNOWN, builtin_print_help(), builtin_unknown_option(), current_buffer, current_cursor_pos, woption::flag, get_buffer(), get_cursor_pos(), input_function_get_code(), input_unreadch(), INSERT_MODE, is_interactive_session, JOB_MODE, maxi(), mini(), woption::name, no_argument, parse_util_job_extent(), parse_util_lineno(), parse_util_process_extent(), parse_util_token_extent(), PROCESS_MODE, reader_get_buffer(), reader_get_cursor_pos(), reader_search_mode(), reader_set_buffer(), REPLACE_MODE, replace_part(), required_argument, sb_append, sb_destroy(), sb_err, sb_init(), sb_out, sb_printf(), STRING_MODE, TOKEN_MODE, wgetopt_long(), woptarg, woptind, and write_part().
| static void replace_part | ( | const wchar_t * | begin, | |
| const wchar_t * | end, | |||
| wchar_t * | insert, | |||
| int | append_mode | |||
| ) | [static] |
Replace/append/insert the selection with/at/after the specified string.
| begin | beginning of selection | |
| end | end of selection | |
| insert | the string to insert | |
| append_mode | can be one of REPLACE_MODE, INSERT_MODE or APPEND_MODE, affects the way the test update is performed |
References APPEND_MODE, buffer::buff, buff, get_buffer(), get_cursor_pos(), INSERT_MODE, out, reader_set_buffer(), REPLACE_MODE, sb_append, sb_append_substring(), sb_destroy(), and sb_init().
Referenced by builtin_commandline().
| static void write_part | ( | const wchar_t * | begin, | |
| const wchar_t * | end, | |||
| int | cut_at_cursor, | |||
| int | tokenize | |||
| ) | [static] |
Output the specified selection.
| begin | start of selection | |
| end | end of selection | |
| cut_at_cursor | whether printing should stop at the surrent cursor position | |
| tokenize | whether the string should be tokenized, printing one string token on every line and skipping non-string tokens |
References buffer::buff, buff, get_buffer(), get_cursor_pos(), out, sb_append, sb_destroy(), sb_init(), sb_out, tmp, TOK_ACCEPT_UNFINISHED, tok_destroy(), tok_get_pos(), tok_has_next(), tok_init(), tok_last(), tok_last_type(), tok_next(), TOK_STRING, unescape(), and UNESCAPE_INCOMPLETE.
Referenced by builtin_commandline().
1.5.6