1 | /*
|
---|
2 | Unix SMB/CIFS implementation.
|
---|
3 | Samba utility functions
|
---|
4 |
|
---|
5 | Copyright (C) Andrew Tridgell 1992-2001
|
---|
6 | Copyright (C) Simo Sorce 2001-2002
|
---|
7 | Copyright (C) Martin Pool 2003
|
---|
8 | Copyright (C) James Peach 2005
|
---|
9 |
|
---|
10 | This program is free software; you can redistribute it and/or modify
|
---|
11 | it under the terms of the GNU General Public License as published by
|
---|
12 | the Free Software Foundation; either version 3 of the License, or
|
---|
13 | (at your option) any later version.
|
---|
14 |
|
---|
15 | This program is distributed in the hope that it will be useful,
|
---|
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
18 | GNU General Public License for more details.
|
---|
19 |
|
---|
20 | You should have received a copy of the GNU General Public License
|
---|
21 | along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
22 | */
|
---|
23 |
|
---|
24 | #ifndef _SAMBA_SUBSTITUTE_H_
|
---|
25 | #define _SAMBA_SUBSTITUTE_H_
|
---|
26 |
|
---|
27 | #include <talloc.h>
|
---|
28 |
|
---|
29 | /**
|
---|
30 | Substitute a string for a pattern in another string. Make sure there is
|
---|
31 | enough room!
|
---|
32 |
|
---|
33 | This routine looks for pattern in s and replaces it with
|
---|
34 | insert. It may do multiple replacements.
|
---|
35 |
|
---|
36 | Any of " ; ' $ or ` in the insert string are replaced with _
|
---|
37 | if len==0 then the string cannot be extended. This is different from the old
|
---|
38 | use of len==0 which was for no length checks to be done.
|
---|
39 | **/
|
---|
40 | void string_sub(char *s,const char *pattern, const char *insert, size_t len);
|
---|
41 |
|
---|
42 | void string_sub_once(char *s, const char *pattern,
|
---|
43 | const char *insert, size_t len);
|
---|
44 |
|
---|
45 | char *string_sub_talloc(TALLOC_CTX *mem_ctx, const char *s,
|
---|
46 | const char *pattern, const char *insert);
|
---|
47 |
|
---|
48 | /**
|
---|
49 | Similar to string_sub() but allows for any character to be substituted.
|
---|
50 | Use with caution!
|
---|
51 | if len==0 then the string cannot be extended. This is different from the old
|
---|
52 | use of len==0 which was for no length checks to be done.
|
---|
53 | **/
|
---|
54 | void all_string_sub(char *s,const char *pattern,const char *insert, size_t len);
|
---|
55 |
|
---|
56 | #endif /* _SAMBA_SUBSTITUTE_H_ */
|
---|