commit 474195b

Michael Forney  ·  2026-04-03 00:29:57 +0000 UTC
parent 8b1391b
ncompress: Use prototype definitions
4 files changed,  +198, -1
+1, -0
1@@ -316,6 +316,7 @@
2 [submodule "pkg/ncompress/src"]
3 	path = pkg/ncompress/src
4 	url = https://github.com/vapier/ncompress
5+	ignore = all
6 [submodule "pkg/pax/src"]
7 	path = pkg/pax/src
8 	url = https://git.sr.ht/~mcf/pax
+171, -0
  1@@ -0,0 +1,171 @@
  2+From 32ae5e241237d325b8108660f82419ce684a62a8 Mon Sep 17 00:00:00 2001
  3+From: Mike Frysinger <vapier@gmail.com>
  4+Date: Mon, 8 Feb 2021 00:28:08 -0500
  5+Subject: [PATCH] require standard C function prototype support
  6+
  7+We can drop the main prototype entirely as we don't need it.
  8+---
  9+ Changes    |  3 +++
 10+ compress.c | 58 +++++++++++++++++++-----------------------------------
 11+ 2 files changed, 23 insertions(+), 38 deletions(-)
 12+
 13+diff --git a/Changes b/Changes
 14+index 5bef4ec..40cd58d 100644
 15+--- a/Changes
 16++++ b/Changes
 17+@@ -1,3 +1,6 @@
 18++(N)compress version 5.1
 19++	* Use modern standard C function prototypes
 20++
 21+ (N)compress version 5.0
 22+ 	* New stream for cleanups
 23+ 	* Drop support for 2.0 output & -C option
 24+diff --git a/compress.c b/compress.c
 25+index 66cacf1..691ff2b 100644
 26+--- a/compress.c
 27++++ b/compress.c
 28+@@ -168,12 +168,6 @@
 29+ 	};
 30+ #endif
 31+ 
 32+-#ifdef	__STDC__
 33+-#	define	ARGS(a)				a
 34+-#else
 35+-#	define	ARGS(a)				()
 36+-#endif
 37+-
 38+ #ifndef SIG_TYPE
 39+ #	define	SIG_TYPE	void (*)()
 40+ #endif
 41+@@ -527,17 +521,16 @@ long 			bytes_out;			/* Total number of byte to output				*/
 42+ 	} ;
 43+ #endif
 44+ 
 45+-int  	main			ARGS((int,char **));
 46+-void  	Usage			ARGS((int));
 47+-void  	comprexx		ARGS((const char *));
 48+-void  	compdir			ARGS((char *));
 49+-void  	compress		ARGS((int,int));
 50+-void  	decompress		ARGS((int,int));
 51+-void  	read_error		ARGS((void));
 52+-void  	write_error		ARGS((void));
 53+-void 	abort_compress	ARGS((void));
 54+-void  	prratio			ARGS((FILE *,long,long));
 55+-void  	about			ARGS((void));
 56++void  	Usage			(int);
 57++void  	comprexx		(const char *);
 58++void  	compdir			(char *);
 59++void  	compress		(int, int);
 60++void  	decompress		(int, int);
 61++void  	read_error		(void);
 62++void  	write_error		(void);
 63++void 	abort_compress	(void);
 64++void  	prratio			(FILE *, long, long);
 65++void  	about			(void);
 66+ 
 67+ /*****************************************************************
 68+  * TAG( main )
 69+@@ -580,9 +573,7 @@ void  	about			ARGS((void));
 70+  *   procedure needs no input table, but tracks the way the table was built.
 71+  */ 
 72+ int
 73+-main(argc, argv)
 74+-	int 	 argc;
 75+-	char	*argv[];
 76++main(int argc, char *argv[])
 77+ 	{
 78+ 		char **filelist;
 79+ 		char **fileptr;
 80+@@ -794,8 +785,7 @@ Usage: %s [-dfhvcVr] [-b maxbits] [--] [path ...]\n\
 81+ 	}
 82+ 
 83+ void
 84+-comprexx(fileptr)
 85+-	const char	*fileptr;
 86++comprexx(const char	*fileptr)
 87+ 	{
 88+ 		int				 fdin = -1;
 89+ 		int				 fdout = -1;
 90+@@ -1144,8 +1134,7 @@ error:
 91+ 
 92+ #ifdef	RECURSIVE
 93+ void
 94+-compdir(dir)
 95+-	char	*dir;
 96++compdir(char *dir)
 97+ 	{
 98+ 		struct dirent *dp;
 99+ 		DIR *dirp;
100+@@ -1221,9 +1210,7 @@ compdir(dir)
101+  * questions about this implementation to ames!jaw.
102+  */
103+ void
104+-compress(fdin, fdout)
105+-	int		fdin;
106+-	int		fdout;
107++compress(int fdin, int fdout)
108+ 	{
109+ 		long hp;
110+ 		int rpos;
111+@@ -1460,9 +1447,7 @@ endlop:			if (fcode.e.ent >= FIRST && rpos < rsize)
112+  */
113+ 
114+ void
115+-decompress(fdin, fdout)
116+-	int		fdin;
117+-	int		fdout;
118++decompress(int fdin, int fdout)
119+ 	{
120+ 		char_type *stackp;
121+ 		code_int code;
122+@@ -1687,7 +1672,7 @@ resetbuf:	;
123+ 	}
124+ 
125+ void
126+-read_error()
127++read_error(void)
128+ 	{
129+ 		fprintf(stderr, "\nread error on");
130+ 	    perror((ifname[0] != '\0') ? ifname : "stdin");
131+@@ -1695,7 +1680,7 @@ read_error()
132+ 	}
133+ 
134+ void
135+-write_error()
136++write_error(void)
137+ 	{
138+ 		fprintf(stderr, "\nwrite error on");
139+ 	    perror(ofname ? ofname : "stdout");
140+@@ -1703,7 +1688,7 @@ write_error()
141+ 	}
142+ 
143+ void
144+-abort_compress()
145++abort_compress(void)
146+ 	{
147+ 		if (remove_ofname)
148+ 	    	unlink(ofname);
149+@@ -1712,10 +1697,7 @@ abort_compress()
150+ 	}
151+ 
152+ void
153+-prratio(stream, num, den)
154+-	FILE		*stream;
155+-	long int	 num;
156+-	long int	 den;
157++prratio(FILE *stream, long int num, long int den)
158+ 	{
159+ 		int q;			/* Doesn't need to be long */
160+ 
161+@@ -1739,7 +1721,7 @@ prratio(stream, num, den)
162+ 	}
163+ 
164+ void
165+-about()
166++about(void)
167+ 	{
168+ 		printf("Compress version: %s\n", version_id);
169+ 		printf("Compile options:\n        ");
170+-- 
171+2.49.0
172+
+25, -0
 1@@ -0,0 +1,25 @@
 2+From 62f8f697809fb2579ac2cc39aa9907140b4b1249 Mon Sep 17 00:00:00 2001
 3+From: Michael Forney <mforney@mforney.org>
 4+Date: Thu, 2 Apr 2026 17:31:35 -0700
 5+Subject: [PATCH] Use prototype for SIG_TYPE
 6+
 7+---
 8+ compress.c | 2 +-
 9+ 1 file changed, 1 insertion(+), 1 deletion(-)
10+
11+diff --git a/compress.c b/compress.c
12+index 691ff2b..a7bd65a 100644
13+--- a/compress.c
14++++ b/compress.c
15+@@ -169,7 +169,7 @@
16+ #endif
17+ 
18+ #ifndef SIG_TYPE
19+-#	define	SIG_TYPE	void (*)()
20++#	define	SIG_TYPE	void (*)(int)
21+ #endif
22+ 
23+ #if defined(AMIGA) || defined(DOS) || defined(MINGW) || defined(WINDOWS)
24+-- 
25+2.49.0
26+
+1, -1
1@@ -1 +1 @@
2-5.0 r0
3+5.0 r1