1141104Sharti/*-
2141104Sharti * Copyright (c) 1988, 1989, 1990, 1993
3141104Sharti *	The Regents of the University of California.  All rights reserved.
4141104Sharti * Copyright (c) 1989 by Berkeley Softworks
5141104Sharti * All rights reserved.
6141104Sharti *
7141104Sharti * This code is derived from software contributed to Berkeley by
8141104Sharti * Adam de Boor.
9141104Sharti *
10141104Sharti * Redistribution and use in source and binary forms, with or without
11141104Sharti * modification, are permitted provided that the following conditions
12141104Sharti * are met:
13141104Sharti * 1. Redistributions of source code must retain the above copyright
14141104Sharti *    notice, this list of conditions and the following disclaimer.
15141104Sharti * 2. Redistributions in binary form must reproduce the above copyright
16141104Sharti *    notice, this list of conditions and the following disclaimer in the
17141104Sharti *    documentation and/or other materials provided with the distribution.
18141104Sharti * 3. All advertising materials mentioning features or use of this software
19141104Sharti *    must display the following acknowledgement:
20141104Sharti *	This product includes software developed by the University of
21141104Sharti *	California, Berkeley and its contributors.
22141104Sharti * 4. Neither the name of the University nor the names of its contributors
23141104Sharti *    may be used to endorse or promote products derived from this software
24141104Sharti *    without specific prior written permission.
25141104Sharti *
26141104Sharti * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27141104Sharti * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28141104Sharti * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29141104Sharti * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30141104Sharti * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31141104Sharti * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32141104Sharti * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33141104Sharti * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34141104Sharti * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35141104Sharti * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36141104Sharti * SUCH DAMAGE.
37141104Sharti *
38141104Sharti * $FreeBSD$
39141104Sharti */
40141104Sharti
41141104Sharti#ifndef str_h_44db59e6
42141104Sharti#define	str_h_44db59e6
43141104Sharti
44146177Sharti#include "util.h"
45141104Sharti
46141133Shartistruct Buffer;
47141133Sharti
48146345Sharti/**
49146345Sharti * An array of c-strings.  The pointers stored in argv, point to
50146345Sharti * strings stored in buffer.
51146345Sharti */
52146345Shartitypedef struct ArgArray {
53146345Sharti	int	size;		/* size of argv array */
54146345Sharti	int	argc;		/* strings referenced in argv */
55146345Sharti	char	**argv;		/* array of string pointers */
56146345Sharti	size_t	len;		/* size of buffer */
57146345Sharti	char	*buffer;	/* data buffer */
58146345Sharti} ArgArray;
59146345Sharti
60141104Sharti/*
61141104Sharti * These constants are all used by the Str_Concat function to decide how the
62141104Sharti * final string should look. If STR_ADDSPACE is given, a space will be
63141104Sharti * placed between the two strings. If STR_ADDSLASH is given, a '/' will
64141104Sharti * be used instead of a space. If neither is given, no intervening characters
65141104Sharti * will be placed between the two strings in the final output.
66141104Sharti */
67141104Sharti#define	STR_ADDSPACE	0x01	/* add a space when Str_Concat'ing */
68141104Sharti#define	STR_ADDSLASH	0x04	/* add a slash when Str_Concat'ing */
69141104Sharti
70146543Shartivoid ArgArray_Init(ArgArray *);
71146345Shartivoid ArgArray_Done(ArgArray *);
72146345Sharti
73141104Shartichar *str_concat(const char *, const char *, int);
74146345Shartivoid brk_string(ArgArray *, const char [], Boolean);
75141104Shartichar *MAKEFLAGS_quote(const char *);
76146345Shartivoid MAKEFLAGS_break(ArgArray *, const char []);
77141104Shartiint Str_Match(const char *, const char *);
78141104Sharticonst char *Str_SYSVMatch(const char *, const char *, int *);
79141133Shartivoid Str_SYSVSubst(struct Buffer *, const char *, const char *, int);
80141104Sharti
81141104Sharti#endif /* str_h_44db59e6 */
82