diff options
author | midipix <writeonce@midipix.org> | 2016-10-26 22:04:54 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-10-26 22:10:46 -0400 |
commit | 8fcd204b2f1998dbc1273d679a1036c2d67c2100 (patch) | |
tree | 0fd4f6b3be762d0f7a2ab8b7f90fa43ce7cba4ff | |
parent | 01e286068f6dd15502a4426b3f470d12d316e0cf (diff) | |
download | apimagic-8fcd204b2f1998dbc1273d679a1036c2d67c2100.tar.bz2 apimagic-8fcd204b2f1998dbc1273d679a1036c2d67c2100.tar.xz |
driver: status codes: refactor and normalize.
-rw-r--r-- | include/apimagic/apimagic.h | 6 | ||||
-rw-r--r-- | src/driver/amgc_amain.c | 8 |
2 files changed, 6 insertions, 8 deletions
diff --git a/include/apimagic/apimagic.h b/include/apimagic/apimagic.h index ec761cd..299dfeb 100644 --- a/include/apimagic/apimagic.h +++ b/include/apimagic/apimagic.h @@ -25,11 +25,7 @@ extern "C" { /* status codes */ #define AMGC_OK 0x00 #define AMGC_USAGE 0x01 -#define AMGC_BAD_OPT 0x02 -#define AMGC_BAD_OPT_VAL 0x03 -#define AMGC_IO_ERROR 0xA0 -#define AMGC_MAP_ERROR 0xA1 -#define AMGC_INIT_ERROR 0xA2 +#define AMGC_ERROR 0x02 /* driver flags */ #define AMGC_DRIVER_VERBOSITY_NONE 0x0000 diff --git a/src/driver/amgc_amain.c b/src/driver/amgc_amain.c index 41b174c..41e188f 100644 --- a/src/driver/amgc_amain.c +++ b/src/driver/amgc_amain.c @@ -68,11 +68,13 @@ int amgc_main(int argc, char ** argv, char ** envp) const char ** unit; if ((ret = amgc_get_driver_ctx(argv,envp,AMGC_DRIVER_FLAGS,&dctx))) - return (ret == AMGC_USAGE) ? !--argc : 2; + return (ret == AMGC_USAGE) + ? !--argc + : AMGC_ERROR; if (dctx->cctx->drvflags & AMGC_DRIVER_VERSION) if ((amgc_version(dctx)) < 0) - return amgc_exit(dctx,2); + return amgc_exit(dctx,AMGC_ERROR); for (unit=dctx->units; *unit; unit++) { if (!(amgc_get_unit_ctx(dctx,*unit,&uctx))) { @@ -81,5 +83,5 @@ int amgc_main(int argc, char ** argv, char ** envp) } } - return amgc_exit(dctx,dctx->errv[0] ? 2 : 0); + return amgc_exit(dctx,dctx->errv[0] ? AMGC_ERROR : AMGC_OK); } |