1 /* Auxiliary program to test a DFA code path that cannot be triggered
3 Copyright 2014-2020 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3, or (at your option)
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
27 #include <localeinfo.h>
30 dfaerror (char const *mesg
)
32 printf ("dfaerror: %s\n", mesg
);
36 static int exit_status
= EXIT_SUCCESS
;
39 dfawarn (char const *mesg
)
41 printf ("dfawarn: %s\n", mesg
);
42 exit_status
= EXIT_FAILURE
;
46 main (int argc
, char **argv
)
51 struct localeinfo localeinfo
;
56 setlocale (LC_ALL
, "");
57 init_localeinfo (&localeinfo
);
60 dfasyntax (dfa
, &localeinfo
, RE_SYNTAX_GREP
| RE_NO_EMPTY_RANGES
, 0);
61 dfacomp (argv
[1], strlen (argv
[1]), dfa
, 0);
64 end
= argv
[2] + strlen (argv
[2]);
65 allow_nl
= argc
> 3 && atoi (argv
[3]);
67 p
= dfaexec (dfa
, beg
, end
, allow_nl
, NULL
, NULL
);
70 printf ("%zd\n", p
- beg
);