tools/fnt2fon: Remove error() as it is almost unused. Transform errno into a meaningful string for the error message.
This commit is contained in:
parent
bcfb9be370
commit
eb9c53a1cb
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue