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
cf63bb88
Commit
cf63bb88
authored
Feb 16, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrc: Print better error messages for functions that set errno.
parent
4d135d9a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
8 deletions
+19
-8
readres.c
tools/wrc/readres.c
+1
-1
utils.c
tools/wrc/utils.c
+11
-0
utils.h
tools/wrc/utils.h
+2
-1
wrc.c
tools/wrc/wrc.c
+2
-2
writeres.c
tools/wrc/writeres.c
+3
-4
No files found.
tools/wrc/readres.c
View file @
cf63bb88
...
@@ -354,7 +354,7 @@ resource_t *read_resfile(char *inname)
...
@@ -354,7 +354,7 @@ resource_t *read_resfile(char *inname)
fp
=
fopen
(
inname
,
"rb"
);
fp
=
fopen
(
inname
,
"rb"
);
if
(
!
fp
)
if
(
!
fp
)
error
(
"Could not open inputfile %s
\n
"
,
inname
);
fatal_perror
(
"Could not open %s
"
,
inname
);
/* Determine 16 or 32 bit .res file */
/* Determine 16 or 32 bit .res file */
if
(
fread
(
&
rh
,
1
,
sizeof
(
rh
),
fp
)
!=
sizeof
(
rh
))
if
(
fread
(
&
rh
,
1
,
sizeof
(
rh
),
fp
)
!=
sizeof
(
rh
))
...
...
tools/wrc/utils.c
View file @
cf63bb88
...
@@ -96,6 +96,17 @@ void internal_error(const char *file, int line, const char *s, ...)
...
@@ -96,6 +96,17 @@ void internal_error(const char *file, int line, const char *s, ...)
exit
(
3
);
exit
(
3
);
}
}
void
fatal_perror
(
const
char
*
msg
,
...
)
{
va_list
valist
;
va_start
(
valist
,
msg
);
fprintf
(
stderr
,
"Error: "
);
vfprintf
(
stderr
,
msg
,
valist
);
perror
(
" "
);
va_end
(
valist
);
exit
(
2
);
}
void
error
(
const
char
*
s
,
...)
void
error
(
const
char
*
s
,
...)
{
{
va_list
ap
;
va_list
ap
;
...
...
tools/wrc/utils.h
View file @
cf63bb88
...
@@ -36,7 +36,8 @@ char *xstrdup(const char *str);
...
@@ -36,7 +36,8 @@ char *xstrdup(const char *str);
int
parser_error
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
int
parser_error
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
int
parser_warning
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
int
parser_warning
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
void
internal_error
(
const
char
*
file
,
int
line
,
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
3
,
4
),
noreturn
));
void
internal_error
(
const
char
*
file
,
int
line
,
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
3
,
4
),
noreturn
));
void
error
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
void
fatal_perror
(
const
char
*
msg
,
...
)
__attribute__
((
format
(
printf
,
1
,
2
),
noreturn
));
void
error
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
),
noreturn
));
void
warning
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
void
warning
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
void
chat
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
void
chat
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
...
...
tools/wrc/wrc.c
View file @
cf63bb88
...
@@ -462,7 +462,7 @@ int main(int argc,char *argv[])
...
@@ -462,7 +462,7 @@ int main(int argc,char *argv[])
FILE
*
output
;
FILE
*
output
;
if
(
!
(
output
=
fopen
(
output_name
,
"w"
)))
if
(
!
(
output
=
fopen
(
output_name
,
"w"
)))
error
(
"Could not open %s for writing
\n
"
,
output_name
);
fatal_perror
(
"Could not open %s for writing
"
,
output_name
);
ret
=
wpp_parse
(
input_name
,
output
);
ret
=
wpp_parse
(
input_name
,
output
);
fclose
(
output
);
fclose
(
output
);
}
}
...
@@ -487,7 +487,7 @@ int main(int argc,char *argv[])
...
@@ -487,7 +487,7 @@ int main(int argc,char *argv[])
chat
(
"Starting parse
\n
"
);
chat
(
"Starting parse
\n
"
);
if
(
!
(
parser_in
=
fopen
(
input_name
,
"rb"
)))
if
(
!
(
parser_in
=
fopen
(
input_name
,
"rb"
)))
error
(
"Could not open %s for input
\n
"
,
input_name
);
fatal_perror
(
"Could not open %s for input
"
,
input_name
);
ret
=
parser_parse
();
ret
=
parser_parse
();
...
...
tools/wrc/writeres.c
View file @
cf63bb88
...
@@ -52,9 +52,7 @@ void write_resfile(char *outname, resource_t *top)
...
@@ -52,9 +52,7 @@ void write_resfile(char *outname, resource_t *top)
fo
=
fopen
(
outname
,
"wb"
);
fo
=
fopen
(
outname
,
"wb"
);
if
(
!
fo
)
if
(
!
fo
)
{
fatal_perror
(
"Could not open %s"
,
outname
);
error
(
"Could not open %s
\n
"
,
outname
);
}
if
(
win32
)
if
(
win32
)
{
{
...
@@ -102,5 +100,6 @@ void write_resfile(char *outname, resource_t *top)
...
@@ -102,5 +100,6 @@ void write_resfile(char *outname, resource_t *top)
}
}
}
}
}
}
fclose
(
fo
);
if
(
fclose
(
fo
))
fatal_perror
(
"Error writing %s"
,
outname
);
}
}
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