00001 /* tilde.h: Externally available variables and function in libtilde.a. */ 00002 00003 /* Copyright (C) 1992 Free Software Foundation, Inc. 00004 00005 This file contains the Readline Library (the Library), a set of 00006 routines for providing Emacs style line input to programs that ask 00007 for it. 00008 00009 The Library is free software; you can redistribute it and/or modify 00010 it under the terms of the GNU General Public License as published by 00011 the Free Software Foundation; either version 2, or (at your option) 00012 any later version. 00013 00014 The Library is distributed in the hope that it will be useful, but 00015 WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 General Public License for more details. 00018 00019 The GNU General Public License is often shipped with GNU software, and 00020 is generally kept in a file called COPYING or LICENSE. If you do not 00021 have a copy of the license, write to the Free Software Foundation, 00022 59 Temple Place, Suite 330, Boston, MA 02111 USA. */ 00023 00024 #if !defined (_TILDE_H_) 00025 # define _TILDE_H_ 00026 00027 #ifdef __cplusplus 00028 extern "C" { 00029 #endif 00030 00031 /* A function can be defined using prototypes and compile on both ANSI C 00032 and traditional C compilers with something like this: 00033 extern char *func PARAMS((char *, char *, int)); */ 00034 00035 #if !defined (PARAMS) 00036 # if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus) 00037 # define PARAMS(protos) protos 00038 # else 00039 # define PARAMS(protos) () 00040 # endif 00041 #endif 00042 00043 typedef char *tilde_hook_func_t PARAMS((char *)); 00044 00045 /* If non-null, this contains the address of a function that the application 00046 wants called before trying the standard tilde expansions. The function 00047 is called with the text sans tilde, and returns a malloc()'ed string 00048 which is the expansion, or a NULL pointer if the expansion fails. */ 00049 extern tilde_hook_func_t *tilde_expansion_preexpansion_hook; 00050 00051 /* If non-null, this contains the address of a function to call if the 00052 standard meaning for expanding a tilde fails. The function is called 00053 with the text (sans tilde, as in "foo"), and returns a malloc()'ed string 00054 which is the expansion, or a NULL pointer if there is no expansion. */ 00055 extern tilde_hook_func_t *tilde_expansion_failure_hook; 00056 00057 /* When non-null, this is a NULL terminated array of strings which 00058 are duplicates for a tilde prefix. Bash uses this to expand 00059 `=~' and `:~'. */ 00060 extern char **tilde_additional_prefixes; 00061 00062 /* When non-null, this is a NULL terminated array of strings which match 00063 the end of a username, instead of just "/". Bash sets this to 00064 `:' and `=~'. */ 00065 extern char **tilde_additional_suffixes; 00066 00067 /* Return a new string which is the result of tilde expanding STRING. */ 00068 extern char *tilde_expand PARAMS((const char *)); 00069 00070 /* Do the work of tilde expansion on FILENAME. FILENAME starts with a 00071 tilde. If there is no expansion, call tilde_expansion_failure_hook. */ 00072 extern char *tilde_expand_word PARAMS((const char *)); 00073 00074 /* Find the portion of the string beginning with ~ that should be expanded. */ 00075 extern char *tilde_find_word PARAMS((const char *, int, int *)); 00076 00077 #ifdef __cplusplus 00078 } 00079 #endif 00080 00081 #endif /* _TILDE_H_ */