constify and make WARNS=2 clean.

This commit is contained in:
yamt 2002-06-10 09:14:26 +00:00
parent 52f6d6ef15
commit 80a776becb
8 changed files with 58 additions and 60 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.16 2001/04/08 14:11:48 hubertf Exp $
# $NetBSD: Makefile.inc,v 1.17 2002/06/10 09:14:26 yamt Exp $
# Original from FreeBSD, no rcs id.
.include <bsd.own.mk>
@ -20,6 +20,7 @@ OPSYS="unknown"
CHMOD?= /bin/chmod
CHOWN?= /usr/sbin/chown
CHGRP?= /usr/bin/chgrp
WARNS=2
.elif ${OPSYS} == "SunOS"
LOCALBASE?= /usr/local
TAR_CMD?= tar

View File

@ -1,11 +1,11 @@
/* $NetBSD: perform.c,v 1.65 2002/06/09 13:23:44 yamt Exp $ */
/* $NetBSD: perform.c,v 1.66 2002/06/10 09:14:26 yamt Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.44 1997/10/13 15:03:46 jkh Exp";
#else
__RCSID("$NetBSD: perform.c,v 1.65 2002/06/09 13:23:44 yamt Exp $");
__RCSID("$NetBSD: perform.c,v 1.66 2002/06/10 09:14:26 yamt Exp $");
#endif
#endif
@ -676,7 +676,6 @@ pkg_do(char *pkg)
/* Time to record the deed? */
if (!NoRecord && !Fake) {
char contents[FILENAME_MAX];
FILE *cfile;
umask(022);
if (getuid() != 0)

View File

@ -1,11 +1,11 @@
/* $NetBSD: perform.c,v 1.31 2002/06/09 13:23:45 yamt Exp $ */
/* $NetBSD: perform.c,v 1.32 2002/06/10 09:14:27 yamt Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.38 1997/10/13 15:03:51 jkh Exp";
#else
__RCSID("$NetBSD: perform.c,v 1.31 2002/06/09 13:23:45 yamt Exp $");
__RCSID("$NetBSD: perform.c,v 1.32 2002/06/10 09:14:27 yamt Exp $");
#endif
#endif
@ -37,7 +37,7 @@ __RCSID("$NetBSD: perform.c,v 1.31 2002/06/09 13:23:45 yamt Exp $");
#include <sys/wait.h>
#include <unistd.h>
static char *home;
static char *Home;
static void
make_dist(char *home, char *pkg, char *suffix, package_t *plist)
@ -196,7 +196,7 @@ cleanup(int sig)
alreadyCleaning = 1;
if (sig)
printf("Signal %d received, cleaning up.\n", sig);
leave_playpen(home);
leave_playpen(Home);
if (sig)
exit(1);
}
@ -308,18 +308,18 @@ pkg_perform(lpkg_head_t *pkgs)
* hack. It's not a real create in progress.
*/
if (PlistOnly) {
check_list(home, &plist, basename_of(pkg));
check_list(Home, &plist, basename_of(pkg));
write_plist(&plist, stdout, realprefix);
exit(0);
}
/* Make a directory to stomp around in */
home = make_playpen(PlayPen, PlayPenSize, 0);
Home = make_playpen(PlayPen, PlayPenSize, 0);
signal(SIGINT, cleanup);
signal(SIGHUP, cleanup);
/* Make first "real contents" pass over it */
check_list(home, &plist, basename_of(pkg));
check_list(Home, &plist, basename_of(pkg));
(void) umask(022); /* make sure gen'ed directories, files
* don't have group or other write bits. */
@ -333,49 +333,49 @@ pkg_perform(lpkg_head_t *pkgs)
add_plist(&plist, PLIST_FILE, DESC_FNAME);
if (Install) {
copy_file(home, Install, INSTALL_FNAME);
copy_file(Home, Install, INSTALL_FNAME);
add_plist(&plist, PLIST_IGNORE, NULL);
add_plist(&plist, PLIST_FILE, INSTALL_FNAME);
}
if (DeInstall) {
copy_file(home, DeInstall, DEINSTALL_FNAME);
copy_file(Home, DeInstall, DEINSTALL_FNAME);
add_plist(&plist, PLIST_IGNORE, NULL);
add_plist(&plist, PLIST_FILE, DEINSTALL_FNAME);
}
if (Require) {
copy_file(home, Require, REQUIRE_FNAME);
copy_file(Home, Require, REQUIRE_FNAME);
add_plist(&plist, PLIST_IGNORE, NULL);
add_plist(&plist, PLIST_FILE, REQUIRE_FNAME);
}
if (Display) {
copy_file(home, Display, DISPLAY_FNAME);
copy_file(Home, Display, DISPLAY_FNAME);
add_plist(&plist, PLIST_IGNORE, NULL);
add_plist(&plist, PLIST_FILE, DISPLAY_FNAME);
add_plist(&plist, PLIST_DISPLAY, DISPLAY_FNAME);
}
if (Mtree) {
copy_file(home, Mtree, MTREE_FNAME);
copy_file(Home, Mtree, MTREE_FNAME);
add_plist(&plist, PLIST_IGNORE, NULL);
add_plist(&plist, PLIST_FILE, MTREE_FNAME);
add_plist(&plist, PLIST_MTREE, MTREE_FNAME);
}
if (BuildVersion) {
copy_file(home, BuildVersion, BUILD_VERSION_FNAME);
copy_file(Home, BuildVersion, BUILD_VERSION_FNAME);
add_plist(&plist, PLIST_IGNORE, NULL);
add_plist(&plist, PLIST_FILE, BUILD_VERSION_FNAME);
}
if (BuildInfo) {
copy_file(home, BuildInfo, BUILD_INFO_FNAME);
copy_file(Home, BuildInfo, BUILD_INFO_FNAME);
add_plist(&plist, PLIST_IGNORE, NULL);
add_plist(&plist, PLIST_FILE, BUILD_INFO_FNAME);
}
if (SizePkg) {
copy_file(home, SizePkg, SIZE_PKG_FNAME);
copy_file(Home, SizePkg, SIZE_PKG_FNAME);
add_plist(&plist, PLIST_IGNORE, NULL);
add_plist(&plist, PLIST_FILE, SIZE_PKG_FNAME);
}
if (SizeAll) {
copy_file(home, SizeAll, SIZE_ALL_FNAME);
copy_file(Home, SizeAll, SIZE_ALL_FNAME);
add_plist(&plist, PLIST_IGNORE, NULL);
add_plist(&plist, PLIST_FILE, SIZE_ALL_FNAME);
}
@ -393,13 +393,13 @@ pkg_perform(lpkg_head_t *pkgs)
}
/* And stick it into a tar ball */
make_dist(home, pkg, suffix, &plist);
make_dist(Home, pkg, suffix, &plist);
/* Cleanup */
free(Comment);
free(Desc);
free_plist(&plist);
leave_playpen(home);
leave_playpen(Home);
return TRUE; /* Success */
}

