* Makefile.am: Add LIBICONV to windres.
[deliverable/binutils-gdb.git] / binutils / dllwrap.c
index 4b53511e66e47ba9d16489a87d8fc66ca181ae57..9828a958a73cbabf69a0c7975d1d096f253dc561 100644 (file)
@@ -1,5 +1,6 @@
 /* dllwrap.c -- wrapper for DLLTOOL and GCC to generate PE style DLLs
-   Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
+   Free Software Foundation, Inc.
    Contributed by Mumit Khan (khan@xraylith.wisc.edu).
 
    This file is part of GNU Binutils.
@@ -16,8 +17,8 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+   02110-1301, USA.  */
 
 /* AIX requires this to be the first thing in the file.  */
 #ifndef __GNUC__
 #endif
 #endif
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
+#include "sysdep.h"
 #include "bfd.h"
 #include "libiberty.h"
-#include "bucomm.h"
 #include "getopt.h"
 #include "dyn-string.h"
+#include "bucomm.h"
 
 #include <time.h>
 #include <sys/stat.h>
 
-#ifdef ANSI_PROTOTYPES
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
 #ifdef HAVE_SYS_WAIT_H
 #include <sys/wait.h>
 #else /* ! HAVE_SYS_WAIT_H */
@@ -118,9 +110,9 @@ static int run (const char *, char *);
 static char *mybasename (const char *);
 static int strhash (const char *);
 static void usage (FILE *, int);
-static void display (const char *, va_list);
-static void inform (const char *, ...);
-static void warn (const char *, ...);
+static void display (const char *, va_list) ATTRIBUTE_PRINTF(1,0);
+static void inform (const char *, ...) ATTRIBUTE_PRINTF_1;
+static void warn (const char *, ...) ATTRIBUTE_PRINTF_1;
 static char *look_for_prog (const char *, const char *, int);
 static char *deduce_name (const char *);
 static void delete_temp_files (void);
@@ -253,7 +245,7 @@ deduce_name (const char * name)
 
   dash = NULL;
   slash = NULL;
-  for (cp = name; *cp != '\0'; ++cp)
+  for (cp = prog_name; *cp != '\0'; ++cp)
     {
       if (*cp == '-')
        dash = cp;
@@ -272,17 +264,17 @@ deduce_name (const char * name)
   cmd = NULL;
 
   if (dash != NULL)
-    /* First, try looking for a prefixed PROG_NAME in the
-       PROGRAM_NAME directory, with the same prefix as PROGRAM_NAME.  */
-    cmd = look_for_prog (name, name, dash - name + 1);
+    /* First, try looking for a prefixed NAME in the
+       PROG_NAME directory, with the same prefix as PROG_NAME.  */
+    cmd = look_for_prog (name, prog_name, dash - prog_name + 1);
 
   if (slash != NULL && cmd == NULL)
-    /* Next, try looking for a PROG_NAME in the same directory as
+    /* Next, try looking for a NAME in the same directory as
        that of this program.  */
-    cmd = look_for_prog (name, name, slash - name + 1);
+    cmd = look_for_prog (name, prog_name, slash - prog_name + 1);
 
   if (cmd == NULL)
-    /* Just return PROG_NAME as is.  */
+    /* Just return NAME as is.  */
     cmd = xstrdup (name);
 
   return cmd;
@@ -478,6 +470,7 @@ usage (FILE *file, int status)
 {
   fprintf (file, _("Usage %s <option(s)> <object-file(s)>\n"), prog_name);
   fprintf (file, _("  Generic options:\n"));
+  fprintf (file, _("   @<file>                Read options from <file>\n"));    
   fprintf (file, _("   --quiet, -q            Work quietly\n"));
   fprintf (file, _("   --verbose, -v          Verbose\n"));
   fprintf (file, _("   --version              Print dllwrap version\n"));
@@ -513,6 +506,8 @@ usage (FILE *file, int status)
   fprintf (file, _("   --nodelete             Keep temp files.\n"));
   fprintf (file, _("  Rest are passed unmodified to the language driver\n"));
   fprintf (file, "\n\n");
+  if (REPORT_BUGS_TO[0] && status == 0)
+    fprintf (file, _("Report bugs to %s\n"), REPORT_BUGS_TO);
   exit (status);
 }
 
@@ -632,6 +627,8 @@ main (int argc, char **argv)
   bindtextdomain (PACKAGE, LOCALEDIR);
   textdomain (PACKAGE);
 
+  expandargv (&argc, &argv);
+
   saved_argv = (char **) xmalloc (argc * sizeof (char*));
   dlltool_arg_indices = (int *) xmalloc (argc * sizeof (int));
   driver_arg_indices = (int *) xmalloc (argc * sizeof (int));
This page took 0.04117 seconds and 4 git commands to generate.