expand.h revision 229220
151792Smarcel/*-
251792Smarcel * Copyright (c) 1991, 1993
351792Smarcel *	The Regents of the University of California.  All rights reserved.
451792Smarcel *
551792Smarcel * This code is derived from software contributed to Berkeley by
651792Smarcel * Kenneth Almquist.
751792Smarcel *
851792Smarcel * Redistribution and use in source and binary forms, with or without
951792Smarcel * modification, are permitted provided that the following conditions
1051792Smarcel * are met:
1151792Smarcel * 1. Redistributions of source code must retain the above copyright
1251792Smarcel *    notice, this list of conditions and the following disclaimer.
1351792Smarcel * 2. Redistributions in binary form must reproduce the above copyright
1451792Smarcel *    notice, this list of conditions and the following disclaimer in the
1551792Smarcel *    documentation and/or other materials provided with the distribution.
1651792Smarcel * 4. Neither the name of the University nor the names of its contributors
1751792Smarcel *    may be used to endorse or promote products derived from this software
1851792Smarcel *    without specific prior written permission.
1951792Smarcel *
2051792Smarcel * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2151792Smarcel * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2251792Smarcel * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2351792Smarcel * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2451792Smarcel * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2551792Smarcel * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2651792Smarcel * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2751792Smarcel * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2851792Smarcel * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2951792Smarcel * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3051792Smarcel * SUCH DAMAGE.
3151792Smarcel *
3251942Smarcel *	@(#)expand.h	8.2 (Berkeley) 5/4/95
3351792Smarcel * $FreeBSD: head/bin/sh/expand.h 229220 2012-01-01 22:17:12Z jilles $
34106977Sdeischen */
35105950Speter
36150013Sobrienstruct strlist {
37150013Sobrien	struct strlist *next;
38150013Sobrien	char *text;
39150013Sobrien};
40150013Sobrien
41150013Sobrien
42150013Sobrienstruct arglist {
43150013Sobrien	struct strlist *list;
44150013Sobrien	struct strlist **lastp;
45150013Sobrien};
46150013Sobrien
47150013Sobrien/*
48150013Sobrien * expandarg() flags
49150013Sobrien */
50150013Sobrien#define EXP_FULL	0x1	/* perform word splitting & file globbing */
51150013Sobrien#define EXP_TILDE	0x2	/* do normal tilde expansion */
52150013Sobrien#define	EXP_VARTILDE	0x4	/* expand tildes in an assignment */
53150013Sobrien#define	EXP_REDIR	0x8	/* file glob for a redirection (1 match only) */
54150013Sobrien#define EXP_CASE	0x10	/* keeps quotes around for CASE pattern */
55150013Sobrien#define EXP_SPLIT_LIT	0x20	/* IFS split literal text ${v+-a b c} */
56150013Sobrien#define EXP_LIT_QUOTED	0x40	/* for EXP_SPLIT_LIT, start off quoted */
57150013Sobrien
58105950Speter
59105950Speterunion node;
60105950Spetervoid expandhere(union node *, int);
61247047Skibvoid expandarg(union node *, struct arglist *, int);
62247047Skibvoid expari(int);
6351942Smarcelvoid rmescapes(char *);
64int casematch(union node *, const char *);
65