summaryrefslogtreecommitdiff
path: root/binutils/resrc.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1999-06-22 20:39:46 +0000
committerIan Lance Taylor <ian@airs.com>1999-06-22 20:39:46 +0000
commit8d3953ff2075de2c1ec1ee865595b45a8a6a968a (patch)
tree980716b73439f68d42c9b1f0c79ee50ba324fe25 /binutils/resrc.c
parentc9fa744fae934cf5db7cd3d2770439739e63cd60 (diff)
downloadbinutils-redhat-8d3953ff2075de2c1ec1ee865595b45a8a6a968a.tar.gz
Based on patches from Mumit Khan <khan@xraylith.wisc.EDU>:
* configure.in: Define EXECUTABLE_SUFFIX. * dlltool.c: Include "dyn-string.h". Include <stdarg.h> based on ANSI_PROTOTYPES, not __STDC__. (outfile): Remove. (gen_exp_file): Change uses of outfile to use alloca. (make_one_lib_file, make_head, make_tail): Likewise. (gen_lib_file): Likewise. (look_for_prog): New static function. (deduce_name): Rewrite to use look_for_prog. (mcore_elf_gen_out_file): Use dyn_string_t rather than outfile. * dllwrap.c: Don't include <stdio.h>, <errno.h>, <string.h>, <stdlib.h>, or <unistd.h>. Include <sys/stat.h> and either <stdarg.h> or <varargs.h>. (driver_name): Initialize to NULL, not "gcc". (dlltool_name): Initialize to NULL, not "dlltool". (display, inform, look_for_prog, deduce_name): New static functions. (usage): Mention -mno-cygwin. (OPTION_MNO_CYGWIN): Define. (main): Handle -mno-cygwin. Deduce driver_name and dlltool_name. * resrc.c (look_for_default): Make static. Remove unused local path. Check using EXECUTABLE_SUFFIX. (read_rc_file): Allocate enough space to hold EXECUTABLE_SUFFIX. * Makefile.am: Rebuild dependencies. (dllwrap_LDADD): Add $(INTLLIBS). * configure, Makefile.in, config.in: Rebuild.
Diffstat (limited to 'binutils/resrc.c')
-rw-r--r--binutils/resrc.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/binutils/resrc.c b/binutils/resrc.c
index 41c9ccacfb..ed6a36a4f7 100644
--- a/binutils/resrc.c
+++ b/binutils/resrc.c
@@ -1,5 +1,5 @@
/* resrc.c -- read and write Windows rc files.
- Copyright 1997, 1998 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 1999 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils.
@@ -112,6 +112,8 @@ static int icons;
/* Local functions. */
+static FILE *look_for_default PARAMS ((char *, const char *, int,
+ const char *, const char *));
static void close_pipe PARAMS ((void));
static void unexpected_eof PARAMS ((const char *));
static int get_word PARAMS ((FILE *, const char *));
@@ -122,41 +124,44 @@ static void define_fontdirs PARAMS ((void));
/* look for the preprocessor program */
-FILE *
+static FILE *
look_for_default (cmd, prefix, end_prefix, preprocargs, filename)
char *cmd;
- char *prefix;
+ const char *prefix;
int end_prefix;
- char *preprocargs;
- char *filename;
+ const char *preprocargs;
+ const char *filename;
{
- char *path = getenv ("PATH");
char *space;
int found;
struct stat s;
strcpy (cmd, prefix);
- sprintf (cmd+end_prefix, "%s", DEFAULT_PREPROCESSOR);
- space = strchr (cmd+end_prefix, ' ');
+ sprintf (cmd + end_prefix, "%s", DEFAULT_PREPROCESSOR);
+ space = strchr (cmd + end_prefix, ' ');
if (space)
*space = 0;
if (strchr (cmd, '/'))
{
- found = stat (cmd, &s);
+ found = (stat (cmd, &s) == 0
+#ifdef EXECUTABLE_SUFFIX
+ || stat (strcat (cmd, EXECUTABLE_SUFFIX), &s) == 0
+#endif
+ );
- if (found < 0)
+ if (! found)
{
if (verbose)
fprintf (stderr, "Tried `%s'\n", cmd);
- return 0;
+ return NULL;
}
}
strcpy (cmd, prefix);
- sprintf (cmd+end_prefix, "%s %s %s",
+ sprintf (cmd + end_prefix, "%s %s %s",
DEFAULT_PREPROCESSOR, preprocargs, filename);
if (verbose)
@@ -202,11 +207,14 @@ read_rc_file (filename, preprocessor, preprocargs, language)
+ strlen (preprocessor)
+ strlen (preprocargs)
+ strlen (filename)
+#ifdef EXECUTABLE_SUFFIX
+ + strlen (EXECUTABLE_SUFFIX)
+#endif
+ 10);
dash = slash = 0;
- for (cp=program_name; *cp; cp++)
+ for (cp = program_name; *cp; cp++)
{
if (*cp == '-')
dash = cp;