tools/fnt2fon: Remove error() as it is almost unused. Transform errno into a meaningful string for the error message.

This commit is contained in:
Francois Gouget 2007-10-18 17:05:11 +02:00 committed by Alexandre Julliard
parent bcfb9be370
commit eb9c53a1cb
1 changed files with 4 additions and 15 deletions

View File

@ -28,6 +28,7 @@
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>
#endif #endif
#include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#ifdef HAVE_IO_H #ifdef HAVE_IO_H
# include <io.h> # include <io.h>
@ -78,19 +79,6 @@ static void usage(char **argv)
#define __attribute__(X) #define __attribute__(X)
#endif #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 main(int argc, char **argv)
{ {
int i, j; int i, j;
@ -123,13 +111,14 @@ int main(int argc, char **argv)
for(i = 0; i < num_files; i++) { for(i = 0; i < num_files; i++) {
fp = fopen(argv[i+1], "rb"); fp = fopen(argv[i+1], "rb");
if(!fp) { 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); usage(argv);
exit(1); exit(1);
} }
fread(&ver, sizeof(short), 1, fp); fread(&ver, sizeof(short), 1, fp);
if(ver != 0x200 && ver != 0x300) { 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); fread(file_lens + i, sizeof(int), 1, fp);
fseek(fp, 0x44, SEEK_SET); fseek(fp, 0x44, SEEK_SET);