summaryrefslogtreecommitdiff
path: root/binutils/windres.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2007-06-18 15:30:33 +0000
committerNick Clifton <nickc@redhat.com>2007-06-18 15:30:33 +0000
commit0ae923e8d923621c9553c33ef3d46902782871f2 (patch)
treef29caac8479b48eb063ba50c89cad101969ab451 /binutils/windres.c
parentd2b6890afbb6c7edb0680aeb61c3db221c19bac2 (diff)
downloadbinutils-redhat-0ae923e8d923621c9553c33ef3d46902782871f2.tar.gz
* rclex.c: (cpp_line): Add code_page pragma support.
* windres.c: (usage, long_options, main): Add new option --codepage or -c. * winduni.c: (wind_default_codepage, wind_current_codepage): New. (unicode_from_ascii, ascii_from_unicode): Use wind_current_codepage as codepage parameter. (unicode_print): Print 4 characters for hexadecimal values in unicode strings. * winduni.h: (wind_default_codepage, wind_current_codepage): Export. * doc/binutils.texi: Document new option. * NEWS: Mention new feature.
Diffstat (limited to 'binutils/windres.c')
-rw-r--r--binutils/windres.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/binutils/windres.c b/binutils/windres.c
index 90918a6e90..da8e33f39a 100644
--- a/binutils/windres.c
+++ b/binutils/windres.c
@@ -673,6 +673,7 @@ usage (FILE *stream, int status)
-D --define <sym>[=<val>] Define SYM when preprocessing rc file\n\
-U --undefine <sym> Undefine SYM when preprocessing rc file\n\
-v --verbose Verbose - tells you what it's doing\n\
+ -c --codepage=<codepage> Specify default codepage\n\
-l --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\
@@ -749,6 +750,7 @@ static const struct option long_options[] =
{"define", required_argument, 0, 'D'},
{"undefine", required_argument, 0, 'U'},
{"verbose", no_argument, 0, 'v'},
+ {"codepage", required_argument, 0, 'c'},
{"language", required_argument, 0, 'l'},
{"use-temp-file", no_argument, 0, OPTION_USE_TEMP_FILE},
{"no-use-temp-file", no_argument, 0, OPTION_NO_USE_TEMP_FILE},
@@ -809,11 +811,25 @@ main (int argc, char **argv)
language = 0x409; /* LANG_ENGLISH, SUBLANG_ENGLISH_US. */
use_temp_file = 0;
- while ((c = getopt_long (argc, argv, "f:i:l:o:I:J:O:F:D:U:rhHvV", long_options,
+ while ((c = getopt_long (argc, argv, "c:f:i:l:o:I:J:O:F:D:U:rhHvV", long_options,
(int *) 0)) != EOF)
{
switch (c)
{
+ case 'c':
+ {
+ rc_uint_type ncp;
+
+ if (optarg[0] == '0' && (optarg[1] == 'x' || optarg[1] == 'X'))
+ ncp = (rc_uint_type) strtol (optarg + 2, NULL, 16);
+ else
+ ncp = (rc_uint_type) strtol (optarg, NULL, 10);
+ if (ncp == CP_UTF16 || ! unicode_is_valid_codepage (ncp))
+ fatal (_("invalid codepage specified.\n"));
+ wind_default_codepage = wind_current_codepage = ncp;
+ }
+ break;
+
case 'i':
input_filename = optarg;
break;