/* dllwrap.c -- wrapper for DLLTOOL and GCC to generate PE style DLLs
- Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by Mumit Khan (khan@xraylith.wisc.edu).
This file is part of GNU Binutils.
#include "getopt.h"
#include "dyn-string.h"
-#include <ctype.h>
#include <time.h>
#include <sys/stat.h>
program_name = argv[0];
+#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+ setlocale (LC_MESSAGES, "");
+#endif
+#if defined (HAVE_SETLOCALE)
+ setlocale (LC_CTYPE, "");
+#endif
+ bindtextdomain (PACKAGE, LOCALEDIR);
+ textdomain (PACKAGE);
+
saved_argv = (char **) xmalloc (argc * sizeof (char*));
dlltool_arg_indices = (int *) xmalloc (argc * sizeof (int));
driver_arg_indices = (int *) xmalloc (argc * sizeof (int));
delete_def_file = 1;
free (fileprefix);
delete_def_file = 1;
- warn (_("no export definition file provided"));
- warn (_("creating one, but that may not be what you want"));
+ warn (_("no export definition file provided.\n\
+Creating one, but that may not be what you want"));
}
/* set the target platform. */
dlltool_cmdline = dyn_string_new (cmdline_len);
if (verbose)
{
- dyn_string_append (dlltool_cmdline, " -v");
+ dyn_string_append_cstr (dlltool_cmdline, " -v");
}
- dyn_string_append (dlltool_cmdline, " --dllname ");
- dyn_string_append (dlltool_cmdline, dll_name);
+ dyn_string_append_cstr (dlltool_cmdline, " --dllname ");
+ dyn_string_append_cstr (dlltool_cmdline, dll_name);
for (i = 1; i < argc; ++i)
{
{
char *arg = saved_argv[i];
int quote = (strchr (arg, ' ') || strchr (arg, '\t'));
- dyn_string_append (dlltool_cmdline,
+ dyn_string_append_cstr (dlltool_cmdline,
(quote) ? " \"" : " ");
- dyn_string_append (dlltool_cmdline, arg);
- dyn_string_append (dlltool_cmdline,
+ dyn_string_append_cstr (dlltool_cmdline, arg);
+ dyn_string_append_cstr (dlltool_cmdline,
(quote) ? "\"" : "");
}
}
break;
}
}
- dyn_string_append (driver_cmdline, driver_flags);
- dyn_string_append (driver_cmdline, " -o ");
- dyn_string_append (driver_cmdline, dll_file_name);
+ dyn_string_append_cstr (driver_cmdline, driver_flags);
+ dyn_string_append_cstr (driver_cmdline, " -o ");
+ dyn_string_append_cstr (driver_cmdline, dll_file_name);
if (! entry_point || strlen (entry_point) == 0)
{
break;
}
}
- dyn_string_append (driver_cmdline, " -Wl,-e,");
- dyn_string_append (driver_cmdline, entry_point);
- dyn_string_append (dlltool_cmdline, " --exclude-symbol=");
- dyn_string_append (dlltool_cmdline,
+ dyn_string_append_cstr (driver_cmdline, " -Wl,-e,");
+ dyn_string_append_cstr (driver_cmdline, entry_point);
+ dyn_string_append_cstr (dlltool_cmdline, " --exclude-symbol=");
+ dyn_string_append_cstr (dlltool_cmdline,
(entry_point[0] == '_') ? entry_point+1 : entry_point);
if (! image_base_str || strlen (image_base_str) == 0)
image_base_str = tmpbuf;
}
- dyn_string_append (driver_cmdline, " -Wl,--image-base,");
- dyn_string_append (driver_cmdline, image_base_str);
+ dyn_string_append_cstr (driver_cmdline, " -Wl,--image-base,");
+ dyn_string_append_cstr (driver_cmdline, image_base_str);
if (verbose)
{
- dyn_string_append (driver_cmdline, " -v");
+ dyn_string_append_cstr (driver_cmdline, " -v");
}
for (i = 1; i < argc; ++i)
{
char *arg = saved_argv[i];
int quote = (strchr (arg, ' ') || strchr (arg, '\t'));
- dyn_string_append (driver_cmdline,
+ dyn_string_append_cstr (driver_cmdline,
(quote) ? " \"" : " ");
- dyn_string_append (driver_cmdline, arg);
- dyn_string_append (driver_cmdline,
+ dyn_string_append_cstr (driver_cmdline, arg);
+ dyn_string_append_cstr (driver_cmdline,
(quote) ? "\"" : "");
}
}
step_pre1 = dyn_string_new (1024);
- dyn_string_append (step_pre1, dlltool_cmdline->s);
+ dyn_string_append_cstr (step_pre1, dlltool_cmdline->s);
if (export_all)
{
- dyn_string_append (step_pre1, " --export-all --exclude-symbol=");
- dyn_string_append (step_pre1,
+ dyn_string_append_cstr (step_pre1, " --export-all --exclude-symbol=");
+ dyn_string_append_cstr (step_pre1,
"_cygwin_dll_entry@12,DllMainCRTStartup@12,DllMain@12,DllEntryPoint@12");
}
- dyn_string_append (step_pre1, " --output-def ");
- dyn_string_append (step_pre1, def_file_name);
+ dyn_string_append_cstr (step_pre1, " --output-def ");
+ dyn_string_append_cstr (step_pre1, def_file_name);
for (i = 1; i < argc; ++i)
{
&& (arg[len-1] == 'o' || arg[len-1] == 'a'))
{
int quote = (strchr (arg, ' ') || strchr (arg, '\t'));
- dyn_string_append (step_pre1,
+ dyn_string_append_cstr (step_pre1,
(quote) ? " \"" : " ");
- dyn_string_append (step_pre1, arg);
- dyn_string_append (step_pre1,
+ dyn_string_append_cstr (step_pre1, arg);
+ dyn_string_append_cstr (step_pre1,
(quote) ? "\"" : "");
}
}
dyn_string_delete (step_pre1);
}
- dyn_string_append (dlltool_cmdline, " --def ");
- dyn_string_append (dlltool_cmdline, def_file_name);
+ dyn_string_append_cstr (dlltool_cmdline, " --def ");
+ dyn_string_append_cstr (dlltool_cmdline, def_file_name);
if (verbose)
{
dyn_string_t step1 = dyn_string_new (driver_cmdline->length
+ strlen (base_file_name)
+ 20);
- dyn_string_append (step1, "-Wl,--base-file,");
+ dyn_string_append_cstr (step1, "-Wl,--base-file,");
quote = (strchr (base_file_name, ' ')
|| strchr (base_file_name, '\t'));
- dyn_string_append (step1,
+ dyn_string_append_cstr (step1,
(quote) ? "\"" : "");
- dyn_string_append (step1, base_file_name);
- dyn_string_append (step1,
+ dyn_string_append_cstr (step1, base_file_name);
+ dyn_string_append_cstr (step1,
(quote) ? "\"" : "");
if (driver_cmdline->length)
{
- dyn_string_append (step1, " ");
- dyn_string_append (step1, driver_cmdline->s);
+ dyn_string_append_cstr (step1, " ");
+ dyn_string_append_cstr (step1, driver_cmdline->s);
}
if (run (driver_name, step1->s))
+ strlen (exp_file_name)
+ 20);
- dyn_string_append (step2, "--base-file ");
+ dyn_string_append_cstr (step2, "--base-file ");
quote = (strchr (base_file_name, ' ')
|| strchr (base_file_name, '\t'));
- dyn_string_append (step2,
+ dyn_string_append_cstr (step2,
(quote) ? "\"" : "");
- dyn_string_append (step2, base_file_name);
- dyn_string_append (step2,
+ dyn_string_append_cstr (step2, base_file_name);
+ dyn_string_append_cstr (step2,
(quote) ? "\" " : " ");
- dyn_string_append (step2, "--output-exp ");
+ dyn_string_append_cstr (step2, "--output-exp ");
quote = (strchr (exp_file_name, ' ')
|| strchr (exp_file_name, '\t'));
- dyn_string_append (step2,
+ dyn_string_append_cstr (step2,
(quote) ? "\"" : "");
- dyn_string_append (step2, exp_file_name);
- dyn_string_append (step2,
+ dyn_string_append_cstr (step2, exp_file_name);
+ dyn_string_append_cstr (step2,
(quote) ? "\"" : "");
if (dlltool_cmdline->length)
{
- dyn_string_append (step2, " ");
- dyn_string_append (step2, dlltool_cmdline->s);
+ dyn_string_append_cstr (step2, " ");
+ dyn_string_append_cstr (step2, dlltool_cmdline->s);
}
if (run (dlltool_name, step2->s))
+ strlen (exp_file_name)
+ strlen (base_file_name)
+ 20);
- dyn_string_append (step3, "-Wl,--base-file,");
+ dyn_string_append_cstr (step3, "-Wl,--base-file,");
quote = (strchr (base_file_name, ' ')
|| strchr (base_file_name, '\t'));
- dyn_string_append (step3,
+ dyn_string_append_cstr (step3,
(quote) ? "\"" : "");
- dyn_string_append (step3, base_file_name);
- dyn_string_append (step3,
+ dyn_string_append_cstr (step3, base_file_name);
+ dyn_string_append_cstr (step3,
(quote) ? "\" " : " ");
quote = (strchr (exp_file_name, ' ')
|| strchr (exp_file_name, '\t'));
- dyn_string_append (step3,
+ dyn_string_append_cstr (step3,
(quote) ? "\"" : "");
- dyn_string_append (step3, exp_file_name);
- dyn_string_append (step3,
+ dyn_string_append_cstr (step3, exp_file_name);
+ dyn_string_append_cstr (step3,
(quote) ? "\"" : "");
if (driver_cmdline->length)
{
- dyn_string_append (step3, " ");
- dyn_string_append (step3, driver_cmdline->s);
+ dyn_string_append_cstr (step3, " ");
+ dyn_string_append_cstr (step3, driver_cmdline->s);
}
if (run (driver_name, step3->s))
+ strlen (exp_file_name)
+ 20);
- dyn_string_append (step4, "--base-file ");
+ dyn_string_append_cstr (step4, "--base-file ");
quote = (strchr (base_file_name, ' ')
|| strchr (base_file_name, '\t'));
- dyn_string_append (step4,
+ dyn_string_append_cstr (step4,
(quote) ? "\"" : "");
- dyn_string_append (step4, base_file_name);
- dyn_string_append (step4,
+ dyn_string_append_cstr (step4, base_file_name);
+ dyn_string_append_cstr (step4,
(quote) ? "\" " : " ");
- dyn_string_append (step4, "--output-exp ");
+ dyn_string_append_cstr (step4, "--output-exp ");
quote = (strchr (exp_file_name, ' ')
|| strchr (exp_file_name, '\t'));
- dyn_string_append (step4,
+ dyn_string_append_cstr (step4,
(quote) ? "\"" : "");
- dyn_string_append (step4, exp_file_name);
- dyn_string_append (step4,
+ dyn_string_append_cstr (step4, exp_file_name);
+ dyn_string_append_cstr (step4,
(quote) ? "\"" : "");
if (dlltool_cmdline->length)
{
- dyn_string_append (step4, " ");
- dyn_string_append (step4, dlltool_cmdline->s);
+ dyn_string_append_cstr (step4, " ");
+ dyn_string_append_cstr (step4, dlltool_cmdline->s);
}
if (output_lib_file_name)
{
- dyn_string_append (step4, " --output-lib ");
- dyn_string_append (step4, output_lib_file_name);
+ dyn_string_append_cstr (step4, " --output-lib ");
+ dyn_string_append_cstr (step4, output_lib_file_name);
}
if (run (dlltool_name, step4->s))
+ 20);
quote = (strchr (exp_file_name, ' ')
|| strchr (exp_file_name, '\t'));
- dyn_string_append (step5,
+ dyn_string_append_cstr (step5,
(quote) ? "\"" : "");
- dyn_string_append (step5, exp_file_name);
- dyn_string_append (step5,
+ dyn_string_append_cstr (step5, exp_file_name);
+ dyn_string_append_cstr (step5,
(quote) ? "\"" : "");
if (driver_cmdline->length)
{
- dyn_string_append (step5, " ");
- dyn_string_append (step5, driver_cmdline->s);
+ dyn_string_append_cstr (step5, " ");
+ dyn_string_append_cstr (step5, driver_cmdline->s);
}
if (run (driver_name, step5->s))