9330 stack overflow when creating a deeply nested dataset
[unleashed.git] / usr / src / man / man3c / re_comp.3c
blob510513d5c1065ca81ceb9af4f60d492daa468ede
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Portions Copyright (c) 1992, X/Open Company Limited.  All Rights Reserved.
44 .\" Copyright (c) 1996, Sun Microsystems, Inc. All Rights Reserved.
45 .\"
46 .TH RE_COMP 3C "Feb 26, 1997"
47 .SH NAME
48 re_comp, re_exec \- compile and execute regular expressions
49 .SH SYNOPSIS
50 .LP
51 .nf
52 #include <re_comp.h>
54 \fBchar *\fR\fBre_comp\fR(\fBconst char *\fR\fIstring\fR);
55 .fi
57 .LP
58 .nf
59 \fBint\fR \fBre_exec\fR(\fBconst char *\fR\fIstring\fR);
60 .fi
62 .SH DESCRIPTION
63 .sp
64 .LP
65 The \fBre_comp()\fR function converts a regular expression string (RE) into an
66 internal form suitable for pattern matching.  The \fBre_exec()\fR function
67 compares the string pointed to by the \fIstring\fR argument with the last
68 regular expression passed to \fBre_comp()\fR.
69 .sp
70 .LP
71 If \fBre_comp()\fR is called with a null pointer argument, the current regular
72 expression remains unchanged.
73 .sp
74 .LP
75 Strings passed to both \fBre_comp()\fR and \fBre_exec()\fR must be terminated
76 by a null byte, and may include \fBNEWLINE\fR characters.
77 .sp
78 .LP
79 The \fBre_comp()\fR and \fBre_exec()\fR functions support \fIsimple regular
80 expressions\fR, which are defined on the \fBregexp\fR(5) manual page. The
81 regular expressions of the form \fB\e{\fRm\fB\e}\fR, \fB\e{\fRm,\fB\e}\fR, or
82 \fB\e{\fRm,n\fB\e}\fR are not supported.
83 .SH RETURN VALUES
84 .sp
85 .LP
86 The \fBre_comp()\fR function returns a null pointer when the string pointed to
87 by the \fIstring\fR argument is successfully converted.  Otherwise, a pointer
88 to one of the following error message strings is returned:
89 .sp
90 .in +2
91 .nf
92 No previous regular expression
93 Regular expression too long
94 unmatched \e\|(
95 missing ]
96 too many \e\|(\|\e\|) pairs
97 unmatched \e\|)
98 .fi
99 .in -2
103 Upon successful completion, \fBre_exec()\fR returns \fB1\fR if \fIstring\fR
104 matches the last compiled regular expression.  Otherwise, \fBre_exec()\fR
105 returns \fB0\fR if \fIstring\fR fails to match the last compiled regular
106 expression, and \fB\(mi1\fR if the compiled regular expression is invalid
107 (indicating an internal error).
108 .SH ERRORS
111 No errors are defined.
112 .SH USAGE
115 For portability to implementations conforming to X/Open standards prior to SUS,
116 \fBregcomp\fR(3C) and \fBregexec\fR(3C) are preferred to these functions.  See
117 \fBstandards\fR(5).
118 .SH SEE ALSO
121 \fBgrep\fR(1), \fBregcmp\fR(1), \fBregcmp\fR(3C), \fBregcomp\fR(3C),
122 \fBregexec\fR(3C), \fBregexpr\fR(3GEN), \fBregexp\fR(5), \fBstandards\fR(5)