ap

An audio player suited to my tastes
Log | Files | Refs | README | LICENSE

commit 0df06fe0559d57fedada8667bd722a11f756f638
parent 85fa954d29f13d1c6a75822cdf86de461f8865bc
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date:   Thu, 26 Aug 2021 12:02:03 -0700

Allow escaping stdin substitution character

Diffstat:
Mapc/apc.c | 14++++++++++----
Dapc/config.h | 1-
Mapc/mkfile | 2+-
3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/apc/apc.c b/apc/apc.c @@ -30,9 +30,10 @@ #include <ap.h> -#include "config.h" #include "die.h" +static char subchr = '^'; + int mksend(int sock, char **argv, int argc) { @@ -124,9 +125,14 @@ main(int argc, char **argv) die("fdopen"); sub = 0; - for (i = 1; !sub && i < argc; ++i) - if (strcmp(argv[i], substr) == 0) - sub = i; + for (i = 1; !sub && i < argc; ++i) { + if (argv[i][0] == subchr) { + if (argv[i][1] == '\0') + sub = i; + else if (argv[i][1] == subchr) + ++argv[i]; + } + } if (!sub) { status = run(bfd, argv + 1, argc - 1); diff --git a/apc/config.h b/apc/config.h @@ -1 +0,0 @@ -static char *substr = "^"; diff --git a/apc/mkfile b/apc/mkfile @@ -17,7 +17,7 @@ apc.h:VQ: dir: ${lib:%=../lib/%} -$obj: mkfile config.h ${obj:%.o=%.h} +$obj: mkfile ${obj:%.o=%.h} $name: dir