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 Free Software Foundation, Inc. |
Copyright (C) 1990, 1998, 1999, 2001 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 |
22 |
|
|
23 |
#include <stdio.h> |
#include <stdio.h> |
24 |
#ifdef STDC_HEADERS |
#ifdef STDC_HEADERS |
25 |
|
# include <stdlib.h> |
26 |
# include <string.h> |
# include <string.h> |
27 |
#endif |
#endif |
28 |
|
|
39 |
|
|
40 |
#include "error.h" |
#include "error.h" |
41 |
#include "quotearg.h" |
#include "quotearg.h" |
42 |
|
#include "quote.h" |
43 |
|
|
44 |
/* When reporting an invalid argument, show nonprinting characters |
/* When reporting an invalid argument, show nonprinting characters |
45 |
by using the quoting style ARGMATCH_QUOTING_STYLE. Do not use |
by using the quoting style ARGMATCH_QUOTING_STYLE. Do not use |
158 |
argmatch_invalid (const char *context, const char *value, int problem) |
argmatch_invalid (const char *context, const char *value, int problem) |
159 |
{ |
{ |
160 |
char const *format = (problem == -1 |
char const *format = (problem == -1 |
161 |
? _("invalid argument %s for `%s'") |
? _("invalid argument %s for %s") |
162 |
: _("ambiguous argument %s for `%s'")); |
: _("ambiguous argument %s for %s")); |
163 |
|
|
164 |
error (0, 0, format, quotearg_style (ARGMATCH_QUOTING_STYLE, value), context); |
error (0, 0, format, quotearg_n_style (0, ARGMATCH_QUOTING_STYLE, value), |
165 |
|
quote_n (1, context)); |
166 |
} |
} |
167 |
|
|
168 |
/* List the valid arguments for argmatch. |
/* List the valid arguments for argmatch. |