shithub: scc

Download patch

ref: 28f4f2683abee60783f2bef64c48db65b950855b
parent: 6ae1553550ce5ed7780482765cabacc3fa29a50d
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Wed Feb 14 09:06:07 EST 2018

[lib/scc] Remove war.c and war.h

These files are not used anymore since we are going to use
the struct directly, as it is in /usr/include/ar.h.

--- a/lib/scc/libdep.mk
+++ b/lib/scc/libdep.mk
@@ -11,5 +11,3 @@
           $(LIBDIR)/lpack.o \
           $(LIBDIR)/wmyro.o \
           $(LIBDIR)/rmyro.o \
-          $(LIBDIR)/war.o \
-          $(LIBDIR)/rar.o \
--- a/lib/scc/rar.c
+++ /dev/null
@@ -1,33 +1,0 @@
-static char sccsid[] = "@(#) ./lib/scc/rar.c";
-
-#include <assert.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "../../inc/ar.h"
-
-int
-rdarhdr(FILE *fp, struct arhdr *hdr)
-{
-	char buf[ARHDR_SIZ+1];
-	size_t len;
-	int n;
-
-	if (!fgets(buf, sizeof(buf), fp))
-		return EOF;
-	if ((len = strlen(buf)) != ARHDR_SIZ ||
-	    buf[len-2] != '`' ||
-	    buf[len-1] != '\n') {
-		return EOF;
-	}
-
-	n = sscanf(buf, "%16s-%llu-%u-%u-%o-%llu",
-	           &hdr->name,
-	           &hdr->time,
-	           &hdr->uid, &hdr->gid,
-	           &hdr->mode,
-	           &hdr->size);
-	if (n != 6)
-		return EOF;
-	return (feof(fp)) ? EOF : 0;
-}
--- a/lib/scc/war.c
+++ /dev/null
@@ -1,38 +1,0 @@
-static char sccsid[] = "@(#) ./lib/scc/war.c";
-
-#include <assert.h>
-#include <stdio.h>
-
-#include "../../inc/ar.h"
-
-int
-wrarhdr(FILE *fp, struct arhdr *hdr)
-{
-	int len;
-
-	len = fprintf(fp,
-	              "%-16s%-12llu%-6u%-6u%-8o%-10llu`\n",
-	              hdr->name,
-	              hdr->time,
-	              hdr->uid, hdr->gid,
-	              hdr->mode,
-	              hdr->size);
-	assert(len== ARHDR_SIZ);
-
-	return (feof(fp)) ? EOF : len;
-}
-
-int
-wrarfile(FILE *fo, struct arhdr *hdr)
-{
-	FILE *fi;
-	int c;
-
-	if ((fi = fopen(hdr->name, "rb")) == NULL)
-		return -1;
-	while ((c = getc(fi)) != EOF)
-		putc(c, fo);
-	if (hdr->size & 1)
-		putc('\n', fo);
-	return (fclose(fi) == EOF) ? -1 : 0;
-}