blob: e26dd0476f7b3369ff842c26716640b7a4b99b89 [file] [log] [blame]
Jari Aalto726f6381996-08-26 18:22:31 +00001/* tilde.h: Externally available variables and function in libtilde.a. */
2
Jari Aalto31859422009-01-12 13:36:28 +00003/* Copyright (C) 1992-2009 Free Software Foundation, Inc.
Jari Aaltoccc6cda1996-12-23 17:02:34 +00004
Jari Aalto31859422009-01-12 13:36:28 +00005 This file contains the Readline Library (Readline), a set of
Jari Aaltoccc6cda1996-12-23 17:02:34 +00006 routines for providing Emacs style line input to programs that ask
7 for it.
8
Jari Aalto31859422009-01-12 13:36:28 +00009 Readline is free software: you can redistribute it and/or modify
Jari Aaltoccc6cda1996-12-23 17:02:34 +000010 it under the terms of the GNU General Public License as published by
Jari Aalto31859422009-01-12 13:36:28 +000011 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
Jari Aaltoccc6cda1996-12-23 17:02:34 +000013
Jari Aalto31859422009-01-12 13:36:28 +000014 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.
Jari Aaltoccc6cda1996-12-23 17:02:34 +000018
Jari Aalto31859422009-01-12 13:36:28 +000019 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*/
Jari Aaltoccc6cda1996-12-23 17:02:34 +000022
23#if !defined (_TILDE_H_)
24# define _TILDE_H_
Jari Aalto726f6381996-08-26 18:22:31 +000025
Jari Aaltobb706242000-03-17 21:46:59 +000026#ifdef __cplusplus
27extern "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:
Jari Aaltof73dda02001-11-13 17:56:06 +000032 extern char *func PARAMS((char *, char *, int)); */
Jari Aaltobb706242000-03-17 21:46:59 +000033
Jari Aaltof73dda02001-11-13 17:56:06 +000034#if !defined (PARAMS)
Jari Aaltobb706242000-03-17 21:46:59 +000035# if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus)
Jari Aaltof73dda02001-11-13 17:56:06 +000036# define PARAMS(protos) protos
Jari Aaltobb706242000-03-17 21:46:59 +000037# else
Jari Aaltof73dda02001-11-13 17:56:06 +000038# define PARAMS(protos) ()
Jari Aaltobb706242000-03-17 21:46:59 +000039# endif
40#endif
41
Jari Aaltof73dda02001-11-13 17:56:06 +000042typedef char *tilde_hook_func_t PARAMS((char *));
Jari Aalto726f6381996-08-26 18:22:31 +000043
Jari Aaltod166f041997-06-05 14:59:13 +000044/* 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. */
Jari Aalto28ef6c32001-04-06 19:14:31 +000048extern tilde_hook_func_t *tilde_expansion_preexpansion_hook;
Jari Aaltod166f041997-06-05 14:59:13 +000049
Jari Aalto726f6381996-08-26 18:22:31 +000050/* 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. */
Jari Aalto28ef6c32001-04-06 19:14:31 +000054extern tilde_hook_func_t *tilde_expansion_failure_hook;
Jari Aalto726f6381996-08-26 18:22:31 +000055
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 `:~'. */
59extern 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 `=~'. */
64extern char **tilde_additional_suffixes;
65
66/* Return a new string which is the result of tilde expanding STRING. */
Jari Aaltof73dda02001-11-13 17:56:06 +000067extern char *tilde_expand PARAMS((const char *));
Jari Aalto726f6381996-08-26 18:22:31 +000068
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. */
Jari Aaltof73dda02001-11-13 17:56:06 +000071extern char *tilde_expand_word PARAMS((const char *));
Jari Aaltobb706242000-03-17 21:46:59 +000072
Jari Aalto95732b42005-12-07 14:08:12 +000073/* Find the portion of the string beginning with ~ that should be expanded. */
74extern char *tilde_find_word PARAMS((const char *, int, int *));
75
Jari Aaltobb706242000-03-17 21:46:59 +000076#ifdef __cplusplus
77}
78#endif
Jari Aalto726f6381996-08-26 18:22:31 +000079
Jari Aaltoccc6cda1996-12-23 17:02:34 +000080#endif /* _TILDE_H_ */