xref: /openbsd-src/bin/ksh/edit.h (revision abe762909b634ba7ba5f0581239afbd78014160a)
1*abe76290Smillert /*	$OpenBSD: edit.h,v 1.13 2023/06/21 22:22:08 millert Exp $	*/
27cb960a2Sdownsj 
37cb960a2Sdownsj /* NAME:
47cb960a2Sdownsj  *      edit.h - globals for edit modes
57cb960a2Sdownsj  *
67cb960a2Sdownsj  * DESCRIPTION:
77cb960a2Sdownsj  *      This header defines various global edit objects.
87cb960a2Sdownsj  *
97cb960a2Sdownsj  * SEE ALSO:
107cb960a2Sdownsj  *
117cb960a2Sdownsj  *
127cb960a2Sdownsj  * RCSid:
137cb960a2Sdownsj  *      $From: edit.h,v 1.2 1994/05/19 18:32:40 michael Exp michael $
147cb960a2Sdownsj  *
157cb960a2Sdownsj  */
167cb960a2Sdownsj 
177cb960a2Sdownsj #define	BEL		0x07
187cb960a2Sdownsj 
19*abe76290Smillert #undef CTRL
20*abe76290Smillert #define CTRL(x)		((x) == '?' ? 0x7F : (x) & 0x1F)	/* ASCII */
21*abe76290Smillert #define UNCTRL(x)	((x) == 0x7F ? '?' : (x) | 0x40)	/* ASCII */
22*abe76290Smillert 
237cb960a2Sdownsj /* tty driver characters we are interested in */
247cb960a2Sdownsj typedef struct {
257cb960a2Sdownsj 	int erase;
267cb960a2Sdownsj 	int kill;
277cb960a2Sdownsj 	int werase;
287cb960a2Sdownsj 	int intr;
297cb960a2Sdownsj 	int quit;
307cb960a2Sdownsj 	int eof;
317cb960a2Sdownsj } X_chars;
327cb960a2Sdownsj 
3317605422Snicm extern X_chars edchars;
347cb960a2Sdownsj 
35f89f8b77Smartynas /* x_cf_glob() flags */
367cb960a2Sdownsj #define XCF_COMMAND	BIT(0)	/* Do command completion */
377cb960a2Sdownsj #define XCF_FILE	BIT(1)	/* Do file completion */
387cb960a2Sdownsj #define XCF_FULLPATH	BIT(2)	/* command completion: store full path */
397cb960a2Sdownsj #define XCF_COMMAND_FILE (XCF_COMMAND|XCF_FILE)
407cb960a2Sdownsj 
417cb960a2Sdownsj /* edit.c */
4269b9f96bSmillert int	x_getc(void);
4369b9f96bSmillert void	x_flush(void);
44a3c80d85Smillert int	x_putc(int);
45c5d5393cSotto void	x_puts(const char *);
460e7d3a01Smillert bool	x_mode(bool);
47c5d5393cSotto int	promptlen(const char *, const char **);
48c5d5393cSotto int	x_do_comment(char *, int, int *);
49c5d5393cSotto void	x_print_expansions(int, char *const *, int);
50c5d5393cSotto int	x_cf_glob(int, const char *, int, int, int *, int *, char ***, int *);
51c5d5393cSotto int	x_longest_prefix(int , char *const *);
52c5d5393cSotto int	x_basename(const char *, const char *);
53c5d5393cSotto void	x_free_words(int, char **);
54c5d5393cSotto int	x_escape(const char *, size_t, int (*)(const char *, size_t));
557cb960a2Sdownsj /* emacs.c */
56c5d5393cSotto int	x_emacs(char *, size_t);
5769b9f96bSmillert void	x_init_emacs(void);
58c5d5393cSotto void	x_emacs_keys(X_chars *);
597cb960a2Sdownsj /* vi.c */
60c5d5393cSotto int	x_vi(char *, size_t);
61