commit 2b7fc269472d283082e0e53f4b92f18278b15ad6
parent 6d6cccc6cc7d73c1591b4bb8f84231f9f94e4b02
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 19 Jan 2020 12:44:11 +0100
ar: Fix -r flag
When update flag (-u) was added the logic changed and files
were updated only when files were older and -u was passed.
It means that without -u all the files were removed from
the archive.
Diffstat:
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/cmd/ar.c b/src/cmd/ar.c
@@ -257,10 +257,13 @@ update(struct member *m, int argc, char *argv[])
char *pname;
if (pname = inlist(m->fname, argc, argv)) {
- if (uflag && older(m, pname))
+ if (!uflag || older(m, pname)) {
archive(pname, tmps[m->cur].fp, 'r');
- return;
- } else if (posname && !strcmp(posname, m->fname)) {
+ return;
+ }
+ }
+
+ if (posname && !strcmp(posname, m->fname)) {
where = (bflag) ? AFTER : BEFORE;
m->cur = AFTER;
} else {