expand.h revision 17987
1232633Smp/*-
259243Sobrien * Copyright (c) 1991, 1993
359243Sobrien *	The Regents of the University of California.  All rights reserved.
459243Sobrien *
559243Sobrien * This code is derived from software contributed to Berkeley by
659243Sobrien * Kenneth Almquist.
759243Sobrien *
859243Sobrien * Redistribution and use in source and binary forms, with or without
959243Sobrien * modification, are permitted provided that the following conditions
1059243Sobrien * are met:
11167465Smp * 1. Redistributions of source code must retain the above copyright
12131962Smp *    notice, this list of conditions and the following disclaimer.
1359243Sobrien * 2. Redistributions in binary form must reproduce the above copyright
1459243Sobrien *    notice, this list of conditions and the following disclaimer in the
1559243Sobrien *    documentation and/or other materials provided with the distribution.
1659243Sobrien * 3. All advertising materials mentioning features or use of this software
1759243Sobrien *    must display the following acknowledgement:
1859243Sobrien *	This product includes software developed by the University of
1959243Sobrien *	California, Berkeley and its contributors.
2059243Sobrien * 4. Neither the name of the University nor the names of its contributors
2159243Sobrien *    may be used to endorse or promote products derived from this software
2259243Sobrien *    without specific prior written permission.
2359243Sobrien *
2459243Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2559243Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2659243Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2759243Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2859243Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29232633Smp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30232633Smp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3159243Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3259243Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33232633Smp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34232633Smp * SUCH DAMAGE.
35232633Smp *
36232633Smp *	@(#)expand.h	8.2 (Berkeley) 5/4/95
37232633Smp *	$Id: expand.h,v 1.2 1994/09/24 02:57:35 davidg Exp $
38232633Smp */
39232633Smp
40232633Smpstruct strlist {
4159243Sobrien	struct strlist *next;
4259243Sobrien	char *text;
4359243Sobrien};
4459243Sobrien
4559243Sobrien
46232633Smpstruct arglist {
4759243Sobrien	struct strlist *list;
4859243Sobrien	struct strlist **lastp;
49232633Smp};
5059243Sobrien
5159243Sobrien/*
5259243Sobrien * expandarg() flags
5359243Sobrien */
5459243Sobrien#define EXP_FULL	0x1	/* perform word splitting & file globbing */
5559243Sobrien#define EXP_TILDE	0x2	/* do normal tilde expansion */
5659243Sobrien#define	EXP_VARTILDE	0x4	/* expand tildes in an assignment */
5759243Sobrien#define	EXP_REDIR	0x8	/* file glob for a redirection (1 match only) */
5859243Sobrien#define EXP_CASE	0x10	/* keeps quotes around for CASE pattern */
5959243Sobrien
6059243Sobrien
6159243Sobrienunion node;
6259243Sobrienvoid expandhere __P((union node *, int));
6359243Sobrienvoid expandarg __P((union node *, struct arglist *, int));
6459243Sobrienvoid expari __P((int));
6559243Sobrienint patmatch __P((char *, char *));
6659243Sobrienvoid rmescapes __P((char *));
6759243Sobrienint casematch __P((union node *, char *));
6859243Sobrien