1 |
/* argmatch.c -- find a match for a string in an array |
/* argmatch.c -- find a match for a string in an array |
2 |
Copyright (C) 1990, 1998, 1999, 2001 Free Software Foundation, Inc. |
Copyright (C) 1990, 1998, 1999, 2001, 2002 Free Software Foundation, Inc. |
3 |
|
|
4 |
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
5 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
18 |
/* Written by David MacKenzie <djm@ai.mit.edu> |
/* Written by David MacKenzie <djm@ai.mit.edu> |
19 |
Modified by Akim Demaille <demaille@inf.enst.fr> */ |
Modified by Akim Demaille <demaille@inf.enst.fr> */ |
20 |
|
|
21 |
|
#if HAVE_CONFIG_H |
22 |
|
# include <config.h> |
23 |
|
#endif |
24 |
|
|
25 |
#include "argmatch.h" |
#include "argmatch.h" |
26 |
|
|
27 |
#include <stdio.h> |
#include <stdio.h> |
28 |
#ifdef STDC_HEADERS |
#include <stdlib.h> |
29 |
# include <stdlib.h> |
#include <string.h> |
|
# include <string.h> |
|
|
#endif |
|
|
|
|
|
#if HAVE_LOCALE_H |
|
|
# include <locale.h> |
|
|
#endif |
|
30 |
|
|
31 |
#if ENABLE_NLS |
#include "gettext.h" |
32 |
# include <libintl.h> |
#define _(msgid) gettext (msgid) |
|
# define _(Text) gettext (Text) |
|
|
#else |
|
|
# define _(Text) Text |
|
|
#endif |
|
33 |
|
|
34 |
#include "error.h" |
#include "error.h" |
35 |
#include "quotearg.h" |
#include "quotearg.h" |
36 |
#include "quote.h" |
#include "quote.h" |
37 |
|
#include "unlocked-io.h" |
38 |
|
|
39 |
/* When reporting an invalid argument, show nonprinting characters |
/* When reporting an invalid argument, show nonprinting characters |
40 |
by using the quoting style ARGMATCH_QUOTING_STYLE. Do not use |
by using the quoting style ARGMATCH_QUOTING_STYLE. Do not use |
43 |
# define ARGMATCH_QUOTING_STYLE locale_quoting_style |
# define ARGMATCH_QUOTING_STYLE locale_quoting_style |
44 |
#endif |
#endif |
45 |
|
|
|
/* The following test is to work around the gross typo in |
|
|
systems like Sony NEWS-OS Release 4.0C, whereby EXIT_FAILURE |
|
|
is defined to 0, not 1. */ |
|
|
#if !EXIT_FAILURE |
|
|
# undef EXIT_FAILURE |
|
|
# define EXIT_FAILURE 1 |
|
|
#endif |
|
|
|
|
46 |
/* Non failing version of argmatch call this function after failing. */ |
/* Non failing version of argmatch call this function after failing. */ |
47 |
#ifndef ARGMATCH_DIE |
#ifndef ARGMATCH_DIE |
48 |
# define ARGMATCH_DIE exit (EXIT_FAILURE) |
# define ARGMATCH_DIE exit (EXIT_FAILURE) |