shithub: scc

Download patch

ref: 4ddc2fb840920c55d77e82de40b9b666da96d2b3
parent: 73a6628e17cff58f721f995f3ce533432e6703fe
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Thu Feb 15 17:36:48 EST 2018

[ar] Fix some important warnings

I hate gcc, it doesn't give very important warnings, but it gives
very stupid warnings.

--- a/ar/main.c
+++ b/ar/main.c
@@ -50,7 +50,6 @@
 {
 	FILE *fp;
 	char magic[SARMAG+1];
-	struct stat st;
 
 	if ((fp = fopen(afile,"rb")) == NULL) {
 		if (!cflag)
@@ -112,7 +111,7 @@
 	        st.st_uid,
 	        st.st_gid,
 	        st.st_mode,
-	        st.st_size);
+	        (unsigned long long) st.st_size);
 	for (n = 0; (c = getc(from)) != EOF; n++)
 		putc(c, to);
 	if (n & 1)
@@ -163,7 +162,6 @@
 copy(struct ar_hdr *hdr, long siz, FILE *src, FILE *dst)
 {
 	int c;
-	long n;
 
 	fwrite(hdr, sizeof(*hdr), 1, dst);
 	if ((siz & 1) == 1)
@@ -314,7 +312,6 @@
 static void
 list(struct arop *op, char *files[])
 {
-	long long val;
 	time_t t;
 	struct ar_hdr *hdr = &op->hdr;
 	char mtime[30];
@@ -321,14 +318,12 @@
 
 	if (*files && !inlist(op->fname, files))
 		return;
-	if (!print)
-		return;
 	if (!vflag) {
 		printf("%s\n", op->fname);
 	} else {
 		t = totime(op->date);
 		strftime(mtime, sizeof(mtime), "%c", localtime(&t));
-		printf("%s %d/%d\t%s %s\n",
+		printf("%s %ld/%ld\t%s %s\n",
 		       perms(op),
 		       atol(hdr->ar_uid),
 		       atol(hdr->ar_gid),