summaryrefslogtreecommitdiff
path: root/bin/ksh/edit.h
blob: 126e4ea17cacdb8807124c74ec78929ef5334420 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*	$OpenBSD: edit.h,v 1.5 2004/12/19 04:14:20 deraadt Exp $	*/

/* NAME:
 *      edit.h - globals for edit modes
 *
 * DESCRIPTION:
 *      This header defines various global edit objects.
 *
 * SEE ALSO:
 *
 *
 * RCSid:
 *      $From: edit.h,v 1.2 1994/05/19 18:32:40 michael Exp michael $
 *
 */

/* some useful #defines */
#ifdef EXTERN
# define I__(i) = i
#else
# define I__(i)
# define EXTERN extern
# define EXTERN_DEFINED
#endif

#define	BEL		0x07

/* tty driver characters we are interested in */
typedef struct {
	int erase;
	int kill;
	int werase;
	int intr;
	int quit;
	int eof;
} X_chars;

EXTERN X_chars edchars;

/* x_fc_glob() flags */
#define XCF_COMMAND	BIT(0)	/* Do command completion */
#define XCF_FILE	BIT(1)	/* Do file completion */
#define XCF_FULLPATH	BIT(2)	/* command completion: store full path */
#define XCF_COMMAND_FILE (XCF_COMMAND|XCF_FILE)

/* edit.c */
int 	x_getc(void);
void 	x_flush(void);
void 	x_putc(int c);
void 	x_puts(const char *s);
bool_t 	x_mode(bool_t onoff);
int 	promptlen(const char *cp, const char **spp);
int	x_do_comment(char *buf, int bsize, int *lenp);
void	x_print_expansions(int nwords, char *const *words, int is_command);
int	x_cf_glob(int flags, const char *buf, int buflen, int pos, int *startp,
			  int *endp, char ***wordsp, int *is_commandp);
int	x_longest_prefix(int nwords, char *const *words);
int	x_basename(const char *s, const char *se);
void	x_free_words(int nwords, char **words);
int	x_escape(const char *, size_t, int (*)(const char *s, size_t len));
/* emacs.c */
int 	x_emacs(char *buf, size_t len);
void 	x_init_emacs(void);
void	x_emacs_keys(X_chars *ec);
/* vi.c */
int 	x_vi(char *buf, size_t len);


#ifdef DEBUG
# define D__(x) x
#else
# define D__(x)
#endif

/* This lot goes at the END */
/* be sure not to interfere with anyone else's idea about EXTERN */
#ifdef EXTERN_DEFINED
# undef EXTERN_DEFINED
# undef EXTERN
#endif
#undef I__
/*
 * Local Variables:
 * version-control:t
 * comment-column:40
 * End:
 */