~sforman/atsea

4cb97ce2164da59985cf818a22cabc872fd8c66a — Simon Forman 1 year, 2 months ago f7244dc trunk
Empty zeroth message simplifies err message selection.
1 files changed, 3 insertions(+), 2 deletions(-)

M heythere.c
M heythere.c => heythere.c +3 -2
@@ 5,6 5,7 @@


const char *MESSAGES[] = {
	"",
	"could not be converted to integer",
	"is too small",
	"is too large",


@@ 47,13 48,13 @@ main(int argc, char **argv)

	err = convert_long_or_die(argv[1], &a);
	if (err) {
		fprintf(stderr, "First arg %s.\n", MESSAGES[err-1]);
		fprintf(stderr, "First arg %s.\n", MESSAGES[err]);
		return 1;
	}

	err = convert_long_or_die(argv[2], &b);
	if (err) {
		fprintf(stderr, "Second arg %s.\n", MESSAGES[err-1]);
		fprintf(stderr, "Second arg %s.\n", MESSAGES[err]);
		return 1;
	}