Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!erd
From: erd@tut.cis.ohio-state.edu (Ethan R. Dicks)
Newsgroups: comp.sys.amiga
Subject: Return codes and exit()
Keywords: Lattice exit()/return()
Message-ID: <28455@tut.cis.ohio-state.edu>
Date: 28 Nov 88 02:20:26 GMT
Organization: The Ohio State University Dept of Computer and Information Science
Lines: 39


[ ### 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 

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.