summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-10-24 12:43:15 -0400
committermidipix <writeonce@midipix.org>2016-10-24 12:44:08 -0400
commit0254dfb578e56cdc5cfef8df959b45fb454e3a8f (patch)
tree21812f4d6ec45a28b8e27ebcbac4fdfd6abea013
parent1379f79d286988f2582ff8efb1af736bf4229a3f (diff)
downloadslibtool-0254dfb578e56cdc5cfef8df959b45fb454e3a8f.tar.bz2
slibtool-0254dfb578e56cdc5cfef8df959b45fb454e3a8f.tar.xz
driver: status codes: refactor and normalize.
-rw-r--r--include/slibtool/slibtool.h5
-rw-r--r--src/driver/slbt_amain.c14
2 files changed, 9 insertions, 10 deletions
diff --git a/include/slibtool/slibtool.h b/include/slibtool/slibtool.h
index 1a4b9fe..4aa2552 100644
--- a/include/slibtool/slibtool.h
+++ b/include/slibtool/slibtool.h
@@ -23,10 +23,7 @@ extern "C" {
/* status codes */
#define SLBT_OK 0x00
#define SLBT_USAGE 0x01
-#define SLBT_BAD_OPT 0x02
-#define SLBT_BAD_OPT_VAL 0x03
-#define SLBT_IO_ERROR 0xA0
-#define SLBT_MAP_ERROR 0xA1
+#define SLBT_ERROR 0x02
/* driver flags */
#define SLBT_DRIVER_VERBOSITY_NONE 0x0000
diff --git a/src/driver/slbt_amain.c b/src/driver/slbt_amain.c
index 5d1417e..4c66820 100644
--- a/src/driver/slbt_amain.c
+++ b/src/driver/slbt_amain.c
@@ -100,9 +100,9 @@ int slbt_main(int argc, char ** argv, char ** envp)
sargv[4] = 0;
return (slbt_get_driver_ctx(sargv,envp,SLBT_DRIVER_FLAGS,&dctx))
- ? 2 : (slbt_version(dctx) < 0)
- ? slbt_exit(dctx,2)
- : slbt_exit(dctx,0);
+ ? SLBT_ERROR : (slbt_version(dctx) < 0)
+ ? slbt_exit(dctx,SLBT_ERROR)
+ : slbt_exit(dctx,SLBT_OK);
}
/* program */
@@ -146,13 +146,15 @@ int slbt_main(int argc, char ** argv, char ** envp)
/* driver context */
if ((ret = slbt_get_driver_ctx(argv,envp,flags,&dctx)))
- return (ret == SLBT_USAGE) ? !--argc : 2;
+ return (ret == SLBT_USAGE)
+ ? !--argc
+ : SLBT_ERROR;
if (dctx->cctx->drvflags & SLBT_DRIVER_VERSION)
if ((slbt_version(dctx)) < 0)
- return slbt_exit(dctx,2);
+ return slbt_exit(dctx,SLBT_ERROR);
slbt_perform_driver_actions(dctx);
- return slbt_exit(dctx,dctx->errv[0] ? 2 : 0);
+ return slbt_exit(dctx,dctx->errv[0] ? SLBT_ERROR : SLBT_OK);
}