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
f1de64db
Commit
f1de64db
authored
May 27, 2006
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrc: Clean output files when aborting on an error or signal.
parent
22aad637
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
5 deletions
+20
-5
wrc.c
tools/wrc/wrc.c
+20
-5
No files found.
tools/wrc/wrc.c
View file @
f1de64db
...
...
@@ -171,7 +171,7 @@ int yy_flex_debug;
resource_t
*
resource_top
;
/* The top of the parsed resources */
int
getopt
(
int
argc
,
char
*
const
*
argv
,
const
char
*
optstring
);
static
void
rm_tempfile
(
void
);
static
void
cleanup_files
(
void
);
static
void
segvhandler
(
int
sig
);
static
const
char
*
short_options
=
...
...
@@ -226,6 +226,12 @@ static void set_version_defines(void)
free
(
version
);
}
/* clean things up when aborting on a signal */
static
void
exit_on_signal
(
int
sig
)
{
exit
(
1
);
/* this will call the atexit functions */
}
int
main
(
int
argc
,
char
*
argv
[])
{
extern
char
*
optarg
;
...
...
@@ -239,6 +245,11 @@ int main(int argc,char *argv[])
int
cmdlen
;
signal
(
SIGSEGV
,
segvhandler
);
signal
(
SIGTERM
,
exit_on_signal
);
signal
(
SIGINT
,
exit_on_signal
);
#ifdef SIGHUP
signal
(
SIGHUP
,
exit_on_signal
);
#endif
now
=
time
(
NULL
);
...
...
@@ -430,6 +441,7 @@ int main(int argc,char *argv[])
output_name
=
dup_basename
(
input_name
,
".rc"
);
strcat
(
output_name
,
".res"
);
}
atexit
(
cleanup_files
);
/* Run the preprocessor on the input */
if
(
!
no_preprocess
)
...
...
@@ -443,7 +455,6 @@ int main(int argc,char *argv[])
if
(
!
preprocess_only
)
{
atexit
(
rm_tempfile
);
ret
=
wpp_parse_temp
(
input_name
,
output_name
,
&
temp_name
);
}
else
if
(
output_name
)
...
...
@@ -464,7 +475,10 @@ int main(int argc,char *argv[])
exit
(
1
);
/* Error during preprocess */
if
(
preprocess_only
)
{
output_name
=
NULL
;
exit
(
0
);
}
input_name
=
temp_name
;
}
...
...
@@ -495,15 +509,16 @@ int main(int argc,char *argv[])
chat
(
"Writing .res-file"
);
write_resfile
(
output_name
,
resource_top
);
output_name
=
NULL
;
return
0
;
}
static
void
rm_tempfile
(
void
)
static
void
cleanup_files
(
void
)
{
if
(
temp_name
)
unlink
(
temp_name
);
if
(
output_name
)
unlink
(
output_name
);
if
(
temp_name
)
unlink
(
temp_name
);
}
static
void
segvhandler
(
int
sig
)
...
...
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