exit() on vms, one more time

Martin Minow minow at decvax.UUCP
Thu Feb 20 11:19:36 AEST 1986


First, for the record, I have no connection with the Ultrix
or Vax C groups (I work on DECtalk) and am offering only
my own opinions.

In a previous note, I pointed out that the Vax C developers
used exit() to return a VMS system status code to the parent
process.  Several people suggested that this is incorrect,
and doesn't conform to the Draft Standard.

The Vax C development predates the Draft Standard by about 5
years.  Decus C, which also made the same "mistake", was
first publicly distributed in 1978, so it, too, predates
the Draft Standard's implementation by a number of years.

I would imagine that the Vax C developers used Kernighan and
Ritchie for their language reference, and the Unix V6 manuals
for the library.  The description of exit is quite explicit:

  Exit closes all the process's files and notifies the
  parent process if it is exeucting a wait.  The low byte
  of r0 (resp. the argument to exit) is available as status
  to the parent process.

The manual page dates from 1973.

Whether exit() will change is not for me to say.  One possible
solution would be, say,

	exit(code) {
	    switch (code) {
	    case 0:	code = SS$_NORMAL;	break;
	    case 1:	code = SS$_ABORT;	break;
	    }
	    _exit(code);
	}

Exit codes provide an example where existing practice differs
on different operating systems.  The Draft Standard may change
before it is approved, and existing programs may have to change
to conform to the standard, once adapted.

Martin Minow
decvax!minow



More information about the Comp.lang.c mailing list