[comp.sys.amiga] Return codes and exit

erd@tut.cis.ohio-state.edu (Ethan R. Dicks) (11/28/88)

[ ### Good wholesome Ralston Purina Line Eater Chow (tm) ### ]


I have been using Lattice C 4.01 for a while, and noticed that when I return
an error code, the AmigaDOS command 'why' gives a large multi-digit number.

Here is a sample of code which does it...

#include <stdio.h>

main(argc,argv)

int argc;
char *argv[];

{

	if (argc < 2 ) {
		printf("Usage: command datafile\n");
		exit(1);
	}
	return(0);
}

If the number of args is 2 or more, why tells me that the last command did
not set a return code... no problem.

If the number of args is 1 (run from CLI), I get the "usage" message and
why tells me that the return code is 1673844.

Why is this?

-ethan
-- 
Ethan R. Dicks       | ######  This signifies that the poster is a member in
Software Results Corp|   ##    good sitting of Inertia House: Bodies at rest.
2887 Silver Drive    |   ##
Columbus OH    43211 | ######  "You get it, you're closer.