2 Bacula® - The Network Backup Solution
4 Copyright (C) 2006-2014 Free Software Foundation Europe e.V.
6 The main author of Bacula is Kern Sibbald, with contributions from many
7 others, a complete list can be found in the file AUTHORS.
9 You may use this file and others of this release according to the
10 license defined in the LICENSE file, which includes the Affero General
11 Public License, v3.0 ("AGPLv3") and some additional permissions and
12 terms pursuant to its AGPLv3 Section 7.
14 Bacula® is a registered trademark of Kern Sibbald.
17 * Test program for testing regular expressions.
24 * If you define BACULA_REGEX, bregex will be built with the
25 * Bacula bregex library, which is the same code that we
26 * use on Win32, thus using Linux, you can test your Win32
27 * expressions. Otherwise, this program will link with the
28 * system library routines.
30 //#define BACULA_REGEX
41 "Usage: bregtest [-d debug_level] [-s] -f <data-file> -e /test/test2/\n"
42 " -f specify file of data to be matched\n"
43 " -e specify expression\n"
45 " -d <nn> set debug level to <nn>\n"
46 " -dt print timestamp in debug output\n"
47 " -? print this message.\n"
54 int main(int argc, char *const *argv)
63 setlocale(LC_ALL, "");
64 bindtextdomain("bacula", LOCALEDIR);
67 while ((ch = getopt(argc, argv, "sd:f:e:")) != -1) {
69 case 'd': /* set debug level */
73 debug_level = atoi(optarg);
74 if (debug_level <= 0) {
102 printf("A data file must be specified.\n");
107 printf("An expression must be specified.\n");
116 list = get_bregexps(expr);
119 printf("Can't use %s as 'sed' expression\n", expr);
123 fd = fopen(fname, "r");
125 printf(_("Could not open data file: %s\n"), fname);
129 while (fgets(data, sizeof(data)-1, fd)) {
130 strip_trailing_newline(data);
131 apply_bregexps(data, list, &p);
135 printf("%s => %s\n", data, p);
149 * test avec un sed et faire un diff
150 * test avec une boucle pour voir les fuites