scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 2e8217b7eced5b5af1048a3ba7144c0adb5b46c2
parent 4d90e3d1507444cb0edb5a53ccefa3b1d958abae
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:
Msrc/cmd/ar.c | 9++++++---
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 {