aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2007-07-05 09:51:30 +0000
committerNick Clifton <nickc@redhat.com>2007-07-05 09:51:30 +0000
commitc6998d15d5b97393ddd582037f6d6f00e7116237 (patch)
tree50cdc955de0f0ecc0e585b7f966fabeacf8f8f13
parent9b201bb5e5daa9b4f783e6ece9cbfbdbf9f1d6f4 (diff)
downloadgdb-c6998d15d5b97393ddd582037f6d6f00e7116237.zip
gdb-c6998d15d5b97393ddd582037f6d6f00e7116237.tar.gz
gdb-c6998d15d5b97393ddd582037f6d6f00e7116237.tar.bz2
* resrc.c: (read_rc_file): Add include path of user passed rc input file.
* windres.c: (windres_add_include_dir): New. (main): Use of windres_add_include_dir. * windres.h: (windres_add_include_dir): Add prototype.
-rw-r--r--binutils/ChangeLog8
-rw-r--r--binutils/resrc.c29
-rw-r--r--binutils/windres.c26
-rw-r--r--binutils/windres.h1
4 files changed, 53 insertions, 11 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 3dd566f..be8ca01 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,11 @@
+2007-07-05 Kai Tietz <kai.tietz@onevision.com>
+
+ * resrc.c: (read_rc_file): Add include path of user passed rc
+ input file.
+ * windres.c: (windres_add_include_dir): New.
+ (main): Use of windres_add_include_dir.
+ * windres.h: (windres_add_include_dir): Add prototype.
+
2007-07-05 Alan Modra <amodra@bigpond.net.au>
* doc/binutils.texi (size): Document --common.
diff --git a/binutils/resrc.c b/binutils/resrc.c
index ebed255..2b148ef 100644
--- a/binutils/resrc.c
+++ b/binutils/resrc.c
@@ -436,6 +436,35 @@ read_rc_file (const char *filename, const char *preprocessor,
char *cmd;
const char *fnquotes = (filename_need_quotes (filename) ? "\"" : "");
+ /* Setup the default resource import path taken from input file. */
+ if (strchr (filename, '/') != NULL || strchr (filename, '\\') != NULL)
+ {
+ char *e, *c;
+
+ if (filename[0] == '/'
+ || filename[0] == '\\'
+ || filename[1] == ':')
+ e = c = xstrdup (filename);
+ else
+ {
+ e = c = xmalloc (strlen (filename) + 3);
+ sprintf (c, "./%s", filename);
+ }
+ e += strlen (c);
+ while (e > c && (e[-1] != '\\' && e[-1] != '/'))
+ {
+ --e;
+ e[0] = 0;
+ }
+ /* Cut off trailing slash. */
+ --e;
+ e[0] = 0;
+ while ((e = strchr (c, '\\')) != NULL)
+ *e = '/';
+
+ windres_add_include_dir (e);
+ }
+
istream_type = (use_temp_file) ? ISTREAM_FILE : ISTREAM_PIPE;
if (preprocargs == NULL)
diff --git a/binutils/windres.c b/binutils/windres.c
index da8e33f..05615c4 100644
--- a/binutils/windres.c
+++ b/binutils/windres.c
@@ -760,6 +760,20 @@ static const struct option long_options[] =
{0, no_argument, 0, 0}
};
+void
+windres_add_include_dir (const char *p)
+{
+ struct include_dir *n, **pp;
+
+ n = xmalloc (sizeof *n);
+ n->next = NULL;
+ n->dir = (char * ) p;
+
+ for (pp = &include_dirs; *pp != NULL; pp = &(*pp)->next)
+ ;
+ *pp = n;
+}
+
/* This keeps gcc happy when using -Wmissing-prototypes -Wstrict-prototypes. */
int main (int, char **);
@@ -926,17 +940,7 @@ main (int argc, char **argv)
preprocargs = n;
}
- {
- struct include_dir *n, **pp;
-
- n = (struct include_dir *) xmalloc (sizeof *n);
- n->next = NULL;
- n->dir = optarg;
-
- for (pp = &include_dirs; *pp != NULL; pp = &(*pp)->next)
- ;
- *pp = n;
- }
+ windres_add_include_dir (optarg);
break;
diff --git a/binutils/windres.h b/binutils/windres.h
index d7494ec..8b94306 100644
--- a/binutils/windres.h
+++ b/binutils/windres.h
@@ -115,6 +115,7 @@ extern rc_ver_stringinfo *append_verval (rc_ver_stringinfo *, const unichar *, c
extern rc_ver_varinfo *append_vertrans (rc_ver_varinfo *, rc_uint_type, rc_uint_type);
extern bfd *windres_open_as_binary (const char *, int);
+extern void windres_add_include_dir (const char *);
extern int wr_printcomment (FILE *, const char *, ...);
extern int wr_print (FILE *, const char *, ...);