expand.h revision 267654
1167465Smp/*- 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: 1159243Sobrien * 1. Redistributions of source code must retain the above copyright 1259243Sobrien * 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 * 4. Neither the name of the University nor the names of its contributors 17100616Smp * may be used to endorse or promote products derived from this software 1859243Sobrien * without specific prior written permission. 1959243Sobrien * 2059243Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2159243Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2259243Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2359243Sobrien * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2459243Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2559243Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2659243Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2759243Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2859243Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2959243Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3059243Sobrien * SUCH DAMAGE. 3159243Sobrien * 3259243Sobrien * @(#)expand.h 8.2 (Berkeley) 5/4/95 3359243Sobrien * $FreeBSD: releng/9.3/bin/sh/expand.h 231790 2012-02-15 22:45:57Z jilles $ 3459243Sobrien */ 35167465Smp 3659243Sobrienstruct strlist { 3759243Sobrien struct strlist *next; 3859243Sobrien char *text; 3959243Sobrien}; 4059243Sobrien 4159243Sobrien 4259243Sobrienstruct arglist { 4359243Sobrien struct strlist *list; 4459243Sobrien struct strlist **lastp; 4559243Sobrien}; 4659243Sobrien 4759243Sobrien/* 4859243Sobrien * expandarg() flags 4959243Sobrien */ 5059243Sobrien#define EXP_FULL 0x1 /* perform word splitting & file globbing */ 5159243Sobrien#define EXP_TILDE 0x2 /* do normal tilde expansion */ 5259243Sobrien#define EXP_VARTILDE 0x4 /* expand tildes in an assignment */ 53145479Smp#define EXP_REDIR 0x8 /* file glob for a redirection (1 match only) */ 5459243Sobrien#define EXP_CASE 0x10 /* keeps quotes around for CASE pattern */ 5559243Sobrien#define EXP_SPLIT_LIT 0x20 /* IFS split literal text ${v+-a b c} */ 5659243Sobrien#define EXP_LIT_QUOTED 0x40 /* for EXP_SPLIT_LIT, start off quoted */ 5759243Sobrien 5859243Sobrien 5959243Sobrienunion node; 6059243Sobrienvoid expandhere(union node *, int); 6159243Sobrienvoid expandarg(union node *, struct arglist *, int); 6259243Sobrienvoid expari(int); 6359243Sobrienvoid rmescapes(char *); 6459243Sobrienint casematch(union node *, const char *); 6559243Sobrien