f7244dcd05ddb0aae3de1e5de167605abe423319 — Simon Forman 1 year, 2 months ago 20b6480
Change variable name.

This is a goof thing to do?  Use enums for the message identifiers
instead of index ints into MESSAGES[]?  How to coordinate enums with
indexes?  Return char* error messages instead of ints for errors?
"Somebody else has had this problem."
1 files changed, 12 insertions(+), 6 deletions(-)

M heythere.c
M heythere.c => heythere.c +12 -6
@@ 37,21 37,27 @@ convert_long_or_die(char *str, long *a)
main(int argc, char **argv)
	long a;
	int n;
	long a, b;
	int err;

	if (3 != argc) {
		fprintf(stderr, "Usage: %s start end\n", argv[0]);
		return 1;

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

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

	printf("Two numbers! %ld %ld\n", a, b);
	return 0;