]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/regex/test/c_compiler_checks/posix_api_check.c
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / regex / test / c_compiler_checks / posix_api_check.c
1 /*
2 *
3 * Copyright (c) 1998-2002
4 * John Maddock
5 *
6 * Use, modification and distribution are subject to the
7 * Boost Software License, Version 1.0. (See accompanying file
8 * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 *
10 */
11
12 /*
13 * LOCATION: see http://www.boost.org for most recent version.
14 * FILE posix_api_compiler_check.c
15 * VERSION see <boost/version.hpp>
16 * DESCRIPTION: Verify that POSIX API calls compile: note this is a compile
17 * time check only.
18 */
19
20 #include <stdio.h>
21 #include <string.h>
22 #include <assert.h>
23 #include <boost/regex.h>
24
25 const char* expression = "^";
26 const char* text = "\n ";
27 regmatch_t matches[1];
28 int flags = REG_EXTENDED | REG_BASIC | REG_NOSPEC | REG_ICASE | REG_NOSUB |
29 REG_NEWLINE | REG_PEND | REG_NOCOLLATE | REG_ESCAPE_IN_LISTS |
30 REG_NEWLINE_ALT | REG_PERL | REG_AWK | REG_GREP | REG_EGREP;
31
32
33 int main()
34 {
35 regex_tA re;
36 int result;
37 result = regcompA(&re, expression, REG_AWK);
38 if(result > (int)REG_NOERROR)
39 {
40 char buf[256];
41 regerrorA(result, &re, buf, sizeof(buf));
42 printf(buf);
43 return result;
44 }
45 assert(re.re_nsub == 0);
46 matches[0].rm_so = 0;
47 matches[0].rm_eo = strlen(text);
48 result = regexecA(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND);
49 if(result > (int)REG_NOERROR)
50 {
51 char buf[256];
52 regerrorA(result, &re, buf, sizeof(buf));
53 printf(buf);
54 regfreeA(&re);
55 return result;
56 }
57 assert((matches[0].rm_so == matches[0].rm_eo) && (matches[0].rm_eo == 1));
58 regfreeA(&re);
59 printf("no errors found\n");
60 return 0;
61 }
62
63
64