Commit eb9c53a1 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

tools/fnt2fon: Remove error() as it is almost unused. Transform errno into a…

tools/fnt2fon: Remove error() as it is almost unused. Transform errno into a meaningful string for the error message.
parent bcfb9be3
......@@ -28,6 +28,7 @@
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <errno.h>
#include <fcntl.h>
#ifdef HAVE_IO_H
# include <io.h>
......@@ -78,19 +79,6 @@ static void usage(char **argv)
#define __attribute__(X)
#endif
static void error(const char *s, ...) __attribute__((format (printf, 1, 2)));
static void error(const char *s, ...)
{
va_list ap;
va_start(ap, s);
fprintf(stderr, "Error: ");
vfprintf(stderr, s, ap);
fprintf(stderr, "\n");
va_end(ap);
exit(1);
}
int main(int argc, char **argv)
{
int i, j;
......@@ -123,13 +111,14 @@ int main(int argc, char **argv)
for(i = 0; i < num_files; i++) {
fp = fopen(argv[i+1], "rb");
if(!fp) {
fprintf(stderr, "Can't open %s\n", argv[i+1]);
fprintf(stderr, "error: unable to open %s for reading: %s\n", argv[i+1], strerror(errno));
usage(argv);
exit(1);
}
fread(&ver, sizeof(short), 1, fp);
if(ver != 0x200 && ver != 0x300) {
error("invalid fnt file %s ver %d", argv[i+1], ver);
fprintf(stderr, "error: invalid fnt file %s ver %d\n", argv[i+1], ver);
exit(1);
}
fread(file_lens + i, sizeof(int), 1, fp);
fseek(fp, 0x44, SEEK_SET);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment