summaryrefslogtreecommitdiffhomepage
path: root/src/logic
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-06-27 03:51:35 +0000
committermidipix <writeonce@midipix.org>2018-06-27 07:30:01 -0400
commita82cc2f34bddae9b79e582a3bcc6b2c9cbb5009b (patch)
tree1d0de0094b350cf323b6ea8ee44f571918048789 /src/logic
parent6088476d902b8bcbf688ce7cb6055a4c47c2d0b7 (diff)
downloadslibtool-a82cc2f34bddae9b79e582a3bcc6b2c9cbb5009b.tar.bz2
slibtool-a82cc2f34bddae9b79e582a3bcc6b2c9cbb5009b.tar.xz
driver, library interfaces: support alternate fd's for input/output/error/log.
Diffstat (limited to 'src/logic')
-rw-r--r--src/logic/slbt_exec_install.c15
-rw-r--r--src/logic/slbt_exec_uninstall.c20
2 files changed, 24 insertions, 11 deletions
diff --git a/src/logic/slbt_exec_install.c b/src/logic/slbt_exec_install.c
index c00215a..e15a4b2 100644
--- a/src/logic/slbt_exec_install.c
+++ b/src/logic/slbt_exec_install.c
@@ -23,6 +23,7 @@
#include "argv/argv.h"
static int slbt_install_usage(
+ int fdout,
const char * program,
const char * arg,
const struct argv_option ** optv,
@@ -35,7 +36,7 @@ static int slbt_install_usage(
"Options:\n",
program);
- argv_usage(STDOUT_FILENO,header,optv,arg);
+ argv_usage(fdout,header,optv,arg);
argv_free(meta);
return SLBT_USAGE;
@@ -536,6 +537,7 @@ int slbt_exec_install(
struct slbt_exec_ctx * ectx)
{
int ret;
+ int fdout;
char ** argv;
char ** iargv;
char ** src;
@@ -565,6 +567,7 @@ int slbt_exec_install(
slbt_reset_arguments(ectx);
slbt_disable_placeholders(ectx);
iargv = ectx->cargv;
+ fdout = slbt_driver_fdout(dctx);
/* work around non-conforming uses of --mode=install */
if (!(strcmp(iargv[0],"/bin/sh")) || !strcmp(iargv[0],"/bin/bash"))
@@ -574,16 +577,18 @@ int slbt_exec_install(
argv_optv_init(slbt_install_options,optv);
if (!iargv[1] && (dctx->cctx->drvflags & SLBT_DRIVER_VERBOSITY_USAGE))
- return slbt_install_usage(dctx->program,0,optv,0);
+ return slbt_install_usage(
+ fdout,
+ dctx->program,
+ 0,optv,0);
/* <install> argv meta */
if (!(meta = argv_get(
- iargv,
- optv,
+ iargv,optv,
dctx->cctx->drvflags & SLBT_DRIVER_VERBOSITY_ERRORS
? ARGV_VERBOSITY_ERRORS
: ARGV_VERBOSITY_NONE,
- STDERR_FILENO)))
+ fdout)))
return slbt_exec_install_fail(
actx,meta,
SLBT_CUSTOM_ERROR(dctx,SLBT_ERR_INSTALL_FAIL));
diff --git a/src/logic/slbt_exec_uninstall.c b/src/logic/slbt_exec_uninstall.c
index 1168c7d..b733d27 100644
--- a/src/logic/slbt_exec_uninstall.c
+++ b/src/logic/slbt_exec_uninstall.c
@@ -21,6 +21,7 @@
#include "argv/argv.h"
static int slbt_uninstall_usage(
+ int fdout,
const char * program,
const char * arg,
const struct argv_option ** optv,
@@ -33,7 +34,7 @@ static int slbt_uninstall_usage(
"Options:\n",
program);
- argv_usage(STDOUT_FILENO,header,optv,arg);
+ argv_usage(fdout,header,optv,arg);
argv_free(meta);
return SLBT_USAGE;
@@ -245,6 +246,7 @@ int slbt_exec_uninstall(
struct slbt_exec_ctx * ectx)
{
int ret;
+ int fdout;
char ** argv;
char ** iargv;
uint32_t flags;
@@ -269,6 +271,7 @@ int slbt_exec_uninstall(
slbt_reset_arguments(ectx);
slbt_disable_placeholders(ectx);
iargv = ectx->cargv;
+ fdout = slbt_driver_fdout(dctx);
/* work around non-conforming uses of --mode=uninstall */
if (!(strcmp(iargv[0],"/bin/sh")) || !strcmp(iargv[0],"/bin/bash"))
@@ -278,16 +281,18 @@ int slbt_exec_uninstall(
argv_optv_init(slbt_uninstall_options,optv);
if (!iargv[1] && (dctx->cctx->drvflags & SLBT_DRIVER_VERBOSITY_USAGE))
- return slbt_uninstall_usage(dctx->program,0,optv,0);
+ return slbt_uninstall_usage(
+ fdout,
+ dctx->program,
+ 0,optv,0);
/* <uninstall> argv meta */
if (!(meta = argv_get(
- iargv,
- optv,
+ iargv,optv,
dctx->cctx->drvflags & SLBT_DRIVER_VERBOSITY_ERRORS
? ARGV_VERBOSITY_ERRORS
: ARGV_VERBOSITY_NONE,
- STDERR_FILENO)))
+ fdout)))
return slbt_exec_uninstall_fail(
actx,meta,
SLBT_CUSTOM_ERROR(dctx,SLBT_ERR_UNINSTALL_FAIL));
@@ -329,7 +334,10 @@ int slbt_exec_uninstall(
/* --help */
if (flags & SLBT_UNINSTALL_HELP) {
- slbt_uninstall_usage(dctx->program,0,optv,meta);
+ slbt_uninstall_usage(
+ fdout,
+ dctx->program,
+ 0,optv,meta);
return 0;
}