xref: /openbsd/gnu/lib/libreadline/tilde.h (revision 15b117ea)
11acd27e7Smillert /* tilde.h: Externally available variables and function in libtilde.a. */
21acd27e7Smillert 
31acd27e7Smillert /* Copyright (C) 1992 Free Software Foundation, Inc.
41acd27e7Smillert 
51acd27e7Smillert    This file contains the Readline Library (the Library), a set of
61acd27e7Smillert    routines for providing Emacs style line input to programs that ask
71acd27e7Smillert    for it.
81acd27e7Smillert 
91acd27e7Smillert    The Library is free software; you can redistribute it and/or modify
101acd27e7Smillert    it under the terms of the GNU General Public License as published by
111acd27e7Smillert    the Free Software Foundation; either version 2, or (at your option)
121acd27e7Smillert    any later version.
131acd27e7Smillert 
141acd27e7Smillert    The Library is distributed in the hope that it will be useful, but
151acd27e7Smillert    WITHOUT ANY WARRANTY; without even the implied warranty of
161acd27e7Smillert    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
171acd27e7Smillert    General Public License for more details.
181acd27e7Smillert 
191acd27e7Smillert    The GNU General Public License is often shipped with GNU software, and
201acd27e7Smillert    is generally kept in a file called COPYING or LICENSE.  If you do not
211acd27e7Smillert    have a copy of the license, write to the Free Software Foundation,
221acd27e7Smillert    59 Temple Place, Suite 330, Boston, MA 02111 USA. */
231acd27e7Smillert 
241acd27e7Smillert #if !defined (_TILDE_H_)
251acd27e7Smillert #  define _TILDE_H_
261acd27e7Smillert 
271acd27e7Smillert #ifdef __cplusplus
281acd27e7Smillert extern "C" {
291acd27e7Smillert #endif
301acd27e7Smillert 
311acd27e7Smillert /* A function can be defined using prototypes and compile on both ANSI C
321acd27e7Smillert    and traditional C compilers with something like this:
33*15b117eaSkettenis 	extern char *func PARAMS((char *, char *, int)); */
341acd27e7Smillert 
35*15b117eaSkettenis #if !defined (PARAMS)
361acd27e7Smillert #  if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus)
37*15b117eaSkettenis #    define PARAMS(protos) protos
381acd27e7Smillert #  else
39*15b117eaSkettenis #    define PARAMS(protos) ()
401acd27e7Smillert #  endif
411acd27e7Smillert #endif
421acd27e7Smillert 
43*15b117eaSkettenis typedef char *tilde_hook_func_t PARAMS((char *));
441acd27e7Smillert 
451acd27e7Smillert /* If non-null, this contains the address of a function that the application
461acd27e7Smillert    wants called before trying the standard tilde expansions.  The function
471acd27e7Smillert    is called with the text sans tilde, and returns a malloc()'ed string
481acd27e7Smillert    which is the expansion, or a NULL pointer if the expansion fails. */
49*15b117eaSkettenis extern tilde_hook_func_t *tilde_expansion_preexpansion_hook;
501acd27e7Smillert 
511acd27e7Smillert /* If non-null, this contains the address of a function to call if the
521acd27e7Smillert    standard meaning for expanding a tilde fails.  The function is called
531acd27e7Smillert    with the text (sans tilde, as in "foo"), and returns a malloc()'ed string
541acd27e7Smillert    which is the expansion, or a NULL pointer if there is no expansion. */
55*15b117eaSkettenis extern tilde_hook_func_t *tilde_expansion_failure_hook;
561acd27e7Smillert 
571acd27e7Smillert /* When non-null, this is a NULL terminated array of strings which
581acd27e7Smillert    are duplicates for a tilde prefix.  Bash uses this to expand
591acd27e7Smillert    `=~' and `:~'. */
601acd27e7Smillert extern char **tilde_additional_prefixes;
611acd27e7Smillert 
621acd27e7Smillert /* When non-null, this is a NULL terminated array of strings which match
631acd27e7Smillert    the end of a username, instead of just "/".  Bash sets this to
641acd27e7Smillert    `:' and `=~'. */
651acd27e7Smillert extern char **tilde_additional_suffixes;
661acd27e7Smillert 
671acd27e7Smillert /* Return a new string which is the result of tilde expanding STRING. */
68*15b117eaSkettenis extern char *tilde_expand PARAMS((const char *));
691acd27e7Smillert 
701acd27e7Smillert /* Do the work of tilde expansion on FILENAME.  FILENAME starts with a
711acd27e7Smillert    tilde.  If there is no expansion, call tilde_expansion_failure_hook. */
72*15b117eaSkettenis extern char *tilde_expand_word PARAMS((const char *));
731acd27e7Smillert 
741acd27e7Smillert #ifdef __cplusplus
751acd27e7Smillert }
761acd27e7Smillert #endif
771acd27e7Smillert 
781acd27e7Smillert #endif /* _TILDE_H_ */
79