From 617e8b416db0c5fa7c344d632320d80164f6c165 Mon Sep 17 00:00:00 2001
From: Alexander Kabaev <kan@FreeBSD.org>
Date: Wed, 28 Jul 2004 07:19:15 +0000
Subject: [PATCH] Downgrade WARNS level to more tolerable value. Attempt to fix
 casts as lvalue usage whenever possible.

---
 usr.sbin/pkg_install/add/Makefile     |  2 +-
 usr.sbin/pkg_install/add/extract.c    |  4 ++--
 usr.sbin/pkg_install/add/main.c       |  2 +-
 usr.sbin/pkg_install/create/Makefile  |  2 +-
 usr.sbin/pkg_install/create/perform.c | 16 +++++++++-------
 usr.sbin/pkg_install/lib/Makefile     |  2 +-
 usr.sbin/pkg_install/lib/plist.c      |  2 +-
 7 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/usr.sbin/pkg_install/add/Makefile b/usr.sbin/pkg_install/add/Makefile
index 5f7d6535b173..9267f06d270c 100644
--- a/usr.sbin/pkg_install/add/Makefile
+++ b/usr.sbin/pkg_install/add/Makefile
@@ -5,7 +5,7 @@ SRCS=	main.c perform.c futil.c extract.c
 
 CFLAGS+= ${DEBUG} -I${.CURDIR}/../lib
 
-WARNS?=	6
+WARNS?=	3
 WFORMAT?=	1
 
 DPADD=	${LIBINSTALL} ${LIBFETCH} ${LIBMD}
diff --git a/usr.sbin/pkg_install/add/extract.c b/usr.sbin/pkg_install/add/extract.c
index 0e31e064cff7..86a9805dc261 100644
--- a/usr.sbin/pkg_install/add/extract.c
+++ b/usr.sbin/pkg_install/add/extract.c
@@ -132,7 +132,7 @@ extract_plist(const char *home, Package *pkg)
     Group = NULL;
     Mode = NULL;
     last_file = NULL;
-    (const char *)Directory = home;
+    Directory = (char *)home;
 
     /* Do it */
     while (p) {
@@ -223,7 +223,7 @@ extract_plist(const char *home, Package *pkg)
 		Directory = p->name;
 	    }
 	    else
-		(const char *)Directory = home;
+		Directory = (char *)home;
 	    break;
 
 	case PLIST_CMD:
diff --git a/usr.sbin/pkg_install/add/main.c b/usr.sbin/pkg_install/add/main.c
index 6463bc5debc9..98eb88330671 100644
--- a/usr.sbin/pkg_install/add/main.c
+++ b/usr.sbin/pkg_install/add/main.c
@@ -187,7 +187,7 @@ main(int argc, char **argv)
 			errx(1, "package name too long");
     	    }
 	    if (!strcmp(*argv, "-"))	/* stdin? */
-		(const char *)pkgs[ch] = "-";
+		pkgs[ch] = (char *)"-";
 	    else if (isURL(*argv)) {  	/* preserve URLs */
 		if (strlcpy(pkgnames[ch], *argv, sizeof(pkgnames[ch]))
 		    >= sizeof(pkgnames[ch]))
diff --git a/usr.sbin/pkg_install/create/Makefile b/usr.sbin/pkg_install/create/Makefile
index 16f2bc2a9e2a..2971ba39617d 100644
--- a/usr.sbin/pkg_install/create/Makefile
+++ b/usr.sbin/pkg_install/create/Makefile
@@ -5,7 +5,7 @@ SRCS=	main.c perform.c pl.c
 
 CFLAGS+= ${DEBUG} -I${.CURDIR}/../lib
 
-WARNS?=	6
+WARNS?=	3
 WFORMAT?=	1
 
 DPADD=	${LIBINSTALL} ${LIBMD}
diff --git a/usr.sbin/pkg_install/create/perform.c b/usr.sbin/pkg_install/create/perform.c
index 119d54e81e73..efbac437f415 100644
--- a/usr.sbin/pkg_install/create/perform.c
+++ b/usr.sbin/pkg_install/create/perform.c
@@ -472,13 +472,15 @@ create_from_installed(const char *pkg, const char *suf)
     read_plist(&plist, fp);
     fclose(fp);
 
-    (const char *)Install = isfile(INSTALL_FNAME) ? INSTALL_FNAME : NULL;
-    (const char *)PostInstall = isfile(POST_INSTALL_FNAME) ? POST_INSTALL_FNAME : NULL;
-    (const char *)DeInstall = isfile(DEINSTALL_FNAME) ? DEINSTALL_FNAME : NULL;
-    (const char *)PostDeInstall = isfile(POST_DEINSTALL_FNAME) ? POST_DEINSTALL_FNAME : NULL;
-    (const char *)Require = isfile(REQUIRE_FNAME) ? REQUIRE_FNAME : NULL;
-    (const char *)Display = isfile(DISPLAY_FNAME) ? DISPLAY_FNAME : NULL;
-    (const char *)Mtree = isfile(MTREE_FNAME) ?  MTREE_FNAME : NULL;
+    Install = isfile(INSTALL_FNAME) ? (char *)INSTALL_FNAME : NULL;
+    PostInstall = isfile(POST_INSTALL_FNAME) ?
+	(char *)POST_INSTALL_FNAME : NULL;
+    DeInstall = isfile(DEINSTALL_FNAME) ? (char *)DEINSTALL_FNAME : NULL;
+    PostDeInstall = isfile(POST_DEINSTALL_FNAME) ?
+	(char *)POST_DEINSTALL_FNAME : NULL;
+    Require = isfile(REQUIRE_FNAME) ? (char *)REQUIRE_FNAME : NULL;
+    Display = isfile(DISPLAY_FNAME) ? (char *)DISPLAY_FNAME : NULL;
+    Mtree = isfile(MTREE_FNAME) ?  (char *)MTREE_FNAME : NULL;
 
     make_dist(homedir, pkg, suf, &plist);
 
diff --git a/usr.sbin/pkg_install/lib/Makefile b/usr.sbin/pkg_install/lib/Makefile
index 0aba9a4c6771..d2480475d9e1 100644
--- a/usr.sbin/pkg_install/lib/Makefile
+++ b/usr.sbin/pkg_install/lib/Makefile
@@ -7,7 +7,7 @@ SRCS=	file.c msg.c plist.c str.c exec.c global.c pen.c match.c \
 
 CFLAGS+= ${DEBUG}
 
-WARNS?=	6
+WARNS?=	3
 WFORMAT?=	1
 
 .include <bsd.lib.mk>
diff --git a/usr.sbin/pkg_install/lib/plist.c b/usr.sbin/pkg_install/lib/plist.c
index 60bc111b00c7..95d9ac4a370c 100644
--- a/usr.sbin/pkg_install/lib/plist.c
+++ b/usr.sbin/pkg_install/lib/plist.c
@@ -205,7 +205,7 @@ plist_cmd(const char *s, char **arg)
 	++cp, ++sp;
     }
     if (arg)
-	(const char *)*arg = sp;
+	*arg = (char *)sp;
     if (!strcmp(cmd, "cwd"))
 	return PLIST_CWD;
     else if (!strcmp(cmd, "srcdir"))