OSDN Git Service

Rename -I to -J. Deprecate old use of -I, but leave it enabled for now.
authornickc <nickc>
Tue, 22 Apr 2003 17:31:08 +0000 (17:31 +0000)
committernickc <nickc>
Tue, 22 Apr 2003 17:31:08 +0000 (17:31 +0000)
binutils/ChangeLog
binutils/doc/binutils.texi
binutils/testsuite/ChangeLog
binutils/testsuite/binutils-all/windres/windres.exp
binutils/windres.c

index 66c0316..6bc473b 100644 (file)
@@ -1,3 +1,13 @@
+2003-04-22  Dimitrie O. Paun  <dpaun@rogers.com>
+
+       * windres.c (format_from_name): Make the exit on error
+       behaviour optional.
+       (main): Rename the -I option to -J. Introduce -I as a synonym
+       for --include-dir.  For backwards compatibility also support the
+       old -I behaviour, but issue a deprecation warning.
+       * doc/binutils.texi: Rename -I to -J.  Document the new behaviour
+       of the -I option.
+
 2003-04-22  Kazuhiro Inaoka  <inaoka.kazuhiro@renesas.com>
 
        * readelf.c: Replace references to Mitsubishi M32R with
index a0c797a..3de034a 100644 (file)
@@ -2577,7 +2577,7 @@ for the input file name, as the output file name.  If there is no
 non-option argument, then @command{windres} will write to standard output.
 @command{windres} can not write a COFF file to standard output.
 
-@item -I @var{format}
+@item -J @var{format}
 @itemx --input-format @var{format}
 The input format to read.  @var{format} may be @samp{res}, @samp{rc}, or
 @samp{coff}.  If no input format is specified, @command{windres} will
@@ -2605,11 +2605,17 @@ preprocessor first.  This option may be used to specify the preprocessor
 to use, including any leading arguments.  The default preprocessor
 argument is @code{gcc -E -xc-header -DRC_INVOKED}.
 
-@item --include-dir @var{directory}
+@item -I @var{directory}
+@itemx --include-dir @var{directory}
 Specify an include directory to use when reading an @code{rc} file.
 @command{windres} will pass this to the preprocessor as an @option{-I}
 option.  @command{windres} will also search this directory when looking for
-files named in the @code{rc} file.
+files named in the @code{rc} file.  If the argument passed to this command
+matches any of the supported @var{formats} (as descrived in the @option{-J} 
+option), it will issue a deprecation warning, and behave just like the
+@option{-J} option.  New programs should not use this behaviour.  If a
+directory happens to match a @var{format}, simple prefix it with @samp{./}
+to disable the backward compatibility.
 
 @item -D @var{target}
 @itemx --define @var{sym}[=@var{val}]
index de484f1..f69caef 100644 (file)
@@ -1,3 +1,8 @@
+2003-04-22  Dimitrie O. Paun  <dpaun@rogers.com>
+
+       * binutils-all/windres/windres.exp: Add test for the new -J
+       option.  Remove use of -I as it now generates a warning message.
+
 2003-04-03  Nick Clifton  <nickc@redhat.com>
 
        * binutils-all/windres/dialogid.rc: Replace "Static" with
index 858ce98..bd76178 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2001 Free Software Foundation, Inc.
+# Copyright 2001, 2003 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -81,8 +81,8 @@ foreach res $res_list {
        setup_xfail *-*
     }
 
