xref: /openbsd/bin/ksh/edit.h (revision abe76290)
1 /*	$OpenBSD: edit.h,v 1.13 2023/06/21 22:22:08 millert Exp $	*/
2 
3 /* NAME:
4  *      edit.h - globals for edit modes
5  *
6  * DESCRIPTION:
7  *      This header defines various global edit objects.
8  *
9  * SEE ALSO:
10  *
11  *
12  * RCSid:
13  *      $From: edit.h,v 1.2 1994/05/19 18:32:40 michael Exp michael $
14  *
15  */
16 
17 #define	BEL		0x07
18 
19 #undef CTRL
20 #define CTRL(x)		((x) == '?' ? 0x7F : (x) & 0x1F)	/* ASCII */
21 #define UNCTRL(x)	((x) == 0x7F ? '?' : (x) | 0x40)	/* ASCII */
22 
23 /* tty driver characters we are interested in */
24 typedef struct {
25 	int erase;
26 	int kill;
27 	int werase;
28 	int intr;
29 	int quit;
30 	int eof;
31 } X_chars;
32 
33 extern X_chars edchars;
34 
35 /* x_cf_glob() flags */
36 #define XCF_COMMAND	BIT(0)	/* Do command completion */
37 #define XCF_FILE	BIT(1)	/* Do file completion */
38 #define XCF_FULLPATH	BIT(2)	/* command completion: store full path */
39 #define XCF_COMMAND_FILE (XCF_COMMAND|XCF_FILE)
40 
41 /* edit.c */
42 int	x_getc(void);
43 void	x_flush(void);
44 int	x_putc(int);
45 void	x_puts(const char *);
46 bool	x_mode(bool);
47 int	promptlen(const char *, const char **);
48 int	x_do_comment(char *, int, int *);
49 void	x_print_expansions(int, char *const *, int);
50 int	x_cf_glob(int, const char *, int, int, int *, int *, char ***, int *);
51 int	x_longest_prefix(int , char *const *);
52 int	x_basename(const char *, const char *);
53 void	x_free_words(int, char **);
54 int	x_escape(const char *, size_t, int (*)(const char *, size_t));
55 /* emacs.c */
56 int	x_emacs(char *, size_t);
57 void	x_init_emacs(void);
58 void	x_emacs_keys(X_chars *);
59 /* vi.c */
60 int	x_vi(char *, size_t);
61