module Sysexits

def exit( status=EX_OK )

## keys of STATUS_CODES or a number.
## Exit with the exit +status+, which can be either one of the
def exit( status=EX_OK )
	status = exit_status( status )
	::Kernel.exit( status )
end

def exit!( status=EX_OK )

## Exit with the given +status+ without running exit handlers.
def exit!( status=EX_OK )
	status = exit_status( status )
	::Kernel.exit!( status )
end

def exit_status( status )

## Turn +status+ into a numeric exit status and return it.
def exit_status( status )
	case status
	when Symbol, String
		return STATUS_CODES[ status.to_sym ] || status
	else
		return status
	end
end