tilde.h revision 58310
121308Sache/* tilde.h: Externally available variables and function in libtilde.a. */
221308Sache
321308Sache/* Copyright (C) 1992 Free Software Foundation, Inc.
421308Sache
521308Sache   This file contains the Readline Library (the Library), a set of
621308Sache   routines for providing Emacs style line input to programs that ask
721308Sache   for it.
821308Sache
921308Sache   The Library is free software; you can redistribute it and/or modify
1021308Sache   it under the terms of the GNU General Public License as published by
1158310Sache   the Free Software Foundation; either version 2, or (at your option)
1221308Sache   any later version.
1321308Sache
1421308Sache   The Library is distributed in the hope that it will be useful, but
1521308Sache   WITHOUT ANY WARRANTY; without even the implied warranty of
1621308Sache   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1721308Sache   General Public License for more details.
1821308Sache
1921308Sache   The GNU General Public License is often shipped with GNU software, and
2021308Sache   is generally kept in a file called COPYING or LICENSE.  If you do not
2121308Sache   have a copy of the license, write to the Free Software Foundation,
2258310Sache   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
2321308Sache
2421308Sache#if !defined (_TILDE_H_)
2521308Sache#  define _TILDE_H_
2621308Sache
2758310Sache#ifdef __cplusplus
2858310Sacheextern "C" {
2958310Sache#endif
3058310Sache
3158310Sache/* A function can be defined using prototypes and compile on both ANSI C
3258310Sache   and traditional C compilers with something like this:
3358310Sache	extern char *func __P((char *, char *, int)); */
3458310Sache
3558310Sache#if !defined (__P)
3658310Sache#  if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus)
3758310Sache#    define __P(protos) protos
3858310Sache#  else
3958310Sache#    define __P(protos) ()
4058310Sache#  endif
4158310Sache#endif
4258310Sache
4321308Sache/* Function pointers can be declared as (Function *)foo. */
4421308Sache#if !defined (_FUNCTION_DEF)
4521308Sache#  define _FUNCTION_DEF
4621308Sachetypedef int Function ();
4721308Sachetypedef void VFunction ();
4821308Sachetypedef char *CPFunction ();
4921308Sachetypedef char **CPPFunction ();
5021308Sache#endif /* _FUNCTION_DEF */
5121308Sache
5226497Sache/* If non-null, this contains the address of a function that the application
5326497Sache   wants called before trying the standard tilde expansions.  The function
5426497Sache   is called with the text sans tilde, and returns a malloc()'ed string
5526497Sache   which is the expansion, or a NULL pointer if the expansion fails. */
5626497Sacheextern CPFunction *tilde_expansion_preexpansion_hook;
5726497Sache
5821308Sache/* If non-null, this contains the address of a function to call if the
5921308Sache   standard meaning for expanding a tilde fails.  The function is called
6021308Sache   with the text (sans tilde, as in "foo"), and returns a malloc()'ed string
6121308Sache   which is the expansion, or a NULL pointer if there is no expansion. */
6221308Sacheextern CPFunction *tilde_expansion_failure_hook;
6321308Sache
6421308Sache/* When non-null, this is a NULL terminated array of strings which
6521308Sache   are duplicates for a tilde prefix.  Bash uses this to expand
6621308Sache   `=~' and `:~'. */
6721308Sacheextern char **tilde_additional_prefixes;
6821308Sache
6921308Sache/* When non-null, this is a NULL terminated array of strings which match
7021308Sache   the end of a username, instead of just "/".  Bash sets this to
7121308Sache   `:' and `=~'. */
7221308Sacheextern char **tilde_additional_suffixes;
7321308Sache
7421308Sache/* Return a new string which is the result of tilde expanding STRING. */
7558310Sacheextern char *tilde_expand __P((char *));
7621308Sache
7721308Sache/* Do the work of tilde expansion on FILENAME.  FILENAME starts with a
7821308Sache   tilde.  If there is no expansion, call tilde_expansion_failure_hook. */
7958310Sacheextern char *tilde_expand_word __P((char *));
8021308Sache
8158310Sache#ifdef __cplusplus
8258310Sache}
8358310Sache#endif
8458310Sache
8521308Sache#endif /* _TILDE_H_ */
86