-    verbose "$wr -I rc -O res $res tmpdir/$broot.res" 1
-    catch "exec $wr -I rc -O res $res tmpdir/$broot.res" err
+    verbose "$wr -J rc -O res $res tmpdir/$broot.res" 1
+    catch "exec $wr -J rc -O res $res tmpdir/$broot.res" err
 
     if ![string match "" $err] then {
        send_log "$err\n"
index 620ca0a..fbaaf1b 100644 (file)
@@ -106,8 +106,7 @@ static struct include_dir *include_dirs;
 
 /* 150 isn't special; it's just an arbitrary non-ASCII char value.  */
 
-#define OPTION_INCLUDE_DIR     150
-#define OPTION_PREPROCESSOR    (OPTION_INCLUDE_DIR + 1)
+#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)
@@ -116,8 +115,8 @@ static const struct option long_options[] =
 {
   {"define", required_argument, 0, 'D'},
   {"help", no_argument, 0, 'h'},
-  {"include-dir", required_argument, 0, OPTION_INCLUDE_DIR},
-  {"input-format", required_argument, 0, 'I'},
+  {"include-dir", required_argument, 0, 'I'},
+  {"input-format", required_argument, 0, 'J'},
   {"language", required_argument, 0, 'l'},
   {"output-format", required_argument, 0, 'O'},
   {"preprocessor", required_argument, 0, OPTION_PREPROCESSOR},
@@ -135,7 +134,7 @@ static const struct option long_options[] =
 
 static void res_init PARAMS ((void));
 static int extended_menuitems PARAMS ((const struct menuitem *));
-static enum res_format format_from_name PARAMS ((const char *));
+static enum res_format format_from_name PARAMS ((const char *, int));
 static enum res_format format_from_filename PARAMS ((const char *, int));
 static void usage PARAMS ((FILE *, int));
 static int cmp_res_entry PARAMS ((const PTR, const PTR));
@@ -583,8 +582,9 @@ extended_menuitems (menuitems)
 /* Convert a string to a format type, or exit if it can't be done.  */
 
 static enum res_format
-format_from_name (name)
+format_from_name (name, exit_on_error)
      const char *name;
+     int exit_on_error;
 {
   const struct format_map *m;
 
@@ -592,7 +592,7 @@ format_from_name (name)
     if (strcasecmp (m->name, name) == 0)
       break;
 
-  if (m->name == NULL)
+  if (m->name == NULL && exit_on_error)
     {
       non_fatal (_("unknown format type `%s'"), name);
       fprintf (stderr, _("%s: supported formats:"), program_name);
@@ -699,15 +699,15 @@ usage (stream, status)
   fprintf (stream, _(" The options are:\n\
   -i --input=<file>            Name input file\n\
   -o --output=<file>           Name output file\n\
-  -I --input-format=<format>   Specify input format\n\
+  -J --input-format=<format>   Specify input format\n\
   -O --output-format=<format>  Specify output format\n\
   -F --target=<target>         Specify COFF target\n\
      --preprocessor=<program>  Program to use to preprocess rc file\n\
-     --include-dir=<dir>       Include directory when preprocessing rc file\n\
+  -I --include-dir=<dir>       Include directory when preprocessing rc file\n\
   -D --define <sym>[=<val>]    Define SYM when preprocessing rc file\n\
   -U --undefine <sym>          Undefine SYM when preprocessing rc file\n\
   -v --verbose                 Verbose - tells you what it's doing\n\
-     --language=<val>          Set language when reading rc file\n\
+  -l --language=<val>          Set language when reading rc file\n\
      --use-temp-file           Use a temporary file instead of popen to read\n\
                                the preprocessor output\n\
      --no-use-temp-file        Use popen (default)\n"));
@@ -776,6 +776,7 @@ main (argc, argv)
   char *input_filename;
   char *output_filename;
   enum res_format input_format;
+  enum res_format input_format_tmp;
   enum res_format output_format;
   char *target;
   char *preprocessor;
@@ -812,7 +813,7 @@ main (argc, argv)
   language = 0x409;   /* LANG_ENGLISH, SUBLANG_ENGLISH_US.  */
   use_temp_file = 0;
 
-  while ((c = getopt_long (argc, argv, "i:l:o:I:O:F:D:U:rhHvV", long_options,
+  while ((c = getopt_long (argc, argv, "i:l:o:I:J:O:F:D:U:rhHvV", long_options,
                           (int *) 0)) != EOF)
     {
       switch (c)
@@ -825,12 +826,12 @@ main (argc, argv)
          output_filename = optarg;
          break;
 
-       case 'I':
-         input_format = format_from_name (optarg);
+       case 'J':
+         input_format = format_from_name (optarg, 1);
          break;
 
        case 'O':
-         output_format = format_from_name (optarg);
+         output_format = format_from_name (optarg, 1);
          break;
 
        case 'F':
@@ -869,7 +870,16 @@ main (argc, argv)
          verbose ++;
          break;
 
-       case OPTION_INCLUDE_DIR:
+       case 'I':
+         /* For backward compatibility, should be removed in the future.  */
+         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;
+           }
+         
          if (preprocargs == NULL)
            {
              quotedarg = quot (optarg);