summaryrefslogtreecommitdiff
path: root/binutils/windres.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2010-06-17 13:55:35 +0000
committerNick Clifton <nickc@redhat.com>2010-06-17 13:55:35 +0000
commit08ac39ad45fd24258b614affba0e293ccb9815e2 (patch)
tree1239db2f2f804b3d9aefd0febc28816bb04ce02a /binutils/windres.c
parent7dc4345212dd6d2a57a3662892b6503caa14d159 (diff)
downloadbinutils-redhat-08ac39ad45fd24258b614affba0e293ccb9815e2.tar.gz
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.
Diffstat (limited to 'binutils/windres.c')
-rw-r--r--binutils/windres.c41
1 files changed, 30 insertions, 11 deletions
diff --git a/binutils/windres.c b/binutils/windres.c
index acc65f758f..05b7559f74 100644
--- a/binutils/windres.c
+++ b/binutils/windres.c
@@ -45,6 +45,7 @@
#include "safe-ctype.h"
#include "obstack.h"
#include "windres.h"
+#include <sys/stat.h>
/* Used by resrc.c at least. */
@@ -726,12 +727,15 @@ quot (const char *string)
/* Long options. */
-/* 150 isn't special; it's just an arbitrary non-ASCII char value. */
-
-#define OPTION_PREPROCESSOR 150
-#define OPTION_USE_TEMP_FILE (OPTION_PREPROCESSOR + 1)
-#define OPTION_NO_USE_TEMP_FILE (OPTION_USE_TEMP_FILE + 1)
-#define OPTION_YYDEBUG (OPTION_NO_USE_TEMP_FILE + 1)
+enum option_values
+{
+ /* 150 isn't special; it's just an arbitrary non-ASCII char value. */
+ OPTION_PREPROCESSOR = 150,
+ OPTION_USE_TEMP_FILE,
+ OPTION_NO_USE_TEMP_FILE,
+ OPTION_YYDEBUG,
+ OPTION_INCLUDE_DIR
+};
static const struct option long_options[] =
{
@@ -741,7 +745,7 @@ static const struct option long_options[] =
{"output-format", required_argument, 0, 'O'},
{"target", required_argument, 0, 'F'},
{"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'},
{"undefine", required_argument, 0, 'U'},
{"verbose", no_argument, 0, 'v'},
@@ -918,12 +922,27 @@ main (int argc, char **argv)
input_format_tmp = format_from_name (optarg, 0);
if (input_format_tmp != RES_FORMAT_UNKNOWN)
{
- fprintf (stderr,
- _("Option -I is deprecated for setting the input format, please use -J instead.\n"));
- input_format = input_format_tmp;
- break;
+ 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,
+ _("Option -I is deprecated for setting the input format, please use -J instead.\n"));
+ input_format = input_format_tmp;
+ break;
+ }
}
+ /* Fall through. */
+ case OPTION_INCLUDE_DIR:
if (preprocargs == NULL)
{
quotedarg = quot (optarg);