X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-exclude.c;h=bad283731f149f827cae0b206cba8b8af105c1ee;hb=533101a268dc5015a140ff4695d8eeb04fbe57b6;hp=c220e0b35b64d84793862d3e5651ac622f681d52;hpb=f28a2482feb7b5870dea9c7fb895622cdca5bd30;p=gnulib.git diff --git a/tests/test-exclude.c b/tests/test-exclude.c index c220e0b35..bad283731 100644 --- a/tests/test-exclude.c +++ b/tests/test-exclude.c @@ -1,5 +1,5 @@ /* Test suite for exclude. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2013 Free Software Foundation, Inc. This file is part of the GNUlib Library. This program is free software: you can redistribute it and/or modify @@ -60,6 +60,15 @@ int exclude_flags[] = { ARGMATCH_VERIFY (exclude_keywords, exclude_flags); +/* Some packages define ARGMATCH_DIE and ARGMATCH_DIE_DECL in , and + thus must link with a definition of that function. Provide it here. */ +#ifdef ARGMATCH_DIE_DECL + +_Noreturn ARGMATCH_DIE_DECL; +ARGMATCH_DIE_DECL { exit (1); } + +#endif + int main (int argc, char **argv) { @@ -75,30 +84,39 @@ main (int argc, char **argv) { char *opt = *++argv; if (opt[0] == '-') - { - int neg = 0; - int flag; - char *s = opt + 1; - - if (opt[1] == '-' && opt[2] == 0) - { - argc--; - break; - } - if (strlen (s) > 3 && memcmp (s, "no-", 3) == 0) - { - neg = 1; - s += 3; - } - flag = XARGMATCH (opt, s, exclude_keywords, exclude_flags); - if (neg) - exclude_options &= ~flag; - else - exclude_options |= flag; - } + { + int neg = 0; + int flag; + char *s = opt + 1; + + if (opt[1] == '-' && opt[2] == 0) + { + argc--; + break; + } + if (strlen (s) > 3 && memcmp (s, "no-", 3) == 0) + { + neg = 1; + s += 3; + } + flag = XARGMATCH (opt, s, exclude_keywords, exclude_flags); + if (neg) + exclude_options &= ~flag; + else + exclude_options |= flag; + + /* Skip this test if invoked with -leading-dir on a system that + lacks support for FNM_LEADING_DIR. */ + if (strcmp (s, "leading_dir") == 0 && FNM_LEADING_DIR == 0) + exit (77); + + /* Likewise for -casefold and FNM_CASEFOLD. */ + if (strcmp (s, "casefold") == 0 && FNM_CASEFOLD == 0) + exit (77); + } else if (add_exclude_file (add_exclude, exclude, opt, - exclude_options, '\n') != 0) - error (1, errno, "error loading %s", opt); + exclude_options, '\n') != 0) + error (1, errno, "error loading %s", opt); } for (; argc; --argc)