lintian doesn't like orphan packages with uploaders...
[debian/amanda] / common-src / match.h
index 40b277cc5262989e38f3fa579457693fae0bb73a..5a2e7ddf0a7943d8b9b6dc2c11ab3977a1d2c590 100644 (file)
@@ -1,9 +1,10 @@
 /*
- * Copyright (c) 2010 Zmanda, Inc.  All Rights Reserved.
+ * Copyright (c) 2010-2012 Zmanda, Inc.  All Rights Reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  * Returns a statically allocated error message on failure or NULL on success. */
 char * validate_regexp(const char *regex);
 
-/* Match STR against POSIX regular expression REGEX by calling regexec.  This uses
- * the REG_NEWLINE flag, meaning that . does not match a newline and $ and ^ are
- * relative to lines as well as the beginning and end of STR. */
-int    match(const char *regex, const char *str);
+/*
+ * Match the string "str" against POSIX regex "regex" with regexec(), with
+ * REG_NEWLINE set (match_newline == TRUE) or not.
+ *
+ * REG_NEWLINE means two things:
+ * - the dot won't match a newline;
+ * - ^ and $ will match around \n in the input string (as well as the beginning
+ *   and end of the input).
+ */
+
+int do_match(const char *regex, const char *str, gboolean match_newline);
 
-/* Like match(), but without REG_NEWLINE, so a newline is treated like any other
- * character */
-int    match_no_newline(const char *regex, const char *str);
+#define match(regex, str) do_match(regex, str, TRUE)
+#define match_no_newline(regex, str) do_match(regex, str, FALSE)
 
 /* quote any non-alphanumeric characters in str, so that the result will only
  * match the original string.  If anchor is true, then add ^ and $ to make sure