#endif
/*=============================================================*/
-/* */
-/* *** A l l S y s t e m s *** */
-/* */
+/* */
+/* *** A l l S y s t e m s *** */
+/* */
/*=============================================================*/
/*
#ifdef HAVE_LIBZ
if (ff_pkt->flags & FO_GZIP) {
if (stream == STREAM_WIN32_DATA) {
- stream = STREAM_WIN32_GZIP_DATA;
+ stream = STREAM_WIN32_GZIP_DATA;
} else if (stream == STREAM_FILE_DATA) {
- stream = STREAM_GZIP_DATA;
+ stream = STREAM_GZIP_DATA;
} else {
- stream = STREAM_SPARSE_GZIP_DATA;
+ stream = STREAM_SPARSE_GZIP_DATA;
}
}
#endif
struct stat *statp = &ff_pkt->statp;
/*
* Encode a stat packet. I should have done this more intelligently
- * with a length so that it could be easily expanded.
+ * with a length so that it could be easily expanded.
*/
p += to_base64((int64_t)statp->st_dev, p);
*p++ = ' '; /* separate fields with a space */
/* Do casting according to unknown type to keep compiler happy */
#if !HAVE_GCC & HAVE_SUN_OS
-#define plug(st, val) st = val /* brain damaged compiler */
+#define plug(st, val) st = val /* brain damaged compiler */
#else
template <class T> void plug(T &st, uint64_t val)
{ st = static_cast<T>(val); }
char *p = buf;
int64_t val;
- skip_nonspaces(&p); /* st_dev */
- p++; /* skip space */
- skip_nonspaces(&p); /* st_ino */
+ skip_nonspaces(&p); /* st_dev */
+ p++; /* skip space */
+ skip_nonspaces(&p); /* st_ino */
p++;
p += from_base64(&val, p);
- plug(statp->st_mode, val); /* st_mode */
+ plug(statp->st_mode, val); /* st_mode */
p++;
- skip_nonspaces(&p); /* st_nlink */
+ skip_nonspaces(&p); /* st_nlink */
p++;
- skip_nonspaces(&p); /* st_uid */
+ skip_nonspaces(&p); /* st_uid */
p++;
- skip_nonspaces(&p); /* st_gid */
+ skip_nonspaces(&p); /* st_gid */
p++;
- skip_nonspaces(&p); /* st_rdev */
+ skip_nonspaces(&p); /* st_rdev */
p++;
- skip_nonspaces(&p); /* st_size */
+ skip_nonspaces(&p); /* st_size */
p++;
- skip_nonspaces(&p); /* st_blksize */
+ skip_nonspaces(&p); /* st_blksize */
p++;
- skip_nonspaces(&p); /* st_blocks */
+ skip_nonspaces(&p); /* st_blocks */
p++;
- skip_nonspaces(&p); /* st_atime */
+ skip_nonspaces(&p); /* st_atime */
p++;
- skip_nonspaces(&p); /* st_mtime */
+ skip_nonspaces(&p); /* st_mtime */
p++;
- skip_nonspaces(&p); /* st_ctime */
+ skip_nonspaces(&p); /* st_ctime */
/* Optional FileIndex of hard linked file data */
if (*p == ' ' || (*p != 0 && *(p+1) == ' ')) {
* ofile is the output filename (may be in a different directory)
*
* Returns: true on success
- * false on failure
+ * false on failure
*/
bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
{
if (attr->stream == STREAM_UNIX_ATTRIBUTES_EX &&
set_win32_attributes(jcr, attr, ofd)) {
if (is_bopen(ofd)) {
- bclose(ofd);
+ bclose(ofd);
}
pm_strcpy(attr->ofname, "*none*");
return true;
if (attr->data_stream == STREAM_WIN32_DATA ||
attr->data_stream == STREAM_WIN32_GZIP_DATA) {
if (is_bopen(ofd)) {
- bclose(ofd);
+ bclose(ofd);
}
pm_strcpy(attr->ofname, "*none*");
return true;
if (is_bopen(ofd)) {
char ec1[50], ec2[50];
fsize = blseek(ofd, 0, SEEK_CUR);
- bclose(ofd); /* first close file */
- if (fsize > 0 && fsize != attr->statp.st_size) {
+ bclose(ofd); /* first close file */
+ if (fsize > 0 && fsize != (off_t)attr->statp.st_size) {
Jmsg3(jcr, M_ERROR, 0, _("File size of restored file %s not correct. Original %s, restored %s.\n"),
- attr->ofname, edit_uint64(attr->statp.st_size, ec1),
- edit_uint64(fsize, ec2));
+ attr->ofname, edit_uint64(attr->statp.st_size, ec1),
+ edit_uint64(fsize, ec2));
}
}
/* ***FIXME**** optimize -- don't do if already correct */
/*
* For link, change owner of link using lchown, but don't
- * try to do a chmod as that will update the file behind it.
+ * try to do a chmod as that will update the file behind it.
*/
if (attr->type == FT_LNK) {
/* Change owner of link, not of real file */
if (lchown(attr->ofname, attr->statp.st_uid, attr->statp.st_gid) < 0) {
- berrno be;
+ berrno be;
Jmsg2(jcr, M_ERROR, 0, _("Unable to set file owner %s: ERR=%s\n"),
- attr->ofname, be.strerror());
- ok = false;
+ attr->ofname, be.strerror());
+ ok = false;
}
} else {
if (chown(attr->ofname, attr->statp.st_uid, attr->statp.st_gid) < 0) {
- berrno be;
+ berrno be;
Jmsg2(jcr, M_ERROR, 0, _("Unable to set file owner %s: ERR=%s\n"),
- attr->ofname, be.strerror());
- ok = false;
+ attr->ofname, be.strerror());
+ ok = false;
}
if (chmod(attr->ofname, attr->statp.st_mode) < 0) {
- berrno be;
+ berrno be;
Jmsg2(jcr, M_ERROR, 0, _("Unable to set file modes %s: ERR=%s\n"),
- attr->ofname, be.strerror());
- ok = false;
+ attr->ofname, be.strerror());
+ ok = false;
}
/*
* Reset file times.
*/
if (utime(attr->ofname, &ut) < 0) {
- berrno be;
+ berrno be;
Jmsg2(jcr, M_ERROR, 0, _("Unable to set file times %s: ERR=%s\n"),
- attr->ofname, be.strerror());
- ok = false;
+ attr->ofname, be.strerror());
+ ok = false;
}
#ifdef HAVE_CHFLAGS
/*
* fail.
*/
if (chflags(attr->ofname, attr->statp.st_flags) < 0) {
- berrno be;
+ berrno be;
Jmsg2(jcr, M_ERROR, 0, _("Unable to set file flags %s: ERR=%s\n"),
- attr->ofname, be.strerror());
- ok = false;
+ attr->ofname, be.strerror());
+ ok = false;
}
#endif
}
/*=============================================================*/
-/* */
-/* * * * U n i x * * * * */
-/* */
+/* */
+/* * * * U n i x * * * * */
+/* */
/*=============================================================*/
#if !defined(HAVE_CYGWIN) && !defined(HAVE_WIN32)
* here. They must be "self-contained" (i.e. you keep track
* of your own length), and they must be in ASCII string
* format. Using this feature is not recommended.
- * The code below shows how to return nothing. See the Win32
+ * The code below shows how to return nothing. See the Win32
* code below for returning something in the attributes.
*/
int encode_attribsEx(JCR *jcr, char *attribsEx, FF_PKT *ff_pkt)
}
*p = 0;
#else
- *attribsEx = 0; /* no extended attributes */
+ *attribsEx = 0; /* no extended attributes */
#endif
return STREAM_UNIX_ATTRIBUTES;
}
/*=============================================================*/
-/* */
-/* * * * W i n 3 2 * * * * */
-/* */
+/* */
+/* * * * W i n 3 2 * * * * */
+/* */
/*=============================================================*/
#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32)
WIN32_FILE_ATTRIBUTE_DATA atts;
ULARGE_INTEGER li;
- attribsEx[0] = 0; /* no extended attributes */
+ attribsEx[0] = 0; /* no extended attributes */
#if USE_WIN32_UNICODE
if (!p_GetFileAttributesExW)
UTF8_2_wchar(szBuf, ff_pkt->sys_fname, MAX_PATH_UNICODE);
if (!p_GetFileAttributesExW(szBuf, GetFileExInfoStandard,
- (LPVOID)&atts)) {
+ (LPVOID)&atts)) {
win_error(jcr, "GetFileAttributesExW:", ff_pkt->sys_fname);
return STREAM_UNIX_ATTRIBUTES;
}
unix_name_to_win32(&ff_pkt->sys_fname, ff_pkt->fname);
if (!p_GetFileAttributesExA(ff_pkt->sys_fname, GetFileExInfoStandard,
- (LPVOID)&atts)) {
+ (LPVOID)&atts)) {
win_error(jcr, "GetFileAttributesExA:", ff_pkt->sys_fname);
return STREAM_UNIX_ATTRIBUTES;
}
FILE_ATTRIBUTE_OFFLINE| \
FILE_ATTRIBUTE_READONLY| \
FILE_ATTRIBUTE_SYSTEM| \
- FILE_ATTRIBUTE_TEMPORARY)
+ FILE_ATTRIBUTE_TEMPORARY)
/*
* ofile is the output filename (may be in a different directory)
*
* Returns: true on success
- * false on failure
+ * false on failure
*/
static bool set_win32_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
{
if (!p_GetFileAttributesExW)
return false;
#else
- if (!p_GetFileAttributesExA)
+ if (!p_GetFileAttributesExA)
return false;
#endif
- if (!p || !*p) { /* we should have attributes */
+ if (!p || !*p) { /* we should have attributes */
Dmsg2(100, "Attributes missing. of=%s ofd=%d\n", attr->ofname, ofd->fid);
if (is_bopen(ofd)) {
- bclose(ofd);
+ bclose(ofd);
}
return false;
} else {
p += from_base64(&val, p);
plug(atts.dwFileAttributes, val);
- p++; /* skip space */
+ p++; /* skip space */
p += from_base64(&val, p);
li.QuadPart = val;
atts.ftCreationTime.dwLowDateTime = li.LowPart;
atts.ftCreationTime.dwHighDateTime = li.HighPart;
- p++; /* skip space */
+ p++; /* skip space */
p += from_base64(&val, p);
li.QuadPart = val;
atts.ftLastAccessTime.dwLowDateTime = li.LowPart;
atts.ftLastAccessTime.dwHighDateTime = li.HighPart;
- p++; /* skip space */
+ p++; /* skip space */
p += from_base64(&val, p);
li.QuadPart = val;
atts.ftLastWriteTime.dwLowDateTime = li.LowPart;
if (!is_bopen(ofd)) {
Dmsg1(100, "File not open: %s\n", attr->ofname);
- bopen(ofd, attr->ofname, O_WRONLY|O_BINARY, 0); /* attempt to open the file */
+ bopen(ofd, attr->ofname, O_WRONLY|O_BINARY, 0); /* attempt to open the file */
}
if (is_bopen(ofd)) {
Dmsg1(100, "SetFileTime %s\n", attr->ofname);
if (!SetFileTime(bget_handle(ofd),
- &atts.ftCreationTime,
- &atts.ftLastAccessTime,
- &atts.ftLastWriteTime)) {
+ &atts.ftCreationTime,
+ &atts.ftLastAccessTime,
+ &atts.ftLastWriteTime)) {
win_error(jcr, "SetFileTime:", win32_ofile);
}
bclose(ofd);
DWORD lerror = GetLastError();
LPTSTR msg;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|
- FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
- lerror,
- 0,
- (LPTSTR)&msg,
- 0,
- NULL);
+ FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ lerror,
+ 0,
+ (LPTSTR)&msg,
+ 0,
+ NULL);
Dmsg3(100, "Error in %s on file %s: ERR=%s\n", prefix, win32_ofile, msg);
strip_trailing_junk(msg);
Jmsg(jcr, M_ERROR, 0, _("Error in %s file %s: ERR=%s\n"), prefix, win32_ofile, msg);
{
LPTSTR msg;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|
- FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
- lerror,
- 0,
- (LPTSTR)&msg,
- 0,
- NULL);
+ FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ lerror,
+ 0,
+ (LPTSTR)&msg,
+ 0,
+ NULL);
strip_trailing_junk(msg);
if (jcr) {
Jmsg2(jcr, M_ERROR, 0, _("Error in %s: ERR=%s\n"), prefix, msg);
cygwin_conv_to_win32_path(name, *win32_name);
}
-#endif /* HAVE_CYGWIN */
+#endif /* HAVE_CYGWIN */
/* Definitions for data structures and routines for the regular
- expression library, version 0.12.
- Copyright (C) 1985,1989-1993,1995-1998, 2000 Free Software Foundation, Inc.
-
- This file is part of the GNU C Library. Its master source is NOT part of
- the C library, however. The master source lives in /gd/gnu/lib.
+ expression library.
+ Copyright (C) 1985,1989-93,1995-98,2000,2001,2002,2003
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
+ Lesser General Public License for more details.
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#ifndef _REGEX_H
#define _REGEX_H 1
+#include <sys/types.h>
+
/* Allow the use in C++ code. */
#ifdef __cplusplus
extern "C" {
this bit set, and it won't affect anything in the normal case. */
#define RE_DEBUG (RE_NO_GNU_OPS << 1)
+/* If this bit is set, a syntactically invalid interval is treated as
+ a string of ordinary characters. For example, the ERE 'a{1' is
+ treated as 'a\{1'. */
+#define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1)
+
+/* If this bit is set, then ignore case when matching.
+ If not set, then case is significant. */
+#define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1)
+
+/* This bit is used internally like RE_CONTEXT_INDEP_ANCHORS but only
+ for ^, because it is difficult to scan the regex backwards to find
+ whether ^ should be special. */
+#define RE_CARET_ANCHORS_HERE (RE_ICASE << 1)
+
+/* If this bit is set, then \{ cannot be first in an bre or
+ immediately after an alternation or begin-group operator. */
+#define RE_CONTEXT_INVALID_DUP (RE_CARET_ANCHORS_HERE << 1)
+
+/* If this bit is set, then no_sub will be set to 1 during
+ re_compile_pattern. */
+#define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1)
+
/* This global variable defines the particular regexp syntax to use (for
some interfaces). When a regexp is compiled, the syntax used is
stored in the pattern buffer, so changing this does not affect
already-compiled regexps. */
extern reg_syntax_t re_syntax_options;
-
+\f
/* Define combinations of the above bits for the standard possibilities.
(The [[[ comments delimit what gets put into the Texinfo file, so
don't delete them!) */
/* [[[begin syntaxes]]] */
#define RE_SYNTAX_EMACS 0
-#define RE_SYNTAX_AWK \
- (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
- | RE_NO_BK_PARENS | RE_NO_BK_REFS \
- | RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
- | RE_DOT_NEWLINE | RE_CONTEXT_INDEP_ANCHORS \
+#define RE_SYNTAX_AWK \
+ (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
+ | RE_NO_BK_PARENS | RE_NO_BK_REFS \
+ | RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
+ | RE_DOT_NEWLINE | RE_CONTEXT_INDEP_ANCHORS \
| RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS)
-#define RE_SYNTAX_GNU_AWK \
- ((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG) \
- & ~(RE_DOT_NOT_NULL | RE_INTERVALS | RE_CONTEXT_INDEP_OPS))
+#define RE_SYNTAX_GNU_AWK \
+ ((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG) \
+ & ~(RE_DOT_NOT_NULL | RE_INTERVALS | RE_CONTEXT_INDEP_OPS \
+ | RE_CONTEXT_INVALID_OPS ))
-#define RE_SYNTAX_POSIX_AWK \
- (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \
- | RE_INTERVALS | RE_NO_GNU_OPS)
+#define RE_SYNTAX_POSIX_AWK \
+ (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \
+ | RE_INTERVALS | RE_NO_GNU_OPS)
-#define RE_SYNTAX_GREP \
- (RE_BK_PLUS_QM | RE_CHAR_CLASSES \
- | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \
+#define RE_SYNTAX_GREP \
+ (RE_BK_PLUS_QM | RE_CHAR_CLASSES \
+ | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \
| RE_NEWLINE_ALT)
-#define RE_SYNTAX_EGREP \
- (RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \
- | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \
- | RE_NEWLINE_ALT | RE_NO_BK_PARENS \
+#define RE_SYNTAX_EGREP \
+ (RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \
+ | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \
+ | RE_NEWLINE_ALT | RE_NO_BK_PARENS \
| RE_NO_BK_VBAR)
-#define RE_SYNTAX_POSIX_EGREP \
- (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES)
+#define RE_SYNTAX_POSIX_EGREP \
+ (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES \
+ | RE_INVALID_INTERVAL_ORD)
/* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */
#define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC
#define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC
/* Syntax bits common to both basic and extended POSIX regex syntax. */
-#define _RE_SYNTAX_POSIX_COMMON \
- (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \
+#define _RE_SYNTAX_POSIX_COMMON \
+ (RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \
| RE_INTERVALS | RE_NO_EMPTY_RANGES)
-#define RE_SYNTAX_POSIX_BASIC \
- (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM)
+#define RE_SYNTAX_POSIX_BASIC \
+ (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM | RE_CONTEXT_INVALID_DUP)
/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this
isn't minimal, since other operators, such as \`, aren't disabled. */
-#define RE_SYNTAX_POSIX_MINIMAL_BASIC \
+#define RE_SYNTAX_POSIX_MINIMAL_BASIC \
(_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)
-#define RE_SYNTAX_POSIX_EXTENDED \
- (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
- | RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \
- | RE_NO_BK_PARENS | RE_NO_BK_VBAR \
+#define RE_SYNTAX_POSIX_EXTENDED \
+ (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
+ | RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \
+ | RE_NO_BK_PARENS | RE_NO_BK_VBAR \
| RE_CONTEXT_INVALID_OPS | RE_UNMATCHED_RIGHT_PAREN_ORD)
/* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INDEP_OPS is
removed and RE_NO_BK_REFS is added. */
-#define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \
- (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
- | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \
- | RE_NO_BK_PARENS | RE_NO_BK_REFS \
- | RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD)
+#define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \
+ (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
+ | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \
+ | RE_NO_BK_PARENS | RE_NO_BK_REFS \
+ | RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD)
/* [[[end syntaxes]]] */
-
+\f
/* Maximum number of duplicates an interval can allow. Some systems
(erroneously) define this in other header files, but we want our
value, so remove any previous define. */
/* Like REG_NOTBOL, except for the end-of-line. */
#define REG_NOTEOL (1 << 1)
+/* Use PMATCH[0] to delimit the start and end of the search in the
+ buffer. */
+#define REG_STARTEND (1 << 2)
+
/* If any error codes are removed, changed, or added, update the
`re_error_msg' table in regex.c. */
typedef enum
{
#ifdef _XOPEN_SOURCE
- REG_ENOSYS = -1, /* This will never happen for this implementation. */
+ REG_ENOSYS = -1, /* This will never happen for this implementation. */
#endif
- REG_NOERROR = 0, /* Success. */
- REG_NOMATCH, /* Didn't find a match (for regexec). */
+ REG_NOERROR = 0, /* Success. */
+ REG_NOMATCH, /* Didn't find a match (for regexec). */
/* POSIX regcomp return error codes. (In the order listed in the
standard.) */
- REG_BADPAT, /* Invalid pattern. */
- REG_ECOLLATE, /* Not implemented. */
- REG_ECTYPE, /* Invalid character class name. */
- REG_EESCAPE, /* Trailing backslash. */
- REG_ESUBREG, /* Invalid back reference. */
- REG_EBRACK, /* Unmatched left bracket. */
- REG_EPAREN, /* Parenthesis imbalance. */
- REG_EBRACE, /* Unmatched \{. */
- REG_BADBR, /* Invalid contents of \{\}. */
- REG_ERANGE, /* Invalid range end. */
- REG_ESPACE, /* Ran out of memory. */
- REG_BADRPT, /* No preceding re for repetition op. */
+ REG_BADPAT, /* Invalid pattern. */
+ REG_ECOLLATE, /* Inalid collating element. */
+ REG_ECTYPE, /* Invalid character class name. */
+ REG_EESCAPE, /* Trailing backslash. */
+ REG_ESUBREG, /* Invalid back reference. */
+ REG_EBRACK, /* Unmatched left bracket. */
+ REG_EPAREN, /* Parenthesis imbalance. */
+ REG_EBRACE, /* Unmatched \{. */
+ REG_BADBR, /* Invalid contents of \{\}. */
+ REG_ERANGE, /* Invalid range end. */
+ REG_ESPACE, /* Ran out of memory. */
+ REG_BADRPT, /* No preceding re for repetition op. */
/* Error codes we've added. */
- REG_EEND, /* Premature end. */
- REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */
- REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */
+ REG_EEND, /* Premature end. */
+ REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */
+ REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */
} reg_errcode_t;
-
+\f
/* This data structure represents a compiled pattern. Before calling
the pattern compiler, the fields `buffer', `allocated', `fastmap',
`translate', and `no_sub' can be set. After the pattern has been
struct re_pattern_buffer
{
/* [[[begin pattern_buffer]]] */
- /* Space that holds the compiled pattern. It is declared as
+ /* Space that holds the compiled pattern. It is declared as
`unsigned char *' because its elements are
sometimes used as array indexes. */
unsigned char *buffer;
- /* Number of bytes to which `buffer' points. */
+ /* Number of bytes to which `buffer' points. */
unsigned long int allocated;
- /* Number of bytes actually used in `buffer'. */
+ /* Number of bytes actually used in `buffer'. */
unsigned long int used;
/* Syntax setting with which the pattern was compiled. */
when it is matched. */
RE_TRANSLATE_TYPE translate;
- /* Number of subexpressions found by the compiler. */
+ /* Number of subexpressions found by the compiler. */
size_t re_nsub;
/* Zero if this pattern cannot match the empty string, one else.
/* [[[end pattern_buffer]]] */
};
-typedef struct re_pattern_buffer bregex_t;
-
+typedef struct re_pattern_buffer regex_t;
+\f
/* Type for byte offsets within the string. POSIX mandates this. */
typedef int regoff_t;
regoff_t rm_so; /* Byte offset from string's start to substring's start. */
regoff_t rm_eo; /* Byte offset from string's start to substring's end. */
} regmatch_t;
-
+\f
/* Declarations for routines. */
/* To avoid duplicating every routine declaration -- once with a
# endif
#endif
+/* GCC 2.95 and later have "__restrict"; C99 compilers have
+ "restrict", and "configure" may have defined "restrict". */
+#ifndef __restrict
+# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__))
+# if defined restrict || 199901L <= __STDC_VERSION__
+# define __restrict restrict
+# else
+# define __restrict
+# endif
+# endif
+#endif
+/* gcc 3.1 and up support the [restrict] syntax. */
+#ifndef __restrict_arr
+# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
+# define __restrict_arr __restrict
+# else
+# define __restrict_arr
+# endif
+#endif
+
/* POSIX compatibility. */
-extern int regcomp _RE_ARGS ((regex_t *__preg, const char *__pattern,
- int __cflags));
+extern int regcomp _RE_ARGS ((regex_t *__restrict __preg,
+ const char *__restrict __pattern,
+ int __cflags));
-extern int regexec _RE_ARGS ((const regex_t *__preg,
- const char *__string, size_t __nmatch,
- regmatch_t __pmatch[], int __eflags));
+extern int regexec _RE_ARGS ((const regex_t *__restrict __preg,
+ const char *__restrict __string, size_t __nmatch,
+ regmatch_t __pmatch[__restrict_arr],
+ int __eflags));
extern size_t regerror _RE_ARGS ((int __errcode, const regex_t *__preg,
- char *__errbuf, size_t __errbuf_size));
+ char *__errbuf, size_t __errbuf_size));
extern void regfree _RE_ARGS ((regex_t *__preg));
#ifdef __cplusplus
}
-#endif /* C++ */
+#endif /* C++ */
#endif /* regex.h */
-
+\f
/*
Local variables:
make-backup-files: t