PR binutils/11711

* windres.c (enum option_values): New enum.
        (long_options): Use separate option number for --include-dir
        option.
        (main): Separate backwards compatibility check from code to
        implement --include-dir.  Check to see if directory exists and do
        not complain if it does.
This commit is contained in:
Nick Clifton
2010-06-17 13:55:35 +00:00
parent 24df9a516a
commit 83bcb37903
2 changed files with 40 additions and 11 deletions

View File

@ -1,3 +1,13 @@
2010-06-17 Nick Clifton <nickc@redhat.com>
PR binutils/11711
* windres.c (enum option_values): New enum.
(long_options): Use separate option number for --include-dir
option.
(main): Separate backwards compatibility check from code to
implement --include-dir. Check to see if directory exists and do
not complain if it does.
2010-06-15 Joseph Myers <joseph@codesourcery.com> 2010-06-15 Joseph Myers <joseph@codesourcery.com>
* readelf.c (display_tic6x_attribute, process_tic6x_specific): * readelf.c (display_tic6x_attribute, process_tic6x_specific):

View File

@ -45,6 +45,7 @@
#include "safe-ctype.h" #include "safe-ctype.h"
#include "obstack.h" #include "obstack.h"
#include "windres.h" #include "windres.h"
#include <sys/stat.h>
/* Used by resrc.c at least. */ /* Used by resrc.c at least. */
@ -726,12 +727,15 @@ quot (const char *string)
/* Long options. */ /* Long options. */
/* 150 isn't special; it's just an arbitrary non-ASCII char value. */ enum option_values
{
#define OPTION_PREPROCESSOR 150 /* 150 isn't special; it's just an arbitrary non-ASCII char value. */
#define OPTION_USE_TEMP_FILE (OPTION_PREPROCESSOR + 1) OPTION_PREPROCESSOR = 150,
#define OPTION_NO_USE_TEMP_FILE (OPTION_USE_TEMP_FILE + 1) OPTION_USE_TEMP_FILE,
#define OPTION_YYDEBUG (OPTION_NO_USE_TEMP_FILE + 1) OPTION_NO_USE_TEMP_FILE,
OPTION_YYDEBUG,
OPTION_INCLUDE_DIR
};
static const struct option long_options[] = static const struct option long_options[] =
{ {
@ -741,7 +745,7 @@ static const struct option long_options[] =
{"output-format", required_argument, 0, 'O'}, {"output-format", required_argument, 0, 'O'},
{"target", required_argument, 0, 'F'}, {"target", required_argument, 0, 'F'},
{"preprocessor", required_argument, 0, OPTION_PREPROCESSOR}, {"preprocessor", required_argument, 0, OPTION_PREPROCESSOR},
{"include-dir", required_argument, 0, 'I'}, {"include-dir", required_argument, 0, OPTION_INCLUDE_DIR},
{"define", required_argument, 0, 'D'}, {"define", required_argument, 0, 'D'},
{"undefine", required_argument, 0, 'U'}, {"undefine", required_argument, 0, 'U'},
{"verbose", no_argument, 0, 'v'}, {"verbose", no_argument, 0, 'v'},
@ -917,13 +921,28 @@ main (int argc, char **argv)
/* For backward compatibility, should be removed in the future. */ /* For backward compatibility, should be removed in the future. */
input_format_tmp = format_from_name (optarg, 0); input_format_tmp = format_from_name (optarg, 0);
if (input_format_tmp != RES_FORMAT_UNKNOWN) if (input_format_tmp != RES_FORMAT_UNKNOWN)
{
struct stat statbuf;
char modebuf[11];
if (stat (optarg, & statbuf) == 0
/* Coded this way to avoid importing knowledge of S_ISDIR into this file. */
&& (mode_string (statbuf.st_mode, modebuf), modebuf[0] == 'd'))
/* We have a -I option with a directory name that just happens
to match a format name as well. eg: -I res Assume that the
user knows what they are doing and do not complain. */
;
else
{ {
fprintf (stderr, fprintf (stderr,
_("Option -I is deprecated for setting the input format, please use -J instead.\n")); _("Option -I is deprecated for setting the input format, please use -J instead.\n"));
input_format = input_format_tmp; input_format = input_format_tmp;
break; break;
} }
}
/* Fall through. */
case OPTION_INCLUDE_DIR:
if (preprocargs == NULL) if (preprocargs == NULL)
{ {
quotedarg = quot (optarg); quotedarg = quot (optarg);