Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
a4fc84bd
Commit
a4fc84bd
authored
Feb 12, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wmc: Add --nls-dir option.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
64ff68c8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
3 deletions
+45
-3
Makefile.in
tools/wmc/Makefile.in
+4
-0
wmc.c
tools/wmc/wmc.c
+35
-0
wmc.h
tools/wmc/wmc.h
+2
-0
wmc.man.in
tools/wmc/wmc.man.in
+4
-3
No files found.
tools/wmc/Makefile.in
View file @
a4fc84bd
...
...
@@ -11,6 +11,10 @@ C_SRCS = \
BISON_SRCS
=
mcy.y
wmc_EXTRADEFS
=
\
-DNLSDIR
=
"
\"
${
nlsdir
}
\"
"
\
-DBIN_TO_NLSDIR
=
\"
`
$(MAKEDEP)
-R
${
bindir
}
${
nlsdir
}
`
\"
EXTRALIBS
=
$(GETTEXTPO_LIBS)
INSTALL_DEV
=
$(PROGRAMS)
tools/wmc/wmc.c
View file @
a4fc84bd
...
...
@@ -50,6 +50,7 @@ static const char usage[] =
" -h, --help Print this message
\n
"
" -H FILE Write header file to FILE (default is inputfile.h)
\n
"
" -i Inline messagetable(s)
\n
"
" --nls-dir=DIR Directory containing the NLS codepage mappings
\n
"
" -o, --output=FILE Output to FILE (default is infile.rc)
\n
"
" -O, --output-format=FORMAT The output format (`rc', `res', or `pot')
\n
"
" -P, --po-dir=DIR Directory containing po files for translations
\n
"
...
...
@@ -109,6 +110,8 @@ char *output_name = NULL; /* The name given by the -o option */
char
*
input_name
=
NULL
;
/* The name given on the command-line */
char
*
header_name
=
NULL
;
/* The name given by the -H option */
const
char
*
nlsdirs
[
3
]
=
{
NULL
,
NLSDIR
,
NULL
};
int
line_number
=
1
;
/* The current line */
int
char_number
=
1
;
/* The current char pos within the line */
...
...
@@ -127,10 +130,16 @@ static enum
FORMAT_POT
}
output_format
;
enum
long_options_values
{
LONG_OPT_NLS_DIR
=
1
,
};
static
const
char
short_options
[]
=
"B:cdDhH:io:O:P:uUvVW"
;
static
const
struct
option
long_options
[]
=
{
{
"help"
,
0
,
NULL
,
'h'
},
{
"nls-dir"
,
1
,
NULL
,
LONG_OPT_NLS_DIR
},
{
"output"
,
1
,
NULL
,
'o'
},
{
"output-format"
,
1
,
NULL
,
'O'
},
{
"pedantic"
,
0
,
NULL
,
'W'
},
...
...
@@ -151,6 +160,28 @@ static void exit_on_signal( int sig )
exit
(
1
);
/* this will call the atexit functions */
}
static
void
init_argv0_dir
(
const
char
*
argv0
)
{
#ifndef _WIN32
char
*
p
,
*
dir
;
#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
dir
=
realpath
(
"/proc/self/exe"
,
NULL
);
#elif defined (__FreeBSD__) || defined(__DragonFly__)
dir
=
realpath
(
"/proc/curproc/file"
,
NULL
);
#else
dir
=
realpath
(
argv0
,
NULL
);
#endif
if
(
!
dir
)
return
;
if
(
!
(
p
=
strrchr
(
dir
,
'/'
)))
return
;
if
(
p
==
dir
)
p
++
;
*
p
=
0
;
if
(
strendswith
(
dir
,
"/tools/wmc"
))
nlsdirs
[
0
]
=
strmake
(
"%s/../../nls"
,
dir
);
else
nlsdirs
[
0
]
=
strmake
(
"%s/%s"
,
dir
,
BIN_TO_NLSDIR
);
free
(
dir
);
#endif
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
optc
;
...
...
@@ -167,6 +198,7 @@ int main(int argc,char *argv[])
#ifdef SIGHUP
signal
(
SIGHUP
,
exit_on_signal
);
#endif
init_argv0_dir
(
argv
[
0
]
);
/* First rebuild the commandline to put in destination */
/* Could be done through env[], but not all OS-es support it */
...
...
@@ -257,6 +289,9 @@ int main(int argc,char *argv[])
case
'W'
:
pedantic
=
1
;
break
;
case
LONG_OPT_NLS_DIR
:
nlsdirs
[
0
]
=
xstrdup
(
optarg
);
break
;
default:
lose
++
;
break
;
...
...
tools/wmc/wmc.h
View file @
a4fc84bd
...
...
@@ -49,6 +49,8 @@ extern char *input_name;
extern
char
*
header_name
;
extern
char
*
cmdline
;
extern
const
char
*
nlsdirs
[];
extern
int
line_number
;
extern
int
char_number
;
...
...
tools/wmc/wmc.man.in
View file @
a4fc84bd
...
...
@@ -45,6 +45,10 @@ Inline messagetable(s). This option skips the generation of all \fI.bin\fR files
and writes all output into the \fI.rc\fR file. This encoding is parsable with
wrc(1).
.TP
.BI \-\-nls-dir= directory
Specify the directory to search for the NLS files containing the
codepage mapping tables.
.TP
.BR \-o ,\ \-\-output =\fIfile
Output to \fIfile\fR. Default is \fIinputfile.rc\fR.
.TP
...
...
@@ -94,9 +98,6 @@ The message compiler should be able to have multiple input files and combine
them into one output file. This would enable the splitting of languages into
separate files.
.PP
Unicode detection of the input is suboptimal, to say the least. It should
recognize byte order marks (BOM) and decide what to do.
.PP
Decimal output is completely lacking. Don't know whether it should be
implemented because it is a, well, non-informative format change. It is
recognized on the commandline for some form of compatibility.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment