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