Module: wine Branch: master Commit: eb9c53a1cb87b6608c3bcf5e2c9ba25b4006c6af URL: http://source.winehq.org/git/wine.git/?a=commit;h=eb9c53a1cb87b6608c3bcf5e2c...
Author: Francois Gouget fgouget@free.fr Date: Thu Oct 18 17:05:11 2007 +0200
tools/fnt2fon: Remove error() as it is almost unused. Transform errno into a meaningful string for the error message.
---
tools/fnt2fon.c | 19 ++++--------------- 1 files changed, 4 insertions(+), 15 deletions(-)
diff --git a/tools/fnt2fon.c b/tools/fnt2fon.c index 3f82fd9..87c5ab7 100644 --- a/tools/fnt2fon.c +++ b/tools/fnt2fon.c @@ -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);