Imported from ../bash-2.0.tar.gz.
[platform/upstream/bash.git] / pathexp.h
1 /* pathexp.h -- The shell interface to the globbing library. */
2
3 /* Copyright (C) 1987,1989 Free Software Foundation, Inc.
4
5    This file is part of GNU Bash, the Bourne Again SHell.
6
7    Bash is free software; you can redistribute it and/or modify it under
8    the terms of the GNU General Public License as published by the Free
9    Software Foundation; either version 2, or (at your option) any later
10    version.
11
12    Bash is distributed in the hope that it will be useful, but WITHOUT ANY
13    WARRANTY; without even the implied warranty of MERCHANTABILITY or
14    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15    for more details.
16
17    You should have received a copy of the GNU General Public License along
18    with Bash; see the file COPYING.  If not, write to the Free Software
19    Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
20
21 #if !defined (_PATHEXP_H_)
22 #define _PATHEXP_H_
23
24 #if defined (USE_POSIX_GLOB_LIBRARY)
25 #  define GLOB_FAILED(glist)    !(glist)
26 #else /* !USE_POSIX_GLOB_LIBRARY */
27 #  define GLOB_FAILED(glist)    (glist) == (char **)&glob_error_return
28 extern int noglob_dot_filenames;
29 extern char *glob_error_return;
30 #endif /* !USE_POSIX_GLOB_LIBRARY */
31
32 extern int glob_dot_filenames;
33
34 extern int unquoted_glob_pattern_p __P((char *));
35
36 /* PATHNAME can contain characters prefixed by CTLESC;; this indicates
37    that the character is to be quoted.  We quote it here in the style
38    that the glob library recognizes.  If CONVERT_QUOTED_NULLS is non-zero,
39    we change quoted null strings (pathname[0] == CTLNUL) into empty
40    strings (pathname[0] == 0).  If this is called after quote removal
41    is performed, CONVERT_QUOTED_NULLS should be 0; if called when quote
42    removal has not been done (for example, before attempting to match a
43    pattern while executing a case statement), CONVERT_QUOTED_NULLS should
44    be 1. */
45 extern char *quote_string_for_globbing __P((char *, int));
46
47 extern char *quote_globbing_chars __P((char *));
48
49 /* Call the glob library to do globbing on PATHNAME. */
50 extern char **shell_glob_filename __P((char *));
51
52 /* Filename completion ignore.  Used to the "fignore" facility of
53    tcsh and GLOBIGNORE (like ksh-93 FIGNORE).
54
55    It is passed a NULL-terminated array of (char *)'s that must be
56    free()'d if they are deleted.  The first element (names[0]) is the
57    least-common-denominator string of the matching patterns (i.e.
58    u<TAB> produces names[0] = "und", names[1] = "under.c", names[2] =
59    "undun.c", name[3] = NULL).  */
60
61 struct ign {
62   char *val;
63   int len, flags;
64 };
65
66 struct ignorevar {
67   char *varname;        /* FIGNORE or GLOBIGNORE */
68   struct ign *ignores;  /* Store the ignore strings here */
69   int num_ignores;      /* How many are there? */
70   char *last_ignoreval; /* Last value of variable - cached for speed */
71   Function *item_func;  /* Called when each item is parsed from $`varname' */
72 };
73
74 extern void setup_ignore_patterns __P((struct ignorevar *));
75
76 extern void setup_glob_ignore __P((char *));
77 extern int should_ignore_glob_matches __P((void));
78 extern void ignore_glob_matches __P((char **));
79
80 #endif