expand.h revision 39137
1139731Simp/*- 2131899Smarcel * Copyright (c) 1991, 1993 3131899Smarcel * The Regents of the University of California. All rights reserved. 4131899Smarcel * 5131899Smarcel * This code is derived from software contributed to Berkeley by 6131899Smarcel * Kenneth Almquist. 7131899Smarcel * 8131899Smarcel * Redistribution and use in source and binary forms, with or without 9131899Smarcel * modification, are permitted provided that the following conditions 10131899Smarcel * are met: 11131899Smarcel * 1. Redistributions of source code must retain the above copyright 12131899Smarcel * notice, this list of conditions and the following disclaimer. 13131899Smarcel * 2. Redistributions in binary form must reproduce the above copyright 14131899Smarcel * notice, this list of conditions and the following disclaimer in the 15131899Smarcel * documentation and/or other materials provided with the distribution. 16131899Smarcel * 3. All advertising materials mentioning features or use of this software 17131899Smarcel * must display the following acknowledgement: 18131899Smarcel * This product includes software developed by the University of 19131899Smarcel * California, Berkeley and its contributors. 20131899Smarcel * 4. Neither the name of the University nor the names of its contributors 21131899Smarcel * may be used to endorse or promote products derived from this software 22131899Smarcel * without specific prior written permission. 23131899Smarcel * 24131899Smarcel * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25131899Smarcel * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26131899Smarcel * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27131899Smarcel * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28131899Smarcel * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29131899Smarcel * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30131899Smarcel * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31131899Smarcel * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32166520Sjhb * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33131899Smarcel * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34157455Smarcel * SUCH DAMAGE. 35131899Smarcel * 36131899Smarcel * @(#)expand.h 8.2 (Berkeley) 5/4/95 37131899Smarcel * $Id: expand.h,v 1.6 1998/09/06 21:13:09 tegge Exp $ 38131899Smarcel */ 39131899Smarcel 40131899Smarcelstruct strlist { 41131899Smarcel struct strlist *next; 42131899Smarcel char *text; 43131899Smarcel}; 44131899Smarcel 45131899Smarcel 46131899Smarcelstruct arglist { 47131899Smarcel struct strlist *list; 48131899Smarcel struct strlist **lastp; 49138253Smarcel}; 50157458Smarcel 51131899Smarcel/* 52131899Smarcel * expandarg() flags 53 */ 54#define EXP_FULL 0x1 /* perform word splitting & file globbing */ 55#define EXP_TILDE 0x2 /* do normal tilde expansion */ 56#define EXP_VARTILDE 0x4 /* expand tildes in an assignment */ 57#define EXP_REDIR 0x8 /* file glob for a redirection (1 match only) */ 58#define EXP_CASE 0x10 /* keeps quotes around for CASE pattern */ 59 60 61union node; 62void expandhere __P((union node *, int)); 63void expandarg __P((union node *, struct arglist *, int)); 64void expari __P((int)); 65int patmatch __P((char *, char *)); 66void rmescapes __P((char *)); 67int casematch __P((union node *, char *)); 68