$NetBSD$

--- input/newsspool.c.orig	Fri Apr 28 02:50:59 1995
+++ input/newsspool.c
@@ -156,7 +156,7 @@
 	register char *p;
 
 	p = strsave(fullartfile("in.coming/nspool.XXXXXX"));
-	mktemp(p);
+	mkstemp(p);
 	return(p);
 }
 
@@ -215,12 +215,16 @@
 char *bufp;
 int count;
 {
-	static char goop[] = "cunbatch";
-#	define	GOOPLEN	(sizeof(goop)-1)	/* strlen(goop) */
-	static char suf[] = ".Z";
+	static char c_goop[] = "cunbatch";
+#	define	C_GOOPLEN	(sizeof(c_goop)-1)	/* strlen(c_goop) */
+	static char g_goop[] = "gunbatch";
+#	define	G_GOOPLEN	(sizeof(g_goop)-1)	/* strlen(g_goop) */
+	static char csuf[] = ".Z";
+	static char gsuf[] = ".gz";
 	static char comp[] = "\037\235";	/* compress's magic no. */
-	register char *p;
-	register int nleft;
+	static char gzip[] = "\037\213";	/* gzip's magic no. */
+	char *p;
+	int nleft;
 #	define	MINCBATCH	5		/* one character, compressed */
 
 	nleft = count;
@@ -232,7 +236,14 @@
 	if (p[0] == comp[0] && p[1] == comp[1]) {	/* compressed */
 		if (nleft < MINCBATCH)
 			return(count);
-		suffix = suf;
+		suffix = csuf;
+		return(0);
+	}
+
+	if (p[0] == gzip[0] && p[1] == gzip[1]) {	/* gzipped */
+		if (nleft < MINCBATCH)
+			return(count);
+		suffix = gsuf;
 		return(0);
 	}
 
@@ -247,10 +258,14 @@
 	}
 
 	/* recognize headers (the +1s ensure room for the newline) */
-	if (nleft >= GOOPLEN+1 && STREQN(p, goop, GOOPLEN)) {
-		p += GOOPLEN;
-		nleft -= GOOPLEN;
-		suffix = suf;
+	if (nleft >= C_GOOPLEN+1 && STREQN(p, c_goop, C_GOOPLEN)) {
+		p += C_GOOPLEN;
+		nleft -= C_GOOPLEN;
+		suffix = csuf;
+	} else if (nleft >= G_GOOPLEN+1 && STREQN(p, g_goop, G_GOOPLEN)) {
+		p += G_GOOPLEN;
+		nleft -= G_GOOPLEN;
+		suffix = gsuf;
 	} else					/* no header */
 		return(0);
 
