xref: /openbsd-src/usr.bin/make/direxpand.h (revision dba68890dc2f821a2767fe1773a14cfff3b41f2a)
1267e030aSespie #ifndef DIREXPAND_H
2267e030aSespie #define DIREXPAND_H
3*dba68890Sespie /* $OpenBSD: direxpand.h,v 1.2 2010/07/19 19:30:37 espie Exp $ */
4267e030aSespie /*
5267e030aSespie  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
6267e030aSespie  * Copyright (c) 1988, 1989 by Adam de Boor
7267e030aSespie  * Copyright (c) 1989 by Berkeley Softworks
8267e030aSespie  * All rights reserved.
9267e030aSespie  *
10267e030aSespie  * This code is derived from software contributed to Berkeley by
11267e030aSespie  * Adam de Boor.
12267e030aSespie  *
13267e030aSespie  * Redistribution and use in source and binary forms, with or without
14267e030aSespie  * modification, are permitted provided that the following conditions
15267e030aSespie  * are met:
16267e030aSespie  * 1. Redistributions of source code must retain the above copyright
17267e030aSespie  *    notice, this list of conditions and the following disclaimer.
18267e030aSespie  * 2. Redistributions in binary form must reproduce the above copyright
19267e030aSespie  *    notice, this list of conditions and the following disclaimer in the
20267e030aSespie  *    documentation and/or other materials provided with the distribution.
21267e030aSespie  * 3. Neither the name of the University nor the names of its contributors
22267e030aSespie  *    may be used to endorse or promote products derived from this software
23267e030aSespie  *    without specific prior written permission.
24267e030aSespie  *
25267e030aSespie  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26267e030aSespie  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27267e030aSespie  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28267e030aSespie  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29267e030aSespie  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30267e030aSespie  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31267e030aSespie  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32267e030aSespie  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33267e030aSespie  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34267e030aSespie  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35267e030aSespie  * SUCH DAMAGE.
36267e030aSespie  *
37267e030aSespie  *	from: @(#)dir.h 8.1 (Berkeley) 6/6/93
38267e030aSespie  */
39267e030aSespie 
40267e030aSespie /* boolean = Dir_HasWildcardsi(name, end)
41267e030aSespie  *	Returns true if (name, end) needs to be wildcard-expanded.
42267e030aSespie  */
43267e030aSespie extern bool Dir_HasWildcardsi(const char *, const char *);
44267e030aSespie #define Dir_HasWildcards(n) Dir_HasWildcardsi(n, strchr(n, '\0'))
45267e030aSespie 
46267e030aSespie /* Dir_Expandi(pattern, endp, path, expansions);
47267e030aSespie  *	Expand (pattern, endp) to Lst of names matching on the search path.
48267e030aSespie  *	Put result in expansions.
49267e030aSespie  */
50267e030aSespie extern void Dir_Expandi(const char *, const char *, Lst, Lst);
51267e030aSespie #define Dir_Expand(n, l1, l2) Dir_Expandi(n, strchr(n, '\0'), l1, l2)
52267e030aSespie 
53267e030aSespie #endif
54