commit 39b8acd6dfa531dbad9276773296511af417b21f
parent b7194efb05c0c01eb926d72ce10471f3a4f5d32d
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date: Wed, 17 May 2023 10:38:11 -0700
Simplify apc's handling of carot
If the first character of the final argument is carot, it is always
removed. At that point if there are no more characters (besides
nul) arguments are taken from the standard input. This is much
more uniform than the previous method, which only removed the first
carot if the next character was also a carot.
Diffstat:
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/apc/apc.c b/apc/apc.c
@@ -162,9 +162,8 @@ main(int argc, char *argv[])
} else {
insert = 0;
if (argv[argc - 1][0] == subchr) {
- if (argv[argc - 1][1] == subchr) {
- ++argv[argc - 1];
- } else if (argv[argc - 1][1] == '\0') {
+ ++argv[argc - 1];
+ if (argv[argc - 1][0] == '\0') {
insert = 1;
--argc;
}