2000-09-26 11:48:28 +00:00
|
|
|
/*
|
|
|
|
*
|
2002-04-24 10:50:23 +00:00
|
|
|
* Copyright (c) 1998-2002
|
2000-09-26 11:48:28 +00:00
|
|
|
* Dr John Maddock
|
|
|
|
*
|
2003-10-04 11:29:20 +00:00
|
|
|
* Use, modification and distribution are subject to the
|
2003-09-30 13:02:51 +00:00
|
|
|
* Boost Software License, Version 1.0. (See accompanying file
|
|
|
|
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
2000-09-26 11:48:28 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* LOCATION: see http://www.boost.org for most recent version.
|
|
|
|
* FILE posix_api_compiler_check.c
|
2001-09-30 10:30:14 +00:00
|
|
|
* VERSION see <boost/version.hpp>
|
2000-09-26 11:48:28 +00:00
|
|
|
* DESCRIPTION: Verify that POSIX API calls compile: note this is a compile
|
|
|
|
* time check only.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
2005-01-18 12:51:26 +00:00
|
|
|
#include <boost/assert.hpp>
|
2000-09-26 11:48:28 +00:00
|
|
|
#include <boost/regex.h>
|
|
|
|
|
|
|
|
const char* expression = "^";
|
|
|
|
const char* text = "\n ";
|
|
|
|
regmatch_t matches[1];
|
|
|
|
int flags = REG_EXTENDED | REG_BASIC | REG_NOSPEC | REG_ICASE | REG_NOSUB |
|
|
|
|
REG_NEWLINE | REG_PEND | REG_NOCOLLATE | REG_ESCAPE_IN_LISTS |
|
|
|
|
REG_NEWLINE_ALT | REG_PERL | REG_AWK | REG_GREP | REG_EGREP;
|
|
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
regex_t re;
|
|
|
|
int result;
|
|
|
|
result = regcomp(&re, expression, REG_AWK);
|
|
|
|
if(result > REG_NOERROR)
|
|
|
|
{
|
|
|
|
char buf[256];
|
|
|
|
regerror(result, &re, buf, sizeof(buf));
|
|
|
|
printf(buf);
|
|
|
|
return result;
|
|
|
|
}
|
2005-01-18 12:51:26 +00:00
|
|
|
BOOST_ASSERT(re.re_nsub == 0);
|
2000-09-26 11:48:28 +00:00
|
|
|
matches[0].rm_so = 0;
|
|
|
|
matches[0].rm_eo = strlen(text);
|
|
|
|
result = regexec(&re, text, 1, matches, REG_NOTBOL | REG_NOTEOL | REG_STARTEND);
|
|
|
|
if(result > REG_NOERROR)
|
|
|
|
{
|
|
|
|
char buf[256];
|
|
|
|
regerror(result, &re, buf, sizeof(buf));
|
|
|
|
printf(buf);
|
|
|
|
regfree(&re);
|
|
|
|
return result;
|
|
|
|
}
|
2005-01-18 12:51:26 +00:00
|
|
|
BOOST_ASSERT(matches[0].rm_so == matches[0].rm_eo == 1);
|
2000-09-26 11:48:28 +00:00
|
|
|
regfree(&re);
|
2001-12-09 12:50:46 +00:00
|
|
|
printf("no errors found\n");
|
2000-09-26 11:48:28 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2001-12-09 12:50:46 +00:00
|
|
|
|
2002-04-24 10:50:23 +00:00
|
|
|
|
2003-09-30 13:02:51 +00:00
|
|
|
|