Use EXIT_SUCCESS and EXIT_FAILURE

This is a bit of C pedantry.  POSIX requires that an exit status of
zero is success and non-zero is failure, but the C standard says no
such thing.  Instead it provides EXIT_SUCCESS and EXIT_FAILURE.  Since
Bedstead aspires to work on non-POSIX systems, it should use the
defined constants.  Also removing magic numbers is a good thing.
This commit is contained in:
Ben Harris 2024-11-10 09:27:31 +00:00
parent cba03ce5fd
commit c2e45853f7

View File

@ -2733,7 +2733,7 @@ main(int argc, char **argv)
if (argc == 2 && strcmp(argv[1], "--complement") == 0) {
glyph_complement();
return 0;
return EXIT_SUCCESS;
}
while (argc > 1) {
@ -2757,7 +2757,7 @@ main(int argc, char **argv)
break;
} else if (argv[1][0] == '-') {
fprintf(stderr, "unknown option '%s'\n", argv[1]);
return 1;
return EXIT_FAILURE;
} else break;
argv++; argc--;
next:;
@ -2775,18 +2775,18 @@ main(int argc, char **argv)
for (i = 1; i < argc; i++) {
if (y >= YSIZE) {
fprintf(stderr, "too many arguments\n");
return 1;
return EXIT_FAILURE;
}
u = strtoul(argv[i], &endptr, 0);
if (u > 077 || !argv[i] || *endptr) {
fprintf(stderr, "invalid argument \"%s\"\n",
argv[i]);
return 1;
return EXIT_FAILURE;
}
data[y++] = u;
}
dochar(data, 0);
return 0;
return EXIT_SUCCESS;
}
/* Put glyphs into FontForge-compatible order. */
@ -2935,7 +2935,7 @@ main(int argc, char **argv)
}
printf("EndChars\n");
printf("EndSplineFont\n");
return 0;
return EXIT_SUCCESS;
}
static void