wrc: -h, -v (take 3)
Dimitrie O. Paun
dpaun at rogers.com
Thu Jan 9 22:18:36 CST 2003
Sorry about the previous patch, it was corrupted. My appologies.
I hope 3 times' a charm! :)
ChangeLog
Added windres compatibility switches: -v, --[no-]use-temp-file.
New -h option to conform to standard practice (and MS' rc).
Updated documentation, minor option parsing cleanup.
Index: tools/wrc/wrc.c
===================================================================
RCS file: /var/cvs/wine/tools/wrc/wrc.c,v
retrieving revision 1.23
diff -u -r1.23 wrc.c
--- tools/wrc/wrc.c 9 Jan 2003 00:03:53 -0000 1.23
+++ tools/wrc/wrc.c 10 Jan 2003 04:12:57 -0000
@@ -77,19 +77,19 @@
#define INCLUDEDIR "/usr/local/include/wine"
#endif
+#ifdef WORDS_BIGENDIAN
+#define ENDIAN "big"
+#else
+#define ENDIAN "little"
+#endif
+
static char usage[] =
"Usage: wrc [options...] [infile[.rc|.res]] [outfile]\n"
" -a n Alignment of resource (win16 only, default is 4)\n"
" -A Auto register resources (only with gcc 2.7 and better)\n"
" -b Create an assembly array from a binary .res file\n"
" -B x Set output byte-order x={n[ative], l[ittle], b[ig]}\n"
- " (win32 only; default is n[ative] which equals "
-#ifdef WORDS_BIGENDIAN
- "big"
-#else
- "little"
-#endif
- "-endian)\n"
+ " (win32 only; default is " ENDIAN "-endian)\n"
" -c Add 'const' prefix to C constants\n"
" -C cp Set the resource's codepage to cp (default is 0)\n"
" -d n Set debug level to 'n'\n"
@@ -98,6 +98,7 @@
" -E Preprocess only\n"
" -F target Ignored for compatibility with windres\n"
" -g Add symbols to the global c namespace\n"
+ " -h Prints this summary.\n"
" -i file The name of the input file.\n"
" -I path Set include search dir to path (multiple -I allowed)\n"
" -J Do not search the standard include path\n"
@@ -110,6 +111,7 @@
" -s Add structure with win32/16 (PE/NE) resource directory\n"
" -t Generate indirect loadable resource tables\n"
" -T Generate only indirect loadable resources tables\n"
+ " -v Enable verbose mode.\n"
" -V Print version and exit\n"
" -w 16|32 Select win16 or win32 output (default is win32)\n"
" -W Enable pedantic warnings\n"
@@ -123,8 +125,10 @@
" --nostdinc Synonym for -J.\n"
" --define Synonym for -D.\n"
" --language Synonym for -l.\n"
+ " --use-temp-file Ignored for compatibility with windres.\n"
+ " --no-use-temp-file Ignored for compatibility with windres.\n"
" --preprocessor Specify the preprocessor to use, including arguments.\n"
- " --help Prints a usage summary.\n"
+ " --help Synonym for -h.\n"
" --version Synonym for -V.\n"
#endif
"Input is taken from stdin if no sourcefile specified.\n"
@@ -135,11 +139,8 @@
" * 0x08 Preprocessor messages\n"
" * 0x10 Preprocessor lex messages\n"
" * 0x20 Preprocessor yacc trace\n"
- "The -o option only applies to the final destination file, which is\n"
- "in case of normal compile a .s file. You must use the '-H header.h'\n"
- "option to override the header-filename.\n"
"If no input filename is given and the output name is not overridden\n"
- "with -o and/or -H, then the output is written to \"wrc.tab.[sh]\"\n"
+ "with -o, then the output is written to \"wrc.tab.[sh]\"\n"
;
char version_string[] = "Wine Resource Compiler Version " WRC_FULLVERSION "\n"
@@ -272,6 +273,8 @@
static void rm_tempfile(void);
static void segvhandler(int sig);
+static const char* short_options =
+ "a:AbB:cC:d:D:eEF:ghH:i:I:Jl:LmnNo:O:p:rstTvVw:W";
#ifdef HAVE_GETOPT_LONG
static struct option long_options[] = {
{ "input", 1, 0, 'i' },
@@ -282,9 +285,11 @@
{ "nostdinc", 0, 0, 'J' },
{ "define", 1, 0, 'D' },
{ "language", 1, 0, 'l' },
- { "preprocessor", 1, 0, 1 },
- { "help", 0, 0, 2 },
{ "version", 0, 0, 'V' },
+ { "help", 0, 0, 'h' },
+ { "preprocessor", 1, 0, 1 },
+ { "use-temp-file", 0, 0, 2 },
+ { "no-use-temp-file", 0, 0, 3 },
{ 0, 0, 0, 0 }
};
#endif
@@ -320,9 +325,9 @@
}
#ifdef HAVE_GETOPT_LONG
- while((optc = getopt_long(argc, argv, "a:AbB:cC:d:D:eEF:ghH:i:I:Jl:LmnNo:O:p:rstTVw:W", long_options, &opti)) != EOF)
+ while((optc = getopt_long(argc, argv, short_options, long_options, &opti)) != EOF)
#else
- while((optc = getopt(argc, argv, "a:AbB:cC:d:D:eEF:ghH:i:I:Jl:LmnNo:O:p:rstTVw:W")) != EOF)
+ while((optc = getopt(argc, argv, short_options)) != EOF)
#endif
{
switch(optc)
@@ -331,8 +336,10 @@
fprintf(stderr, "--preprocessor option not yet supported, ignored.\n");
break;
case 2:
- printf(usage);
- exit(0);
+ fprintf(stderr, "--use-temp-file option not yet supported, ignored.\n");
+ break;
+ case 3:
+ fprintf(stderr, "--no-use-temp-file option not yet supported, ignored.\n");
break;
case 'a':
alignment = atoi(optarg);
@@ -387,6 +394,9 @@
case 'g':
global = 1;
break;
+ case 'h':
+ printf(usage);
+ exit(0);
case 'i':
if (!input_name) input_name = strdup(optarg);
else error("Too many input files.\n");
@@ -433,6 +443,9 @@
/* Fall through */
case 't':
indirect = 1;
+ break;
+ case 'v':
+ debuglevel = DEBUGLEVEL_CHAT;
break;
case 'V':
printf(version_string);
Index: tools/wrc/wrc.man
===================================================================
RCS file: /var/cvs/wine/tools/wrc/wrc.man,v
retrieving revision 1.9
diff -u -r1.9 wrc.man
--- tools/wrc/wrc.man 9 Jan 2003 00:03:53 -0000 1.9
+++ tools/wrc/wrc.man 10 Jan 2003 04:17:19 -0000
@@ -79,6 +79,9 @@
Add symbols to the global C namespace. This makes all symbols available
for linking by other modules.
.TP
+.I \-h
+Prints a summary message and exits.
+.TP
.I \-I path
Add \fIpath\fR to include search directories. \fIPath\fR may contain
multiple directories, separated with ':'. It is allowed to specify
@@ -138,6 +141,9 @@
.TP
.I \-T
Obsolete; generate only indirect loadable resources tables.
+.TP
+.I \-v
+Turns on verbose mode (equivalent to -d 1).
.TP
.I \-V
Print version end exit.
--
Dimi.
More information about the wine-patches
mailing list