/* Test for regexec.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002-2015 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2002.
Lesser General Public License for more details.
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. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
-#include <sys/types.h>
-#include <regex.h>
#include <locale.h>
#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <regex.h>
+
int
main (int argc, char *argv[])
regex_t re;
regmatch_t mat[10];
int i, j, ret = 0;
- char *locales[] = { "C", "de_DE.UTF-8" };
- char *string = "http://www.regex.com/pattern/matching.html#intro";
+ const char *locales[] = { "C", "de_DE.UTF-8" };
+ const char *string = "http://www.regex.com/pattern/matching.html#intro";
regmatch_t expect[10] = {
{ 0, 48 }, { 0, 5 }, { 0, 4 }, { 5, 20 }, { 7, 20 }, { 20, 42 },
{ -1, -1 }, { -1, -1 }, { 42, 48 }, { 43, 48 } };
"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?",
REG_EXTENDED) != REG_NOERROR)
{
- puts ("cannot compile expression \"[a-f]*\"");
+ puts ("cannot compile the regular expression");
ret = 1;
}
else if (regexec (&re, string, 10, mat, 0) == REG_NOMATCH)