tilde.h 2.6 KB

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