expand.h revision 259065
1219820Sjeff/*- 2219820Sjeff * Copyright (c) 1991, 1993 3219820Sjeff * The Regents of the University of California. All rights reserved. 4219820Sjeff * 5219820Sjeff * This code is derived from software contributed to Berkeley by 6219820Sjeff * Kenneth Almquist. 7219820Sjeff * 8219820Sjeff * Redistribution and use in source and binary forms, with or without 9219820Sjeff * modification, are permitted provided that the following conditions 10219820Sjeff * are met: 11219820Sjeff * 1. Redistributions of source code must retain the above copyright 12219820Sjeff * notice, this list of conditions and the following disclaimer. 13219820Sjeff * 2. Redistributions in binary form must reproduce the above copyright 14219820Sjeff * notice, this list of conditions and the following disclaimer in the 15219820Sjeff * documentation and/or other materials provided with the distribution. 16219820Sjeff * 4. Neither the name of the University nor the names of its contributors 17219820Sjeff * may be used to endorse or promote products derived from this software 18219820Sjeff * without specific prior written permission. 19219820Sjeff * 20219820Sjeff * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21219820Sjeff * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22219820Sjeff * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23219820Sjeff * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24219820Sjeff * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25219820Sjeff * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26219820Sjeff * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27219820Sjeff * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28219820Sjeff * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29219820Sjeff * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30219820Sjeff * SUCH DAMAGE. 31219820Sjeff * 32219820Sjeff * @(#)expand.h 8.2 (Berkeley) 5/4/95 33219820Sjeff * $FreeBSD: releng/10.0/bin/sh/expand.h 246288 2013-02-03 15:54:57Z jilles $ 34219820Sjeff */ 35219820Sjeff 36219820Sjeffstruct strlist { 37219820Sjeff struct strlist *next; 38219820Sjeff char *text; 39219820Sjeff}; 40219820Sjeff 41219820Sjeff 42219820Sjeffstruct arglist { 43219820Sjeff struct strlist *list; 44219820Sjeff struct strlist **lastp; 45219820Sjeff}; 46219820Sjeff 47219820Sjeff/* 48219820Sjeff * expandarg() flags 49219820Sjeff */ 50219820Sjeff#define EXP_FULL 0x1 /* perform word splitting & file globbing */ 51219820Sjeff#define EXP_TILDE 0x2 /* do normal tilde expansion */ 52219820Sjeff#define EXP_VARTILDE 0x4 /* expand tildes in an assignment */ 53219820Sjeff#define EXP_REDIR 0x8 /* file glob for a redirection (1 match only) */ 54219820Sjeff#define EXP_CASE 0x10 /* keeps quotes around for CASE pattern */ 55219820Sjeff#define EXP_SPLIT_LIT 0x20 /* IFS split literal text ${v+-a b c} */ 56219820Sjeff#define EXP_LIT_QUOTED 0x40 /* for EXP_SPLIT_LIT, start off quoted */ 57219820Sjeff 58219820Sjeff 59219820Sjeffunion node; 60219820Sjeffvoid expandarg(union node *, struct arglist *, int); 61219820Sjeffvoid expari(int); 62219820Sjeffvoid rmescapes(char *); 63219820Sjeffint casematch(union node *, const char *); 64219820Sjeff