This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
exit status <-> portable code
- From: "Hannu E K Nevalainen" <garbage_collector at telia dot com>
- To: "ML CygWIN" <cygwin at cygwin dot com>
- Date: Tue, 11 Nov 2003 17:01:16 +0100
- Subject: exit status <-> portable code
#define "exit status" "return code"
I dispise literal numbers in code - it lessens readabilty, portability and
maybe one or two "-bility's" more.
e.g: When using AmigaDOS headers for console mode program/command
development I have this available:
$ tail +230 /Amiga/NDU31/include/dos/dos.h | head -6
/* These are the return codes used by convention by AmigaDOS commands */
/* See FAILAT and IF for relvance to EXECUTE files */
#define RETURN_OK 0 /* No problems, success */
#define RETURN_WARN 5 /* A warning only */
#define RETURN_ERROR 10 /* Something wrong */
#define RETURN_FAIL 20 /* Complete or severe failure*/
Using these I can write programs that look like:
$ cat hickup.c
#include <stdio.h>
#include <dos/dos.h>
int main(...) {
int success=RETURN_FAIL;
if (all_OK)
success=RETURN_OK;
return success;
}
Q: Is there anything within Cygwin (or Linux, Net*, U*X, whatever... that
can be transferred to Cygwin) that can be used for the same purpose?
/Hannu E K Nevalainen, B.Sc. EE - 59+16.37'N, 17+12.60'E
-- printf("LocalTime: UTC+%02d\n",(DST)? 2:1); --
--END OF MESSAGE--
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/