PageRenderTime 46ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/amanda/tags/3_1_0_mac01/common-src/match.h

#
C Header | 62 lines | 18 code | 18 blank | 26 comment | 0 complexity | 3ea7d3435b66e09d44938f58fe752b56 MD5 | raw file
  1. /*
  2. * Copyright (c) 2010 Zmanda, Inc. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms of the GNU General Public License version 2 as published
  6. * by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  10. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  11. * for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License along
  14. * with this program; if not, write to the Free Software Foundation, Inc.,
  15. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. *
  17. * Contact information: Zmanda Inc., 465 S. Mathilda Ave., Suite 300
  18. * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
  19. */
  20. #ifndef MATCH_H
  21. #define MATCH_H
  22. #include <glib.h>
  23. char * validate_regexp(const char *regex);
  24. /* quote any non-alphanumeric characters in str, so that the result will only
  25. * match the original string. If anchor is true, then add ^ and $ to make sure
  26. * that substrings will not match. Note that the resulting regular expression
  27. * will not work with match_host, match_disk, etc., since those do not technically
  28. * support quoting metacharacters */
  29. char * clean_regex(const char *str, gboolean anchor);
  30. /* Make an Amanda host expression that will match the given string exactly. */
  31. char * make_exact_host_expression(const char *host);
  32. /* Make an Amanda disk expression that will match the given string exactly. */
  33. char * make_exact_disk_expression(const char *disk);
  34. int match(const char *regex, const char *str);
  35. int match_no_newline(const char *regex, const char *str);
  36. char * validate_glob(const char *glob);
  37. char * glob_to_regex(const char *glob);
  38. int match_glob(const char *glob, const char *str);
  39. int match_tar(const char *glob, const char *str);
  40. int match_host(const char *glob, const char *host);
  41. int match_datestamp(const char *dateexp, const char *datestamp);
  42. int match_level(const char *levelexp, const char *level);
  43. int match_disk(const char *glob, const char *disk);
  44. #endif /* MATCH_H */