Detabbed
[AROS.git] / rom / dos / parsepattern.c
blobfef98b4ca9f129a1cd1f8840952bde2d277c11e7
1 /*
2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
8 #include <proto/exec.h>
9 #include <dos/dos.h>
10 #include <dos/dosasl.h>
11 #include <dos/dosextens.h>
12 #include "dos_intern.h"
14 /*****************************************************************************
16 NAME */
17 #include <proto/dos.h>
19 AROS_LH3(LONG, ParsePattern,
21 /* SYNOPSIS */
22 AROS_LHA(CONST_STRPTR, Source, D1),
23 AROS_LHA(STRPTR, Dest, D2),
24 AROS_LHA(LONG, DestLength, D3),
26 /* LOCATION */
27 struct DosLibrary *, DOSBase, 140, Dos)
29 /* FUNCTION
30 Takes a pattern containing wildcards and transforms it into some
31 intermediate representation for use with the MatchPattern() function.
32 The intermediate representation is longer but generally a buffer
33 size of 2*(strlen(Source)+1) is enough. Nevertheless you should check
34 the returncode to be sure that everything went fine.
36 INPUTS
37 Source - Pattern describing the kind of strings that match.
38 Possible tokens are:
39 #x - The following character or item is repeaded 0 or
40 more times.
41 ? - Item matching a single non-NUL character.
42 a|b|c - Matches one of multiple strings.
43 ~x - This item matches if the item x doesn't match.
44 (a) - Parens
45 [a-z] - Matches a single character out of the set.
46 [~a-z] - Matches a single non-NUL character not in the set.
47 'c - Escapes the following character.
48 * - Same as #?, but optional.
49 Dest - Buffer for the destination.
50 DestLength - Size of the buffer.
52 RESULT
53 1 - There are wildcards in the pattern (it might match more than
54 one string).
55 0 - No wildcards in it, all went fine.
56 -1 - An error happened. IoErr() gives additional information in
57 that case.
59 NOTES
61 EXAMPLE
63 BUGS
65 SEE ALSO
67 INTERNALS
69 *****************************************************************************/
71 AROS_LIBFUNC_INIT
73 return patternParse(Source, Dest, DestLength, TRUE, DOSBase);
75 AROS_LIBFUNC_EXIT
76 } /* ParsePattern */