[Midnightbsd-cvs] src [11525] trunk/usr.bin/compress/compress.c: make static

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Jul 7 15:26:53 EDT 2018


Revision: 11525
          http://svnweb.midnightbsd.org/src/?rev=11525
Author:   laffer1
Date:     2018-07-07 15:26:52 -0400 (Sat, 07 Jul 2018)
Log Message:
-----------
make static

Modified Paths:
--------------
    trunk/usr.bin/compress/Makefile
    trunk/usr.bin/compress/compress.1
    trunk/usr.bin/compress/compress.c

Property Changed:
----------------
    trunk/usr.bin/compress/compress.1

Modified: trunk/usr.bin/compress/Makefile
===================================================================
--- trunk/usr.bin/compress/Makefile	2018-07-07 19:25:27 UTC (rev 11524)
+++ trunk/usr.bin/compress/Makefile	2018-07-07 19:26:52 UTC (rev 11525)
@@ -1,6 +1,9 @@
+# $MidnightBSD$
 #	@(#)Makefile	8.2 (Berkeley) 4/17/94
-# $MidnightBSD$
+# $FreeBSD: stable/10/usr.bin/compress/Makefile 320518 2017-06-30 22:16:28Z jilles $
 
+.include <bsd.own.mk>
+
 PROG=	compress
 SRCS=	compress.c zopen.c
 LINKS=	${BINDIR}/compress ${BINDIR}/uncompress
@@ -9,4 +12,8 @@
 # XXX zopen is not part of libc
 # MAN=zopen.3
 
+.if ${MK_TESTS} != "no"
+SUBDIR+=	tests
+.endif
+
 .include <bsd.prog.mk>

Modified: trunk/usr.bin/compress/compress.1
===================================================================
--- trunk/usr.bin/compress/compress.1	2018-07-07 19:25:27 UTC (rev 11524)
+++ trunk/usr.bin/compress/compress.1	2018-07-07 19:26:52 UTC (rev 11525)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1986, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -30,7 +31,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)compress.1	8.2 (Berkeley) 4/18/94
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/usr.bin/compress/compress.1 216370 2010-12-11 08:32:16Z joel $
 .\"
 .Dd May 17, 2002
 .Dt COMPRESS 1


Property changes on: trunk/usr.bin/compress/compress.1
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/usr.bin/compress/compress.c
===================================================================
--- trunk/usr.bin/compress/compress.c	2018-07-07 19:25:27 UTC (rev 11524)
+++ trunk/usr.bin/compress/compress.c	2018-07-07 19:26:52 UTC (rev 11525)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -40,7 +41,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/compress/compress.c 320532 2017-07-01 13:03:02Z jilles $");
 
 #include <sys/param.h>
 #include <sys/stat.h>
@@ -56,15 +57,15 @@
 
 #include "zopen.h"
 
-void	compress(const char *, const char *, int);
-void	cwarn(const char *, ...) __printflike(1, 2);
-void	cwarnx(const char *, ...) __printflike(1, 2);
-void	decompress(const char *, const char *, int);
-int	permission(const char *);
-void	setfile(const char *, struct stat *);
-void	usage(int);
+static void	compress(const char *, const char *, int);
+static void	cwarn(const char *, ...) __printflike(1, 2);
+static void	cwarnx(const char *, ...) __printflike(1, 2);
+static void	decompress(const char *, const char *, int);
+static int	permission(const char *);
+static void	setfile(const char *, struct stat *);
+static void	usage(int);
 
-int eval, force, verbose;
+static int eval, force, verbose;
 
 int
 main(int argc, char *argv[])
@@ -75,7 +76,7 @@
 	char *p, newname[MAXPATHLEN];
 
 	cat = 0;
-	if ((p = rindex(argv[0], '/')) == NULL)
+	if ((p = strrchr(argv[0], '/')) == NULL)
 		p = argv[0];
 	else
 		++p;
@@ -128,7 +129,7 @@
 		exit (eval);
 	}
 
-	if (cat == 1 && argc > 1)
+	if (cat == 1 && style == COMPRESS && argc > 1)
 		errx(1, "the -c option permits only a single file argument");
 
 	for (; *argv; ++argv)
@@ -141,7 +142,7 @@
 				compress(*argv, "/dev/stdout", bits);
 				break;
 			}
-			if ((p = rindex(*argv, '.')) != NULL &&
+			if ((p = strrchr(*argv, '.')) != NULL &&
 			    !strcmp(p, ".Z")) {
 				cwarnx("%s: name already has trailing .Z",
 				    *argv);
@@ -164,7 +165,7 @@
 				break;
 			}
 			len = strlen(*argv);
-			if ((p = rindex(*argv, '.')) == NULL ||
+			if ((p = strrchr(*argv, '.')) == NULL ||
 			    strcmp(p, ".Z")) {
 				if (len > sizeof(newname) - 3) {
 					cwarnx("%s: name too long", *argv);
@@ -191,7 +192,7 @@
 	exit (eval);
 }
 
-void
+static void
 compress(const char *in, const char *out, int bits)
 {
 	size_t nr;
@@ -281,7 +282,7 @@
 		(void)fclose(ifp);
 }
 
-void
+static void
 decompress(const char *in, const char *out, int bits)
 {
 	size_t nr;
@@ -357,7 +358,7 @@
 		(void)fclose(ifp);
 }
 
-void
+static void
 setfile(const char *name, struct stat *fs)
 {
 	static struct timeval tv[2];
@@ -387,7 +388,7 @@
 		cwarn("chflags: %s", name);
 }
 
-int
+static int
 permission(const char *fname)
 {
 	int ch, first;
@@ -401,7 +402,7 @@
 	return (first == 'y');
 }
 
-void
+static void
 usage(int iscompress)
 {
 	if (iscompress)
@@ -413,7 +414,7 @@
 	exit(1);
 }
 
-void
+static void
 cwarnx(const char *fmt, ...)
 {
 	va_list ap;
@@ -424,7 +425,7 @@
 	eval = 1;
 }
 
-void
+static void
 cwarn(const char *fmt, ...)
 {
 	va_list ap;



More information about the Midnightbsd-cvs mailing list