summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-06-25 16:25:59 -0400
committermidipix <writeonce@midipix.org>2016-06-25 16:25:59 -0400
commite6f40403d9b387d8da2e184b2b1f5e6e1840b352 (patch)
tree997ed75f14e3f2c3e410615ef9998ce8af64bd61 /src
parent3a6438f57de92b749defbcbebce5390f7e979ef8 (diff)
downloadapimagic-e6f40403d9b387d8da2e184b2b1f5e6e1840b352.tar.bz2
apimagic-e6f40403d9b387d8da2e184b2b1f5e6e1840b352.tar.xz
utility: added amgc_main() as a public interface, refactored accordingly.
Diffstat (limited to 'src')
-rw-r--r--src/apimagic.c18
-rw-r--r--src/internal/apimagic_driver_impl.h1
2 files changed, 9 insertions, 10 deletions
diff --git a/src/apimagic.c b/src/apimagic.c
index db25686..291fe0c 100644
--- a/src/apimagic.c
+++ b/src/apimagic.c
@@ -30,7 +30,7 @@ static const char * const amgc_ver_plain[6] = {
"",""
};
-static ssize_t apimagic_version(struct amgc_driver_ctx * dctx)
+static ssize_t amgc_version(struct amgc_driver_ctx * dctx)
{
const struct amgc_source_version * verinfo;
const char * const * verclr;
@@ -45,7 +45,7 @@ static ssize_t apimagic_version(struct amgc_driver_ctx * dctx)
verclr[4],verinfo->commit,verclr[5]);
}
-static void apimagic_perform_unit_actions(struct amgc_unit_ctx * uctx)
+static void amgc_perform_unit_actions(struct amgc_unit_ctx * uctx)
{
const struct amgc_action * action;
@@ -53,13 +53,13 @@ static void apimagic_perform_unit_actions(struct amgc_unit_ctx * uctx)
amgc_perform_unit_action(uctx,action,0,stdout);
}
-static int apimagic_exit(struct amgc_driver_ctx * dctx, int nerrors)
+static int amgc_exit(struct amgc_driver_ctx * dctx, int nerrors)
{
amgc_free_driver_ctx(dctx);
return nerrors ? 2 : 0;
}
-int apimagic_main(int argc, char ** argv, char ** envp)
+int amgc_main(int argc, char ** argv, char ** envp)
{
int ret;
struct amgc_driver_ctx * dctx;
@@ -70,26 +70,26 @@ int apimagic_main(int argc, char ** argv, char ** envp)
return (ret == AMGC_USAGE) ? !--argc : 2;
if (dctx->cctx->drvflags & AMGC_DRIVER_VERSION)
- if ((apimagic_version(dctx)) < 0)
- return apimagic_exit(dctx,2);
+ if ((amgc_version(dctx)) < 0)
+ return amgc_exit(dctx,2);
for (unit=dctx->units; *unit; unit++) {
if (!(amgc_get_unit_ctx(dctx,*unit,&uctx))) {
- apimagic_perform_unit_actions(uctx);
+ amgc_perform_unit_actions(uctx);
ret += uctx->nerrors;
amgc_free_unit_ctx(uctx);
} else
ret++;
}
- return apimagic_exit(dctx,ret);
+ return amgc_exit(dctx,ret);
}
#ifndef APIMAGIC_IN_A_BOX
int main(int argc, char ** argv, char ** envp)
{
- return apimagic_main(argc,argv,envp);
+ return amgc_main(argc,argv,envp);
}
#endif
diff --git a/src/internal/apimagic_driver_impl.h b/src/internal/apimagic_driver_impl.h
index 27f1f15..c2d7dee 100644
--- a/src/internal/apimagic_driver_impl.h
+++ b/src/internal/apimagic_driver_impl.h
@@ -12,7 +12,6 @@
#define AMGC_TAB_WIDTH 8
#endif
-extern int apimagic_main(int, char **, char **);
extern const struct argv_option amgc_default_options[];
enum app_tags {