Commit | Line | Data |
---|---|---|
d60d9f65 SS |
1 | /* tilde.h: Externally available variables and function in libtilde.a. */ |
2 | ||
cc88a640 | 3 | /* Copyright (C) 1992-2009 Free Software Foundation, Inc. |
d60d9f65 | 4 | |
cc88a640 | 5 | This file contains the Readline Library (Readline), a set of |
d60d9f65 SS |
6 | routines for providing Emacs style line input to programs that ask |
7 | for it. | |
8 | ||
cc88a640 | 9 | Readline is free software: you can redistribute it and/or modify |
d60d9f65 | 10 | it under the terms of the GNU General Public License as published by |
cc88a640 JK |
11 | the Free Software Foundation, either version 3 of the License, or |
12 | (at your option) any later version. | |
d60d9f65 | 13 | |
cc88a640 JK |
14 | Readline is distributed in the hope that it will be useful, |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | GNU General Public License for more details. | |
d60d9f65 | 18 | |
cc88a640 JK |
19 | You should have received a copy of the GNU General Public License |
20 | along with Readline. If not, see <http://www.gnu.org/licenses/>. | |
21 | */ | |
d60d9f65 SS |
22 | |
23 | #if !defined (_TILDE_H_) | |
24 | # define _TILDE_H_ | |
25 | ||
1b17e766 EZ |
26 | #ifdef __cplusplus |
27 | extern "C" { | |
28 | #endif | |
29 | ||
30 | /* A function can be defined using prototypes and compile on both ANSI C | |
31 | and traditional C compilers with something like this: | |
9255ee31 | 32 | extern char *func PARAMS((char *, char *, int)); */ |
1b17e766 | 33 | |
9255ee31 | 34 | #if !defined (PARAMS) |
1b17e766 | 35 | # if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus) |
9255ee31 | 36 | # define PARAMS(protos) protos |
1b17e766 | 37 | # else |
9255ee31 | 38 | # define PARAMS(protos) () |
1b17e766 EZ |
39 | # endif |
40 | #endif | |
41 | ||
9255ee31 | 42 | typedef char *tilde_hook_func_t PARAMS((char *)); |
d60d9f65 SS |
43 | |
44 | /* If non-null, this contains the address of a function that the application | |
45 | wants called before trying the standard tilde expansions. The function | |
46 | is called with the text sans tilde, and returns a malloc()'ed string | |
47 | which is the expansion, or a NULL pointer if the expansion fails. */ | |
9255ee31 | 48 | extern tilde_hook_func_t *tilde_expansion_preexpansion_hook; |
d60d9f65 SS |
49 | |
50 | /* If non-null, this contains the address of a function to call if the | |
51 | standard meaning for expanding a tilde fails. The function is called | |
52 | with the text (sans tilde, as in "foo"), and returns a malloc()'ed string | |
53 | which is the expansion, or a NULL pointer if there is no expansion. */ | |
9255ee31 | 54 | extern tilde_hook_func_t *tilde_expansion_failure_hook; |
d60d9f65 SS |
55 | |
56 | /* When non-null, this is a NULL terminated array of strings which | |
57 | are duplicates for a tilde prefix. Bash uses this to expand | |
58 | `=~' and `:~'. */ | |
59 | extern char **tilde_additional_prefixes; | |
60 | ||
61 | /* When non-null, this is a NULL terminated array of strings which match | |
62 | the end of a username, instead of just "/". Bash sets this to | |
63 | `:' and `=~'. */ | |
64 | extern char **tilde_additional_suffixes; | |
65 | ||
66 | /* Return a new string which is the result of tilde expanding STRING. */ | |
9255ee31 | 67 | extern char *tilde_expand PARAMS((const char *)); |
d60d9f65 SS |
68 | |
69 | /* Do the work of tilde expansion on FILENAME. FILENAME starts with a | |
70 | tilde. If there is no expansion, call tilde_expansion_failure_hook. */ | |
9255ee31 | 71 | extern char *tilde_expand_word PARAMS((const char *)); |
1b17e766 | 72 | |
5bdf8622 DJ |
73 | /* Find the portion of the string beginning with ~ that should be expanded. */ |
74 | extern char *tilde_find_word PARAMS((const char *, int, int *)); | |
75 | ||
1b17e766 EZ |
76 | #ifdef __cplusplus |
77 | } | |
78 | #endif | |
d60d9f65 SS |
79 | |
80 | #endif /* _TILDE_H_ */ |