summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/driver/slbt_driver_ctx.c35
-rw-r--r--src/driver/slbt_split_argv.c22
-rw-r--r--src/internal/slibtool_driver_impl.h21
3 files changed, 66 insertions, 12 deletions
diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c
index 57d8cef..a8aaffb 100644
--- a/src/driver/slbt_driver_ctx.c
+++ b/src/driver/slbt_driver_ctx.c
@@ -96,6 +96,41 @@ const char * slbt_program_name(const char * path)
return argv_program_name(path);
}
+
+int slbt_optv_init(
+ const struct argv_option options[],
+ const struct argv_option ** optv)
+{
+ return argv_optv_init(options,optv);
+}
+
+
+void slbt_argv_scan(
+ char ** argv,
+ const struct argv_option ** optv,
+ struct argv_ctx * ctx,
+ struct argv_meta * meta)
+{
+ return argv_scan(argv,optv,ctx,meta);
+}
+
+
+struct argv_meta * slbt_argv_get(
+ char ** argv,
+ const struct argv_option ** optv,
+ int flags,
+ int fd)
+{
+ return argv_get(argv,optv,flags,fd);
+}
+
+
+void slbt_argv_free(struct argv_meta * meta)
+{
+ return argv_free(meta);
+}
+
+
uint64_t slbt_argv_flags(uint64_t flags)
{
uint32_t ret = 0;
diff --git a/src/driver/slbt_split_argv.c b/src/driver/slbt_split_argv.c
index 8ec189b..bf130a3 100644
--- a/src/driver/slbt_split_argv.c
+++ b/src/driver/slbt_split_argv.c
@@ -10,8 +10,6 @@
#include <stdlib.h>
#include <stdbool.h>
-#define ARGV_DRIVER
-
#include <slibtool/slibtool.h>
#include "slibtool_version.h"
#include "slibtool_driver_impl.h"
@@ -66,13 +64,13 @@ int slbt_split_argv(
ARGV_MODE_SCAN,
0,0,0,0,0,0,0};
- program = argv_program_name(argv[0]);
+ program = slbt_program_name(argv[0]);
/* missing arguments? */
if ((altmode = (flags & SLBT_DRIVER_MODE_AR))) {
- argv_optv_init(slbt_ar_options,optv);
+ slbt_optv_init(slbt_ar_options,optv);
} else {
- argv_optv_init(slbt_default_options,optv);
+ slbt_optv_init(slbt_default_options,optv);
}
@@ -83,12 +81,12 @@ int slbt_split_argv(
!!getenv("NO_COLOR"));
/* initial argv scan: ... --mode=xxx ... <compiler> ... */
- argv_scan(argv,optv,&ctx,0);
+ slbt_argv_scan(argv,optv,&ctx,0);
/* invalid slibtool arguments? */
if (ctx.erridx && !ctx.unitidx && altmode) {
if (flags & SLBT_DRIVER_VERBOSITY_ERRORS)
- argv_get(
+ slbt_argv_get(
argv,optv,
slbt_argv_flags(flags),
fderr);
@@ -104,15 +102,15 @@ int slbt_split_argv(
compiler = argv[ctx.unitidx];
argv[ctx.unitidx] = 0;
- meta = argv_get(argv,optv,ARGV_VERBOSITY_NONE,fderr);
+ meta = slbt_argv_get(argv,optv,ARGV_VERBOSITY_NONE,fderr);
argv[ctx.unitidx] = compiler;
} else {
- meta = argv_get(argv,optv,ARGV_VERBOSITY_NONE,fderr);
+ meta = slbt_argv_get(argv,optv,ARGV_VERBOSITY_NONE,fderr);
}
if (!meta) {
if (flags & SLBT_DRIVER_VERBOSITY_ERRORS)
- argv_get(
+ slbt_argv_get(
argv,optv,
slbt_argv_flags(flags),
fderr);
@@ -145,12 +143,12 @@ int slbt_split_argv(
aropt = mode;
/* release temporary argv meta context */
- argv_free(meta);
+ slbt_argv_free(meta);
/* error not due to an altmode argument? */
if (!aropt && ctx.erridx && (ctx.erridx == ctx.unitidx)) {
if (flags & SLBT_DRIVER_VERBOSITY_ERRORS)
- argv_get(
+ slbt_argv_get(
argv,optv,
slbt_argv_flags(flags),
fderr);
diff --git a/src/internal/slibtool_driver_impl.h b/src/internal/slibtool_driver_impl.h
index 52ccf9d..825eb2a 100644
--- a/src/internal/slibtool_driver_impl.h
+++ b/src/internal/slibtool_driver_impl.h
@@ -172,9 +172,30 @@ struct slbt_archive_ctx_impl {
const char * slbt_program_name(const char *);
+int slbt_optv_init(
+ const struct argv_option[],
+ const struct argv_option **);
+
+
uint64_t slbt_argv_flags(uint64_t flags);
+void slbt_argv_scan(
+ char ** argv,
+ const struct argv_option ** optv,
+ struct argv_ctx * ctx,
+ struct argv_meta * meta);
+
+
+struct argv_meta * slbt_argv_get(
+ char **,
+ const struct argv_option **,
+ int flags,
+ int fd);
+
+void slbt_argv_free(struct argv_meta *);
+
+
int slbt_driver_usage(
int fdout,
const char * program,