summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-05-01 12:18:20 -0400
committermidipix <writeonce@midipix.org>2016-05-01 12:34:05 -0400
commitcaf7d04ff1054d24892547900145f93a6fdfadbe (patch)
tree963e0de626816e154e00fd9172ecc0cddda8bb8f /src
parentf1dd4b6f5c13f86b6e1d97100272e91c83675c52 (diff)
downloadslibtool-caf7d04ff1054d24892547900145f93a6fdfadbe.tar.bz2
slibtool-caf7d04ff1054d24892547900145f93a6fdfadbe.tar.xz
driver: slbt_output_raw_vector(): initial implementation.
Diffstat (limited to 'src')
-rw-r--r--src/driver/slbt_driver_ctx.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c
index d738bd8..1dc1358 100644
--- a/src/driver/slbt_driver_ctx.c
+++ b/src/driver/slbt_driver_ctx.c
@@ -54,6 +54,15 @@ static const char*ldrpath_elf[] = {
"usr/local/lib64",
0};
+static const char aclr_reset [] = "\x1b[0m";
+static const char aclr_bold [] = "\x1b[1m";
+static const char aclr_red [] = "\x1b[31m";
+static const char aclr_green [] = "\x1b[32m";
+static const char aclr_yellow[] = "\x1b[33m";
+static const char aclr_blue [] = "\x1b[34m";
+static const char aclr_cyan [] = "\x1b[36m";
+static const char aclr_white [] = "\x1b[37m";
+
struct slbt_split_vector {
char ** targv;
char ** cargv;
@@ -66,6 +75,38 @@ struct slbt_driver_ctx_alloc {
const char * units[];
};
+static void slbt_output_raw_vector(char ** argv, char ** envp)
+{
+ char ** parg;
+ char * dot;
+ const char * color;
+ bool fcolor;
+
+ if ((fcolor = isatty(STDOUT_FILENO)))
+ fprintf(stderr,"%s%s",aclr_bold,aclr_red);
+
+ fprintf(stderr,"\n\n\n%s",argv[0]);
+
+ for (parg=&argv[1]; *parg; parg++) {
+ if (!fcolor)
+ color = "";
+ else if (*parg[0] == '-')
+ color = aclr_blue;
+ else if (!(dot = strrchr(*parg,'.')))
+ color = aclr_green;
+ else if (!(strcmp(dot,".lo")))
+ color = aclr_cyan;
+ else if (!(strcmp(dot,".la")))
+ color = aclr_yellow;
+ else
+ color = aclr_white;
+
+ fprintf(stderr," %s%s",color,*parg);
+ }
+
+ fprintf(stderr,"%s\n\n",fcolor ? aclr_reset : "");
+}
+
static uint32_t slbt_argv_flags(uint32_t flags)
{
uint32_t ret = 0;
@@ -973,6 +1014,10 @@ int slbt_get_driver_ctx(
nunits++;
}
+ /* debug: raw argument vector */
+ if (cctx.drvflags & SLBT_DRIVER_DEBUG)
+ slbt_output_raw_vector(argv,envp);
+
/* -o in install mode means USER */
if ((cctx.mode == SLBT_MODE_INSTALL) && cctx.output) {
cctx.user = cctx.output;