OSDN Git Service

Change bug-gnu-utils@gcc.org to the mor obvious bug-binutils@gcc.org
[pf3gnuchains/pf3gnuchains3x.git] / binutils / windres.c
index 885cd51..d76f35e 100644 (file)
@@ -1,5 +1,5 @@
 /* windres.c -- a program to manipulate Windows resources
-   Copyright 1997, 1998, 1999 Free Software Foundation, Inc.
+   Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
 
    This file is part of GNU Binutils.
 #include <ctype.h>
 #include <time.h>
 
+/* used by resrc.c at least */
+
+int verbose = 0;
+
 /* An enumeration of format types.  */
 
 enum res_format
@@ -109,7 +113,9 @@ static struct include_dir *include_dirs;
 #define OPTION_INCLUDE_DIR (OPTION_HELP + 1)
 #define OPTION_LANGUAGE (OPTION_INCLUDE_DIR + 1)
 #define OPTION_PREPROCESSOR (OPTION_LANGUAGE + 1)
-#define OPTION_VERSION (OPTION_PREPROCESSOR + 1)
+#define OPTION_USE_TEMP_FILE (OPTION_PREPROCESSOR + 1)
+#define OPTION_NO_USE_TEMP_FILE (OPTION_USE_TEMP_FILE + 1)
+#define OPTION_VERSION (OPTION_NO_USE_TEMP_FILE + 1)
 #define OPTION_YYDEBUG (OPTION_VERSION + 1)
 
 static const struct option long_options[] =
@@ -122,6 +128,9 @@ static const struct option long_options[] =
   {"output-format", required_argument, 0, 'O'},
   {"preprocessor", required_argument, 0, OPTION_PREPROCESSOR},
   {"target", required_argument, 0, 'F'},
+  {"use-temp-file", no_argument, 0, OPTION_USE_TEMP_FILE},
+  {"no-use-temp-file", no_argument, 0, OPTION_NO_USE_TEMP_FILE},
+  {"verbose", no_argument, 0, 'v'},
   {"version", no_argument, 0, OPTION_VERSION},
   {"yydebug", no_argument, 0, OPTION_YYDEBUG},
   {0, no_argument, 0, 0}
@@ -590,7 +599,7 @@ format_from_name (name)
 
   if (m->name == NULL)
     {
-      fprintf (stderr, _("%s: unknown format type `%s'\n"), program_name, name);
+      non_fatal (_("unknown format type `%s'"), name);
       fprintf (stderr, _("%s: supported formats:"), program_name);
       for (m = format_names; m->name != NULL; m++)
        fprintf (stderr, " %s", m->name);
@@ -705,8 +714,13 @@ Options:\n\
   -F TARGET, --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\
-  --define SYM[=VAL]          Define SYM when preprocessing rc file\n\
-  --language VAL              Set language when reading rc file\n"));
+  -DSYM[=VAL], --define SYM[=VAL]\n\
+                              Define SYM when preprocessing rc file\n\
+  -v                          Verbose - tells you what it's doing\n\
+  --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"));
 #ifdef YYDEBUG
   fprintf (stream, _("\
   --yydebug                   Turn on parser debugging\n"));
@@ -720,7 +734,7 @@ extension if not specified.  A single file name is an input file.\n\
 No input-file is stdin, default rc.  No output-file is stdout, default rc.\n"));
   list_supported_targets (program_name, stream);
   if (status == 0)
-    fprintf (stream, _("Report bugs to bug-gnu-utils@gnu.org\n"));
+    fprintf (stream, _("Report bugs to %s\n"), REPORT_BUGS_TO);
   exit (status);
 }
 
@@ -770,6 +784,7 @@ main (argc, argv)
   const char *quotedarg;
   int language;
   struct res_directory *resources;
+  int use_temp_file;
 
 #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
   setlocale (LC_MESSAGES, "");
@@ -793,8 +808,9 @@ main (argc, argv)
   preprocessor = NULL;
   preprocargs = NULL;
   language = -1;
+  use_temp_file = 0;
 
-  while ((c = getopt_long (argc, argv, "i:o:I:O:F:D:", long_options,
+  while ((c = getopt_long (argc, argv, "i:o:I:O:F:D:v", long_options,
                           (int *) 0)) != EOF)
     {
       switch (c)
@@ -843,6 +859,10 @@ main (argc, argv)
            }
          break;
 
+       case 'v':
+         verbose ++;
+         break;
+
        case OPTION_INCLUDE_DIR:
          if (preprocargs == NULL)
            {
@@ -879,6 +899,14 @@ main (argc, argv)
          language = strtol (optarg, (char **) NULL, 16);
          break;
 
+       case OPTION_USE_TEMP_FILE:
+         use_temp_file = 1;
+         break;
+
+       case OPTION_NO_USE_TEMP_FILE:
+         use_temp_file = 0;
+         break;
+
 #ifdef YYDEBUG
        case OPTION_YYDEBUG:
          yydebug = 1;
@@ -938,7 +966,7 @@ main (argc, argv)
       abort ();
     case RES_FORMAT_RC:
       resources = read_rc_file (input_filename, preprocessor, preprocargs,
-                               language);
+                               language, use_temp_file);
       break;
     case RES_FORMAT_RES:
       resources = read_res_file (input_filename);