aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-07-11 22:15:20 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-07-11 22:15:20 +0200
commit91891145cd6b3d46c8612bd6deb7aff88e5ea772 (patch)
treec077b1fe299bc09160872b4ea3658884b87e0a35
parent68cd2dc506e7440baf1fa5467b84212a8a6a4913 (diff)
downloadbuild-91891145cd6b3d46c8612bd6deb7aff88e5ea772.tar.gz
Adjust -o target syntax
-rw-r--r--build.12
-rw-r--r--build.c7
2 files changed, 4 insertions, 5 deletions
diff --git a/build.1 b/build.1
index 63e46e7..2655ce0 100644
--- a/build.1
+++ b/build.1
@@ -57,7 +57,7 @@ searches for a
.It target
">" <filename without whitespace>
.br
-"-o " <filename without whitespace>
+" -o " <filename without whitespace>
.El
.Pp
The last target found will be counted
diff --git a/build.c b/build.c
index 267f674..f0bfb29 100644
--- a/build.c
+++ b/build.c
@@ -100,11 +100,10 @@ main(int argc, char *argv[])
/* Find target inside command. */
for(b = b+3; *b; b++){
- if(*(b+1) && *(b+2) && *(b+3)
- && strncmp(b, "-o ", 3) == 0)
- strncpy(tgt, b+3,
+ if(strncmp(b, " -o ", 4) == 0)
+ strncpy(tgt, b+4,
MAXTGT-1);
- else if(*(b+1) && *b == '>')
+ else if(*b == '>')
strncpy(tgt, b+1,
MAXTGT-1);
}