View File

@ -1,11 +1,11 @@
/* $NetBSD: perform.c,v 1.35 2002/06/09 13:23:45 yamt Exp $ */
/* $NetBSD: perform.c,v 1.36 2002/06/10 09:14:27 yamt Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.15 1997/10/13 15:03:52 jkh Exp";
#else
__RCSID("$NetBSD: perform.c,v 1.35 2002/06/09 13:23:45 yamt Exp $");
__RCSID("$NetBSD: perform.c,v 1.36 2002/06/10 09:14:27 yamt Exp $");
#endif
#endif
@ -391,7 +391,6 @@ require_find_recursive_down(lpkg_t *thislpp, package_t *plist)
FILE *cfile;
package_t rPlist;
char *tmp;
plist_t *p;
/* remove a direct req from our queue */
TAILQ_REMOVE(&reqq, lpp, lp_link);
@ -665,7 +664,7 @@ pkg_do(char *pkg)
}
int
pkg_perform(lpkg_head_t *pkgs)
pkg_perform(lpkg_head_t *pkghead)
{
int err_cnt = 0;
int oldcwd;
@ -676,9 +675,9 @@ pkg_perform(lpkg_head_t *pkgs)
if (oldcwd == -1)
err(1, "cannot open \".\"");
while ((lpp = TAILQ_FIRST(pkgs))) {
while ((lpp = TAILQ_FIRST(pkghead))) {
err_cnt += pkg_do(lpp->lp_name);
TAILQ_REMOVE(pkgs, lpp, lp_link);
TAILQ_REMOVE(pkghead, lpp, lp_link);
free_lpkg(lpp);
if (fchdir(oldcwd) == FAIL)
err(1, "unable to change to previous directory");

View File

@ -1,11 +1,11 @@
/* $NetBSD: perform.c,v 1.38 2002/06/09 13:23:46 yamt Exp $ */
/* $NetBSD: perform.c,v 1.39 2002/06/10 09:14:27 yamt Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.23 1997/10/13 15:03:53 jkh Exp";
#else
__RCSID("$NetBSD: perform.c,v 1.38 2002/06/09 13:23:46 yamt Exp $");
__RCSID("$NetBSD: perform.c,v 1.39 2002/06/10 09:14:27 yamt Exp $");
#endif
#endif
@ -300,7 +300,7 @@ cleanup(int sig)
}
int
pkg_perform(lpkg_head_t *pkgs)
pkg_perform(lpkg_head_t *pkghead)
{
struct dirent *dp;
char *tmp;
@ -355,8 +355,8 @@ pkg_perform(lpkg_head_t *pkgs)
/* Show info on individual pkg(s) */
lpkg_t *lpp;
while ((lpp = TAILQ_FIRST(pkgs))) {
TAILQ_REMOVE(pkgs, lpp, lp_link);
while ((lpp = TAILQ_FIRST(pkghead))) {
TAILQ_REMOVE(pkghead, lpp, lp_link);
err_cnt += pkg_do(lpp->lp_name);
free_lpkg(lpp);
}

View File

@ -1,11 +1,11 @@
/* $NetBSD: file.c,v 1.51 2002/06/09 14:14:50 yamt Exp $ */
/* $NetBSD: file.c,v 1.52 2002/06/10 09:14:27 yamt Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "from FreeBSD Id: file.c,v 1.29 1997/10/08 07:47:54 charnier Exp";
#else
__RCSID("$NetBSD: file.c,v 1.51 2002/06/09 14:14:50 yamt Exp $");
__RCSID("$NetBSD: file.c,v 1.52 2002/06/10 09:14:27 yamt Exp $");
#endif
#endif
@ -45,7 +45,7 @@ __RCSID("$NetBSD: file.c,v 1.51 2002/06/09 14:14:50 yamt Exp $");
* Quick check to see if a file (or dir ...) exists
*/
Boolean
fexists(char *fname)
fexists(const char *fname)
{
struct stat dummy;
if (!lstat(fname, &dummy))
@ -57,7 +57,7 @@ fexists(char *fname)
* Quick check to see if something is a directory
*/
Boolean
isdir(char *fname)
isdir(const char *fname)
{
struct stat sb;
@ -71,7 +71,7 @@ isdir(char *fname)
* Check if something is a link to a directory
*/
Boolean
islinktodir(char *fname)
islinktodir(const char *fname)
{
struct stat sb;
@ -88,7 +88,7 @@ islinktodir(char *fname)
* Check to see if file is a dir, and is empty
*/
Boolean
isemptydir(char *fname)
isemptydir(const char *fname)
{
if (isdir(fname) || islinktodir(fname)) {
DIR *dirp;
@ -113,7 +113,7 @@ isemptydir(char *fname)
* Check if something is a regular file
*/
Boolean
isfile(char *fname)
isfile(const char *fname)
{
struct stat sb;
if (stat(fname, &sb) != FAIL && S_ISREG(sb.st_mode))
@ -126,7 +126,7 @@ isfile(char *fname)
* a file, say "it's empty", otherwise return TRUE if zero sized.
*/
Boolean
isemptyfile(char *fname)
isemptyfile(const char *fname)
{
struct stat sb;
if (stat(fname, &sb) != FAIL && S_ISREG(sb.st_mode)) {
@ -153,7 +153,7 @@ static const url_t urls[] = {
* Returns length of leading part of any URL from urls table, or -1
*/
int
URLlength(char *fname)
URLlength(const char *fname)
{
const url_t *up;
int i;
@ -237,7 +237,7 @@ fileURLFilename(char *fname, char *where, int max)
* Wrapper routine for fileGetURL to iterate over several "sfx"s
*/
static char *
fileGet1URL(char *base, char *spec, char *sfx)
fileGet1URL(const char *base, const char *spec, const char *sfx)
{
char host[MAXHOSTNAMELEN], file[FILENAME_MAX];
char *cp, *rp;

View File

@ -1,8 +1,8 @@
/* $NetBSD: ftpio.c,v 1.36 2002/06/09 03:38:59 yamt Exp $ */
/* $NetBSD: ftpio.c,v 1.37 2002/06/10 09:14:28 yamt Exp $ */
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: ftpio.c,v 1.36 2002/06/09 03:38:59 yamt Exp $");
__RCSID("$NetBSD: ftpio.c,v 1.37 2002/06/10 09:14:28 yamt Exp $");
#endif
/*
@ -102,7 +102,7 @@ expect(int fd, const char *str, int *ftprc)
int done;
struct timeval timeout;
int retval;
regmatch_t pmatch;
regmatch_t match;
int verbose_expect=0;
#if EXPECT_DEBUG
@ -179,15 +179,15 @@ expect(int fd, const char *str, int *ftprc)
}
#endif /* EXPECT_DEBUG */
if (regexec(&rstr, buf, 1, &pmatch, 0) == 0) {
if (regexec(&rstr, buf, 1, &match, 0) == 0) {
#if EXPECT_DEBUG
if (expect_debug)
printf("Gotcha -> %s!\n", buf+pmatch.rm_so+1);
printf("Gotcha -> %s!\n", buf+match.rm_so+1);
fflush(stdout);
#endif /* EXPECT_DEBUG */
if (ftprc && isdigit(buf[pmatch.rm_so+1]))
*ftprc = atoi(buf+pmatch.rm_so+1);
if (ftprc && isdigit(buf[match.rm_so+1]))
*ftprc = atoi(buf+match.rm_so+1);
done=1;
retval=0;
@ -637,7 +637,6 @@ unpackURL(const char *url, const char *dir)
{
/* Verify if the url is really ok */
int rc;
char exp[FILENAME_MAX];
rc=expandURL(exp, url);

View File

@ -1,4 +1,4 @@
/* $NetBSD: lib.h,v 1.40 2002/06/09 13:23:46 yamt Exp $ */
/* $NetBSD: lib.h,v 1.41 2002/06/10 09:14:28 yamt Exp $ */
/* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */
@ -202,14 +202,14 @@ int add_to_list_fn(const char *, void *);
/* File */
Boolean fexists(char *);
Boolean isdir(char *);
Boolean islinktodir(char *);
Boolean isemptydir(char *fname);
Boolean isemptyfile(char *fname);
Boolean isfile(char *);
Boolean isempty(char *);
int URLlength(char *);
Boolean fexists(const char *);
Boolean isdir(const char *);
Boolean islinktodir(const char *);
Boolean isemptydir(const char *);
Boolean isemptyfile(const char *);
Boolean isfile(const char *);
Boolean isempty(const char *);
int URLlength(const char *);
char *fileGetURL(char *, char *);
char *fileURLFilename(char *, char *, int);
char *fileURLHost(char *, char *, int);