ref: a54b1bf699483082662e8ed92f15124bd2a77d50
parent: 09f5da73611db3395b97ab9e1746a0eb4e9736af
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon Feb 19 11:51:52 EST 2018
[ar] Use a haslist variable This variable marks when the original command line had a list of members. We cannot use the list itself because it is modified by the program.
--- a/ar/main.c
+++ b/ar/main.c
@@ -15,7 +15,7 @@
char *argv0;
-static int bflag, iflag, vflag, cflag, lflag, uflag, aflag;
+static int bflag, iflag, vflag, cflag, lflag, uflag, aflag, haslist;
static char *posname, *tmpafile1, *tmpafile2;
struct arop {
@@ -278,7 +278,7 @@
long siz;
FILE *fp;
- if (*files && !inlist(op->fname, files))
+ if (haslist && !inlist(op->fname, files))
return;
if (vflag)
printf("x - %s\n", op->fname);
@@ -308,7 +308,7 @@
long siz;
int c;
- if (*files && !inlist(op->fname, files))
+ if (haslist && !inlist(op->fname, files))
return;
if (vflag)
printf("\n<%s>\n\n", op->fname);
@@ -324,7 +324,7 @@
struct ar_hdr *hdr = &op->hdr;
char mtime[30];
- if (*files && !inlist(op->fname, files))
+ if (haslist && !inlist(op->fname, files))
return;
if (!vflag) {
printf("%s\n", op->fname);
@@ -517,6 +517,7 @@
}
return;
}
+ haslist = *flist != NULL;
switch (key) {
case 'r':