Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
4ff35b52
Commit
4ff35b52
authored
Oct 01, 2003
by
Dimitrie O. Paun
Committed by
Alexandre Julliard
Oct 01, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Teach bin2res to deal with one file at a time.
parent
bdfb12c0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
7 deletions
+21
-7
bin2res.c
tools/bin2res.c
+21
-7
No files found.
tools/bin2res.c
View file @
4ff35b52
...
...
@@ -33,9 +33,11 @@
#endif
static
const
char
*
help
=
"Usage: bin2res [
-x] | [-a] [-f] [-h
] <rsrc.rc>
\n
"
"Usage: bin2res [
OPTIONS
] <rsrc.rc>
\n
"
" -a archive binaries into the <rsrc.rc> file
\n
"
" -x extract binaries from the <rsrc.rc> file
\n
"
" -i <filename> archive the named file into the <rsrc.rc> file
\n
"
" -o <filename> extract the named file from the <rsrc.rc> file
\n
"
" -f force processing of older resources
\n
"
" -h print this help screen and exit
\n
"
"
\n
"
...
...
@@ -55,7 +57,8 @@ static const char* help =
" bin2res -x myrsrc.rc
\n
"
"Binary files newer than the .rc file are not overwritten.
\n
"
"
\n
"
"To force processing of all resources, use the -f flag.
\n
"
;
"To force processing of all resources, use the -f flag.
\n
"
"To process a particular file, use the -i/-o options.
\n
"
;
void
usage
(
void
)
{
...
...
@@ -118,7 +121,7 @@ const char* parse_marker(const char *line, time_t* last_updated)
return
res_file_name
;
}
int
process_resources
(
const
char
*
input_file_name
,
int
inserting
,
int
force_processing
)
int
process_resources
(
const
char
*
input_file_name
,
const
char
*
specific_file_name
,
int
inserting
,
int
force_processing
)
{
char
buffer
[
2048
],
tmp_file_name
[
PATH_MAX
];
const
char
*
res_file_name
;
...
...
@@ -147,7 +150,8 @@ int process_resources(const char* input_file_name, int inserting, int force_proc
{
if
(
inserting
)
fprintf
(
ftmp
,
"%s"
,
buffer
);
if
(
!
(
res_file_name
=
parse_marker
(
buffer
,
&
res_last_update
)))
continue
;
if
(
!
force_processing
&&
((
rc_last_update
<
res_last_update
)
==
!
inserting
))
if
(
(
specific_file_name
&&
strcmp
(
specific_file_name
,
res_file_name
))
||
(
!
force_processing
&&
((
rc_last_update
<
res_last_update
)
==
!
inserting
))
)
{
printf
(
"skipping '%s'
\n
"
,
res_file_name
);
continue
;
...
...
@@ -188,9 +192,10 @@ int main(int argc, char **argv)
{
int
convert_dir
=
0
,
optc
;
int
force_overwrite
=
0
;
const
char
*
input_file_name
;
const
char
*
input_file_name
=
0
;
const
char
*
specific_file_name
=
0
;
while
((
optc
=
getopt
(
argc
,
argv
,
"axfh"
))
!=
EOF
)
while
((
optc
=
getopt
(
argc
,
argv
,
"ax
i:o:
fh"
))
!=
EOF
)
{
switch
(
optc
)
{
...
...
@@ -199,6 +204,14 @@ int main(int argc, char **argv)
if
(
convert_dir
)
usage
();
convert_dir
=
optc
;
break
;
case
'i'
:
case
'o'
:
if
(
specific_file_name
)
usage
();
specific_file_name
=
optarg
;
optc
=
((
optc
==
'i'
)
?
'a'
:
'x'
);
if
(
convert_dir
&&
convert_dir
!=
optc
)
usage
();
convert_dir
=
optc
;
break
;
case
'f'
:
force_overwrite
=
1
;
break
;
...
...
@@ -216,7 +229,8 @@ int main(int argc, char **argv)
if
(
!
convert_dir
)
usage
();
if
(
!
process_resources
(
input_file_name
,
convert_dir
==
'a'
,
force_overwrite
))
if
(
!
process_resources
(
input_file_name
,
specific_file_name
,
convert_dir
==
'a'
,
force_overwrite
))
{
perror
(
"Processing failed"
);
exit
(
1
);
...
...
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