summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authoragc <agc@pkgsrc.org>2004-12-29 12:16:56 +0000
committeragc <agc@pkgsrc.org>2004-12-29 12:16:56 +0000
commit6dcdae61c1702e04d8412d716775821a8fc15ad7 (patch)
treede2a0a49decbbbe4acd1caeefcf2ed4cfdb54a7a /pkgtools
parenta5785c7c22bd697bac7baec5de60726ee00c18bc (diff)
downloadpkgsrc-6dcdae61c1702e04d8412d716775821a8fc15ad7.tar.gz
Pull in portability changes from src, and bump version to 20041226:
Introduce a new abstraction in the C code, called MaxPathSize. All previous occurrences of MAXPATHLEN and FILENAME_MAX have been changed to use MaxPathSize instead. If MAXPATHLEN is not defined, then assume a default value of 1024 (this is primarily for use on the Hurd). The reason for this is that some older platforms define FILENAME_MAX to be 14, although MAXPATHLEN is 1024. On BSD-derived systems, FILENAME_MAX And MAXPATHLEN are both 1024. Bump pkg_install version to 20041226. These modifications have been tested so far on a NetBSD-current bulk build.
Diffstat (limited to 'pkgtools')
-rw-r--r--pkgtools/pkg_install/files/add/extract.c16
-rw-r--r--pkgtools/pkg_install/files/add/main.c6
-rw-r--r--pkgtools/pkg_install/files/add/perform.c42
-rw-r--r--pkgtools/pkg_install/files/add/verify.c6
-rw-r--r--pkgtools/pkg_install/files/admin/main.c32
-rw-r--r--pkgtools/pkg_install/files/create/main.c6
-rw-r--r--pkgtools/pkg_install/files/create/perform.c8
-rw-r--r--pkgtools/pkg_install/files/create/pl.c14
-rw-r--r--pkgtools/pkg_install/files/delete/main.c6
-rw-r--r--pkgtools/pkg_install/files/delete/perform.c34
-rw-r--r--pkgtools/pkg_install/files/info/main.c6
-rw-r--r--pkgtools/pkg_install/files/info/perform.c28
-rw-r--r--pkgtools/pkg_install/files/lib/file.c28
-rw-r--r--pkgtools/pkg_install/files/lib/ftpio.c40
-rw-r--r--pkgtools/pkg_install/files/lib/lib.h13
-rw-r--r--pkgtools/pkg_install/files/lib/path.c6
-rw-r--r--pkgtools/pkg_install/files/lib/pen.c10
-rw-r--r--pkgtools/pkg_install/files/lib/pkgdb.c14
-rw-r--r--pkgtools/pkg_install/files/lib/plist.c18
-rw-r--r--pkgtools/pkg_install/files/lib/str.c18
-rw-r--r--pkgtools/pkg_install/files/lib/version.h4
21 files changed, 182 insertions, 173 deletions
diff --git a/pkgtools/pkg_install/files/add/extract.c b/pkgtools/pkg_install/files/add/extract.c
index 9b936c51ccf..6052d286a02 100644
--- a/pkgtools/pkg_install/files/add/extract.c
+++ b/pkgtools/pkg_install/files/add/extract.c
@@ -1,4 +1,4 @@
-/* $NetBSD: extract.c,v 1.9 2004/08/20 20:09:53 jlam Exp $ */
+/* $NetBSD: extract.c,v 1.10 2004/12/29 12:16:56 agc Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static const char *rcsid = "FreeBSD - Id: extract.c,v 1.17 1997/10/08 07:45:35 charnier Exp";
#else
-__RCSID("$NetBSD: extract.c,v 1.9 2004/08/20 20:09:53 jlam Exp $");
+__RCSID("$NetBSD: extract.c,v 1.10 2004/12/29 12:16:56 agc Exp $");
#endif
#endif
@@ -81,7 +81,7 @@ static void
rollback(char *name, char *home, plist_t *start, plist_t *stop)
{
plist_t *q;
- char try[FILENAME_MAX], bup[FILENAME_MAX], *dir;
+ char try[MaxPathSize], bup[MaxPathSize], *dir;
dir = home;
for (q = start; q != stop; q = q->next) {
@@ -159,7 +159,7 @@ extract_plist(char *home, package_t *pkg)
}
/* Do it */
while (p) {
- char cmd[FILENAME_MAX];
+ char cmd[MaxPathSize];
switch (p->type) {
case PLIST_NAME:
@@ -173,7 +173,7 @@ extract_plist(char *home, package_t *pkg)
if (Verbose)
printf("extract: %s/%s\n", Directory, p->name);
if (!Fake) {
- char try[FILENAME_MAX];
+ char try[MaxPathSize];
if (strrchr(p->name, '\'')) {
cleanup(0);
@@ -187,7 +187,7 @@ extract_plist(char *home, package_t *pkg)
(void) chflags(try, 0); /* XXX hack - if truly immutable, rename fails */
#endif
if (preserve && PkgName) {
- char pf[FILENAME_MAX];
+ char pf[MaxPathSize];
if (make_preserve_name(pf, sizeof(pf), PkgName, try)) {
if (rename(try, pf)) {
@@ -205,7 +205,7 @@ extract_plist(char *home, package_t *pkg)
if (rename(p->name, try) == 0) {
/* note in pkgdb */
{
- char *s, t[FILENAME_MAX];
+ char *s, t[MaxPathSize];
int rc;
(void) snprintf(t, sizeof(t), "%s/%s", Directory, p->name);
@@ -266,7 +266,7 @@ extract_plist(char *home, package_t *pkg)
* that would probably affect too much code I prefer
* not to touch - HF */
{
- char *s, t[FILENAME_MAX], *u;
+ char *s, t[MaxPathSize], *u;
int rc;
if (p->name[0] == '/')
diff --git a/pkgtools/pkg_install/files/add/main.c b/pkgtools/pkg_install/files/add/main.c
index e8893095019..ee6f14bb274 100644
--- a/pkgtools/pkg_install/files/add/main.c
+++ b/pkgtools/pkg_install/files/add/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.7 2004/12/09 20:10:34 erh Exp $ */
+/* $NetBSD: main.c,v 1.8 2004/12/29 12:16:56 agc Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static char *rcsid = "from FreeBSD Id: main.c,v 1.16 1997/10/08 07:45:43 charnier Exp";
#else
-__RCSID("$NetBSD: main.c,v 1.7 2004/12/09 20:10:34 erh Exp $");
+__RCSID("$NetBSD: main.c,v 1.8 2004/12/29 12:16:56 agc Exp $");
#endif
#endif
@@ -63,7 +63,7 @@ char *Owner = NULL;
char *Group = NULL;
char *PkgName = NULL;
char *Directory = NULL;
-char FirstPen[FILENAME_MAX];
+char FirstPen[MaxPathSize];
add_mode_t AddMode = NORMAL;
int Replace = 0;
diff --git a/pkgtools/pkg_install/files/add/perform.c b/pkgtools/pkg_install/files/add/perform.c
index e8a1a4919a2..a85d9f42a79 100644
--- a/pkgtools/pkg_install/files/add/perform.c
+++ b/pkgtools/pkg_install/files/add/perform.c
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.26 2004/12/09 20:10:34 erh Exp $ */
+/* $NetBSD: perform.c,v 1.27 2004/12/29 12:16:56 agc Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#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.26 2004/12/09 20:10:34 erh Exp $");
+__RCSID("$NetBSD: perform.c,v 1.27 2004/12/29 12:16:56 agc Exp $");
#endif
#endif
@@ -58,7 +58,7 @@ __RCSID("$NetBSD: perform.c,v 1.26 2004/12/09 20:10:34 erh Exp $");
#include <sys/utsname.h>
#endif
-static char LogDir[FILENAME_MAX];
+static char LogDir[MaxPathSize];
static int zapLogDir; /* Should we delete LogDir? */
static package_t Plist;
@@ -184,14 +184,14 @@ installprereq(const char *name, int *errc, int doupdate)
static int
pkg_do(const char *pkg, lpkg_head_t *pkgs)
{
- char playpen[FILENAME_MAX];
- char replace_from[FILENAME_MAX];
- char replace_via[FILENAME_MAX];
- char replace_to[FILENAME_MAX];
+ char playpen[MaxPathSize];
+ char replace_from[MaxPathSize];
+ char replace_via[MaxPathSize];
+ char replace_to[MaxPathSize];
char *buildinfo[BI_ENUM_COUNT];
int replacing = 0;
char *where_to;
- char dbdir[FILENAME_MAX];
+ char dbdir[MaxPathSize];
const char *exact, *extra1;
FILE *cfile;
int errc, err_prescan;
@@ -214,7 +214,7 @@ pkg_do(const char *pkg, lpkg_head_t *pkgs)
/* Are we coming in for a second pass, everything already extracted?
* (Slave mode) */
if (!pkg) {
- fgets(playpen, FILENAME_MAX, stdin);
+ fgets(playpen, MaxPathSize, stdin);
playpen[strlen(playpen) - 1] = '\0'; /* remove newline! */
if (chdir(playpen) == FAIL) {
warnx("add in SLAVE mode can't chdir to %s", playpen);
@@ -484,8 +484,8 @@ pkg_do(const char *pkg, lpkg_head_t *pkgs)
char *s;
if ((s = strrchr(PkgName, '-')) != NULL) {
- char buf[FILENAME_MAX];
- char installed[FILENAME_MAX];
+ char buf[MaxPathSize];
+ char installed[MaxPathSize];
/*
* See if the pkg is already installed. If so, we might
@@ -512,7 +512,7 @@ pkg_do(const char *pkg, lpkg_head_t *pkgs)
* (from +REQUIRED_BY) that require this pkg
*/
FILE *rb; /* +REQUIRED_BY file */
- char pkg2chk[FILENAME_MAX];
+ char pkg2chk[MaxPathSize];
rb = fopen(replace_from, "r");
if (! rb) {
@@ -527,7 +527,7 @@ pkg_do(const char *pkg, lpkg_head_t *pkgs)
package_t depPlist;
FILE *depf;
plist_t *depp;
- char depC[FILENAME_MAX];
+ char depC[MaxPathSize];
s = strrchr(pkg2chk, '\n');
if (s)
@@ -551,8 +551,8 @@ pkg_do(const char *pkg, lpkg_head_t *pkgs)
fclose(depf);
for (depp = depPlist.head; depp; depp = depp->next) {
- char base_new[FILENAME_MAX];
- char base_exist[FILENAME_MAX];
+ char base_new[MaxPathSize];
+ char base_exist[MaxPathSize];
char *s2;
if (depp->type != PLIST_PKGDEP)
@@ -632,7 +632,7 @@ ignore_replace_depends_check:
/* See if there are conflicting packages installed */
for (p = Plist.head; p; p = p->next) {
- char installed[FILENAME_MAX];
+ char installed[MaxPathSize];
if (p->type != PLIST_PKGCFL)
continue;
@@ -650,7 +650,7 @@ ignore_replace_depends_check:
*/
err_prescan=0;
for (p = Plist.head; p; p = p->next) {
- char installed[FILENAME_MAX];
+ char installed[MaxPathSize];
if (p->type != PLIST_PKGDEP)
continue;
@@ -683,7 +683,7 @@ ignore_replace_depends_check:
}
if (skip >= 0) {
- char buf[FILENAME_MAX];
+ char buf[MaxPathSize];
(void) snprintf(buf, sizeof(buf),
skip ? "%.*s[0-9]*" : "%.*s-[0-9]*",
@@ -695,7 +695,7 @@ ignore_replace_depends_check:
if (Replace > 1)
{
int errc0 = 0;
- char tmp[FILENAME_MAX];
+ char tmp[MaxPathSize];
warnx("Attempting to update `%s' using binary package\n", p->name);
/* Yes, append .tgz after the version so the */
@@ -731,7 +731,7 @@ ignore_replace_depends_check:
/* Now check the packing list for dependencies */
for (exact = NULL, p = Plist.head; p; p = p->next) {
- char installed[FILENAME_MAX];
+ char installed[MaxPathSize];
if (p->type == PLIST_BLDDEP) {
exact = p->name;
@@ -842,7 +842,7 @@ ignore_replace_depends_check:
/* Time to record the deed? */
if (!NoRecord && !Fake) {
- char contents[FILENAME_MAX];
+ char contents[MaxPathSize];
#ifndef __INTERIX
if (getuid() != 0)
diff --git a/pkgtools/pkg_install/files/add/verify.c b/pkgtools/pkg_install/files/add/verify.c
index 91da3475c54..00fb8f2770c 100644
--- a/pkgtools/pkg_install/files/add/verify.c
+++ b/pkgtools/pkg_install/files/add/verify.c
@@ -1,4 +1,4 @@
-/* $NetBSD: verify.c,v 1.6 2004/04/07 22:44:23 agc Exp $ */
+/* $NetBSD: verify.c,v 1.7 2004/12/29 12:16:56 agc Exp $ */
/*
* Copyright (c) 2001 Alistair G. Crooks. All rights reserved.
@@ -41,7 +41,7 @@
#ifndef lint
__COPYRIGHT("@(#) Copyright (c) 1999 \
The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: verify.c,v 1.6 2004/04/07 22:44:23 agc Exp $");
+__RCSID("$NetBSD: verify.c,v 1.7 2004/12/29 12:16:56 agc Exp $");
#endif
#if HAVE_SYS_TYPES_H
@@ -91,7 +91,7 @@ do_verify(const char *pkgname, const char *cmd1, const char *cmd2, const char *c
struct stat st;
const char *const *ep;
char buf[BUFSIZ];
- char f[FILENAME_MAX];
+ char f[MaxPathSize];
int ret;
int i;
diff --git a/pkgtools/pkg_install/files/admin/main.c b/pkgtools/pkg_install/files/admin/main.c
index 43629a951c3..ed2da7f2550 100644
--- a/pkgtools/pkg_install/files/admin/main.c
+++ b/pkgtools/pkg_install/files/admin/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.16 2004/08/20 20:09:53 jlam Exp $ */
+/* $NetBSD: main.c,v 1.17 2004/12/29 12:16:56 agc Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -8,7 +8,7 @@
#include <sys/cdefs.h>
#endif
#ifndef lint
-__RCSID("$NetBSD: main.c,v 1.16 2004/08/20 20:09:53 jlam Exp $");
+__RCSID("$NetBSD: main.c,v 1.17 2004/12/29 12:16:56 agc Exp $");
#endif
/*
@@ -114,8 +114,8 @@ check1pkg(const char *pkgdir)
plist_t *p;
package_t Plist;
char *PkgName, *dirp = NULL, *md5file;
- char file[FILENAME_MAX];
- char dir[FILENAME_MAX];
+ char file[MaxPathSize];
+ char dir[MaxPathSize];
f = fopen(CONTENTS_FNAME, "r");
if (f == NULL)
@@ -153,7 +153,7 @@ check1pkg(const char *pkgdir)
free(md5file);
}
} else if (strncmp(p->next->name, SYMLINK_HEADER, SymlinkHeaderLen) == 0) {
- char buf[FILENAME_MAX + SymlinkHeaderLen];
+ char buf[MaxPathSize + SymlinkHeaderLen];
int cc;
(void) strlcpy(buf, SYMLINK_HEADER, sizeof(buf));
@@ -223,10 +223,10 @@ add1pkg(const char *pkgdir)
FILE *f;
plist_t *p;
package_t Plist;
- char contents[FILENAME_MAX];
+ char contents[MaxPathSize];
char *PkgDBDir, *PkgName, *dirp;
- char file[FILENAME_MAX];
- char dir[FILENAME_MAX];
+ char file[MaxPathSize];
+ char dir[MaxPathSize];
int cnt = 0;
if (!pkgdb_open(ReadWrite))
@@ -318,7 +318,7 @@ rebuild(void)
DIR *dp;
struct dirent *de;
char *PkgDBDir;
- char cachename[FILENAME_MAX];
+ char cachename[MaxPathSize];
pkgcnt = 0;
filecnt = 0;
@@ -447,8 +447,8 @@ main(int argc, char *argv[])
const char *prog;
Boolean use_default_sfx = TRUE;
Boolean show_basename_only = FALSE;
- char lsdir[FILENAME_MAX];
- char sfx[FILENAME_MAX];
+ char lsdir[MaxPathSize];
+ char sfx[MaxPathSize];
char *lsdirp = NULL;
int ch;
@@ -553,7 +553,7 @@ main(int argc, char *argv[])
rc = chdir(*argv);
if (rc == -1) {
/* found nothing - try 'pkg-[0-9]*' */
- char try[FILENAME_MAX];
+ char try[MaxPathSize];
snprintf(try, sizeof(try), "%s-[0-9]*", *argv);
if (findmatchingname(_pkgdb_getPKGDB_DIR(), try,
@@ -602,8 +602,8 @@ main(int argc, char *argv[])
/* args specified */
int rc;
const char *basep, *dir;
- char cwd[MAXPATHLEN];
- char base[FILENAME_MAX];
+ char cwd[MaxPathSize];
+ char base[MaxPathSize];
dir = lsdirp ? lsdirp : dirname_of(*argv);
basep = basename_of(*argv);
@@ -644,8 +644,8 @@ main(int argc, char *argv[])
/* args specified */
int rc;
const char *basep, *dir;
- char cwd[MAXPATHLEN];
- char base[FILENAME_MAX];
+ char cwd[MaxPathSize];
+ char base[MaxPathSize];
char *p;
dir = lsdirp ? lsdirp : dirname_of(*argv);
diff --git a/pkgtools/pkg_install/files/create/main.c b/pkgtools/pkg_install/files/create/main.c
index 2de05f51822..5f71f7f25f4 100644
--- a/pkgtools/pkg_install/files/create/main.c
+++ b/pkgtools/pkg_install/files/create/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.5 2003/09/23 07:13:49 grant Exp $ */
+/* $NetBSD: main.c,v 1.6 2004/12/29 12:16:56 agc Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static const char *rcsid = "from FreeBSD Id: main.c,v 1.17 1997/10/08 07:46:23 charnier Exp";
#else
-__RCSID("$NetBSD: main.c,v 1.5 2003/09/23 07:13:49 grant Exp $");
+__RCSID("$NetBSD: main.c,v 1.6 2004/12/29 12:16:56 agc Exp $");
#endif
#endif
@@ -53,7 +53,7 @@ char *SizeAll = NULL;
char *Preserve = NULL;
char *SrcDir = NULL;
char *realprefix = NULL;
-char PlayPen[FILENAME_MAX];
+char PlayPen[MaxPathSize];
size_t PlayPenSize = sizeof(PlayPen);
int update_pkgdb = 1;
int create_views = 0;
diff --git a/pkgtools/pkg_install/files/create/perform.c b/pkgtools/pkg_install/files/create/perform.c
index df8226ab993..37eab1a4141 100644
--- a/pkgtools/pkg_install/files/create/perform.c
+++ b/pkgtools/pkg_install/files/create/perform.c
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.7 2004/04/09 18:38:12 tv Exp $ */
+/* $NetBSD: perform.c,v 1.8 2004/12/29 12:16:56 agc Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#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.7 2004/04/09 18:38:12 tv Exp $");
+__RCSID("$NetBSD: perform.c,v 1.8 2004/12/29 12:16:56 agc Exp $");
#endif
#endif
@@ -56,7 +56,7 @@ static char *Home;
static void
make_dist(const char *home, const char *pkg, const char *suffix, const package_t *plist)
{
- char tball[FILENAME_MAX];
+ char tball[MaxPathSize];
const plist_t *p;
int ret;
char *args[50]; /* Much more than enough. */
@@ -233,7 +233,7 @@ pkg_perform(lpkg_head_t *pkgs)
package_t plist;
char *suffix; /* What we tack on to the end of the finished package */
lpkg_t *lpp;
- char installed[FILENAME_MAX];
+ char installed[MaxPathSize];
lpp = TAILQ_FIRST(pkgs);
pkg = lpp->lp_name; /* Only one arg to create */
diff --git a/pkgtools/pkg_install/files/create/pl.c b/pkgtools/pkg_install/files/create/pl.c
index 5b67b3c6ddc..55446c2bf15 100644
--- a/pkgtools/pkg_install/files/create/pl.c
+++ b/pkgtools/pkg_install/files/create/pl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pl.c,v 1.8 2004/08/06 16:57:03 jlam Exp $ */
+/* $NetBSD: pl.c,v 1.9 2004/12/29 12:16:56 agc Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static const char *rcsid = "from FreeBSD Id: pl.c,v 1.11 1997/10/08 07:46:35 charnier Exp";
#else
-__RCSID("$NetBSD: pl.c,v 1.8 2004/08/06 16:57:03 jlam Exp $");
+__RCSID("$NetBSD: pl.c,v 1.9 2004/12/29 12:16:56 agc Exp $");
#endif
#endif
@@ -50,8 +50,8 @@ __RCSID("$NetBSD: pl.c,v 1.8 2004/08/06 16:57:03 jlam Exp $");
static void
CheckSymlink(char *name, char *prefix, size_t prefixcc)
{
- char newtgt[MAXPATHLEN];
- char oldtgt[MAXPATHLEN];
+ char newtgt[MaxPathSize];
+ char oldtgt[MaxPathSize];
char *slash;
int slashc;
int cc;
@@ -124,8 +124,8 @@ check_list(char *home, package_t *pkg, const char *PkgName)
plist_t *tmp;
plist_t *p;
char buf[ChecksumHeaderLen + LegibleChecksumLen];
- char target[FILENAME_MAX + SymlinkHeaderLen];
- char name[FILENAME_MAX];
+ char target[MaxPathSize + SymlinkHeaderLen];
+ char name[MaxPathSize];
char *cwd = home;
char *srcdir = NULL;
int dirc;
@@ -159,7 +159,7 @@ check_list(char *home, package_t *pkg, const char *PkgName)
* starts, it's ok to do this somewhere here
*/
if (update_pkgdb) {
- char *s, t[FILENAME_MAX];
+ char *s, t[MaxPathSize];
(void) snprintf(t, sizeof(t), "%s%s%s",
cwd,
diff --git a/pkgtools/pkg_install/files/delete/main.c b/pkgtools/pkg_install/files/delete/main.c
index 0fe3b571210..fc125ddab54 100644
--- a/pkgtools/pkg_install/files/delete/main.c
+++ b/pkgtools/pkg_install/files/delete/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.15 2004/11/03 14:03:53 wiz Exp $ */
+/* $NetBSD: main.c,v 1.16 2004/12/29 12:16:56 agc Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static char *rcsid = "from FreeBSD Id: main.c,v 1.11 1997/10/08 07:46:48 charnier Exp";
#else
-__RCSID("$NetBSD: main.c,v 1.15 2004/11/03 14:03:53 wiz Exp $");
+__RCSID("$NetBSD: main.c,v 1.16 2004/12/29 12:16:56 agc Exp $");
#endif
#endif
@@ -199,7 +199,7 @@ main(int argc, char **argv)
/* Only delete the given packages' files from pkgdb, do not
* touch the pkg itself. Used by "make reinstall" in
* bsd.pkg.mk */
- char cachename[FILENAME_MAX];
+ char cachename[MaxPathSize];
if (!pkgdb_open(ReadWrite)) {
err(EXIT_FAILURE, "cannot open %s", _pkgdb_getPKGDB_FILE(cachename, sizeof(cachename)));
diff --git a/pkgtools/pkg_install/files/delete/perform.c b/pkgtools/pkg_install/files/delete/perform.c
index 3d7be264bc8..14c5fb9f3ea 100644
--- a/pkgtools/pkg_install/files/delete/perform.c
+++ b/pkgtools/pkg_install/files/delete/perform.c
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.12 2004/11/02 00:10:15 erh Exp $ */
+/* $NetBSD: perform.c,v 1.13 2004/12/29 12:16:56 agc Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#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.12 2004/11/02 00:10:15 erh Exp $");
+__RCSID("$NetBSD: perform.c,v 1.13 2004/12/29 12:16:56 agc Exp $");
#endif
#endif
@@ -85,9 +85,9 @@ static int require_delete(char *, int);
static void require_print(void);
static int undepend(const char *, void *);
-static char LogDir[FILENAME_MAX];
-static char linebuf[FILENAME_MAX];
-static char pkgdir[FILENAME_MAX];
+static char LogDir[MaxPathSize];
+static char linebuf[MaxPathSize];
+static char pkgdir[MaxPathSize];
static package_t Plist;
@@ -121,8 +121,8 @@ static int
undepend(const char *deppkgname, void *vp)
{
char *pkg2delname = vp;
- char fname[FILENAME_MAX], ftmp[FILENAME_MAX];
- char fbuf[FILENAME_MAX];
+ char fname[MaxPathSize], ftmp[MaxPathSize];
+ char fbuf[MaxPathSize];
FILE *fp, *fpwr;
int s;
@@ -180,9 +180,9 @@ undepend(const char *deppkgname, void *vp)
static int
unview(const char *pkgname)
{
- char fname[FILENAME_MAX], ftmp[FILENAME_MAX];
- char fbuf[FILENAME_MAX];
- char dbdir[FILENAME_MAX];
+ char fname[MaxPathSize], ftmp[MaxPathSize];
+ char fbuf[MaxPathSize];
+ char dbdir[MaxPathSize];
FILE *fp, *fpwr;
int s;
int cc;
@@ -282,7 +282,7 @@ require_delete(char *home, int tryall)
lpp = TAILQ_FIRST(&lpdelq);
for (; lpp; lpp = TAILQ_NEXT(lpp, lp_link)) {
int rm_installed; /* delete expanded pkg, not @pkgdep value */
- char installed[FILENAME_MAX];
+ char installed[MaxPathSize];
/* go to the db dir */
if (chdir(pkgdir) == FAIL) {
@@ -494,7 +494,7 @@ require_find_recursive_down(lpkg_t *thislpp, package_t *plist)
/* prepare for recursion */
chdir(_pkgdb_getPKGDB_DIR());
if (ispkgpattern(lpp->lp_name)) {
- char installed[FILENAME_MAX];
+ char installed[MaxPathSize];
if (findmatchingname(".", lpp->lp_name, note_whats_installed, installed) != 1) {
warnx("cannot remove dependency for pkg-pattern %s", lpp->lp_name);
fail = 1;
@@ -607,8 +607,8 @@ pkg_do(char *pkg)
plist_t *p;
FILE *cfile;
FILE *fp;
- char home[FILENAME_MAX];
- char view[FILENAME_MAX];
+ char home[MaxPathSize];
+ char view[MaxPathSize];
int cc;
Boolean is_depoted_pkg = FALSE;
@@ -621,13 +621,13 @@ pkg_do(char *pkg)
if (!fexists(LogDir) || !(isdir(LogDir) || islinktodir(LogDir))) {
/* Check if the given package name matches something
* with 'pkg-[0-9]*' */
- char try[FILENAME_MAX];
+ char try[MaxPathSize];
lpkg_head_t trypkgs;
lpkg_t *lpp;
int qlen = 0;
TAILQ_INIT(&trypkgs);
- snprintf(try, FILENAME_MAX, "%s-[0-9]*", pkg);
+ snprintf(try, MaxPathSize, "%s-[0-9]*", pkg);
if (findmatchingname(_pkgdb_getPKGDB_DIR(), try,
add_to_list_fn, &trypkgs) == 0) {
warnx("package '%s' not installed", pkg);
@@ -657,7 +657,7 @@ pkg_do(char *pkg)
return 0;
}
- if (!getcwd(home, FILENAME_MAX)) {
+ if (!getcwd(home, MaxPathSize)) {
cleanup(0);
errx(2, "unable to get current working directory!");
}
diff --git a/pkgtools/pkg_install/files/info/main.c b/pkgtools/pkg_install/files/info/main.c
index 744f5be8fc1..433bdb8b691 100644
--- a/pkgtools/pkg_install/files/info/main.c
+++ b/pkgtools/pkg_install/files/info/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.11 2004/08/20 20:09:53 jlam Exp $ */
+/* $NetBSD: main.c,v 1.12 2004/12/29 12:16:56 agc Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static char *rcsid = "from FreeBSD Id: main.c,v 1.14 1997/10/08 07:47:26 charnier Exp";
#else
-__RCSID("$NetBSD: main.c,v 1.11 2004/08/20 20:09:53 jlam Exp $");
+__RCSID("$NetBSD: main.c,v 1.12 2004/12/29 12:16:56 agc Exp $");
#endif
#endif
@@ -58,7 +58,7 @@ Boolean File2Pkg = FALSE;
Boolean Quiet = FALSE;
char *InfoPrefix = "";
char *BuildInfoVariable = "";
-char PlayPen[FILENAME_MAX];
+char PlayPen[MaxPathSize];
size_t PlayPenSize = sizeof(PlayPen);
char *CheckPkg = NULL;
size_t termwidth = 0;
diff --git a/pkgtools/pkg_install/files/info/perform.c b/pkgtools/pkg_install/files/info/perform.c
index 6f462544562..6b2a162815e 100644
--- a/pkgtools/pkg_install/files/info/perform.c
+++ b/pkgtools/pkg_install/files/info/perform.c
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.17 2004/11/02 00:44:00 erh Exp $ */
+/* $NetBSD: perform.c,v 1.18 2004/12/29 12:16:56 agc Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#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.17 2004/11/02 00:44:00 erh Exp $");
+__RCSID("$NetBSD: perform.c,v 1.18 2004/12/29 12:16:56 agc Exp $");
#endif
#endif
@@ -64,8 +64,8 @@ static int
pkg_do(char *pkg)
{
Boolean installed = FALSE, isTMP = FALSE;
- char log_dir[FILENAME_MAX];
- char fname[FILENAME_MAX];
+ char log_dir[MaxPathSize];
+ char fname[MaxPathSize];
struct stat sb;
char *cp = NULL;
int code = 0;
@@ -80,7 +80,7 @@ pkg_do(char *pkg)
int len;
if (*pkg != '/') {
- if (!getcwd(fname, FILENAME_MAX)) {
+ if (!getcwd(fname, MaxPathSize)) {
cleanup(0);
err(EXIT_FAILURE, "fatal error during execution: getcwd");
}
@@ -92,7 +92,7 @@ pkg_do(char *pkg)
cp = fname;
} else if (usedot) {
if ((cp = fileFindByPath(pkg)) != NULL) {
- strncpy(fname, cp, FILENAME_MAX);
+ strncpy(fname, cp, MaxPathSize);
}
}
@@ -169,8 +169,8 @@ pkg_do(char *pkg)
{
/* Check if the given package name matches
* something with 'pkg-[0-9]*' */
- char try[FILENAME_MAX];
- snprintf(try, FILENAME_MAX, "%s-[0-9]*", pkg);
+ char try[MaxPathSize];
+ snprintf(try, MaxPathSize, "%s-[0-9]*", pkg);
if (findmatchingname(_pkgdb_getPKGDB_DIR(), try,
add_to_list_fn, &pkgs) > 0) {
return 0; /* we've just appended some names to the pkgs list,
@@ -195,7 +195,7 @@ pkg_do(char *pkg)
* any sense.
*/
if (Flags & SHOW_INDEX) {
- char tmp[FILENAME_MAX];
+ char tmp[MaxPathSize];
(void) snprintf(tmp, sizeof(tmp), "%-19s ", pkg);
show_index(tmp, COMMENT_FNAME);
@@ -297,7 +297,7 @@ static int
foundpkg(const char *found, void *vp)
{
char *data = vp;
- char buf[FILENAME_MAX+1];
+ char buf[MaxPathSize+1];
/* we only want to display this if it really is a directory */
snprintf(buf, sizeof(buf), "%s/%s", data, found);
@@ -321,7 +321,7 @@ foundpkg(const char *found, void *vp)
static int
CheckForPkg(char *pkgspec, char *dbdir)
{
- char buf[FILENAME_MAX];
+ char buf[MaxPathSize];
int error;
if (strpbrk(pkgspec, "<>[]?*{")) {
@@ -341,8 +341,8 @@ CheckForPkg(char *pkgspec, char *dbdir)
if (error) {
/* found nothing - try 'pkg-[0-9]*' */
- char try[FILENAME_MAX];
- snprintf(try, FILENAME_MAX, "%s-[0-9]*", pkgspec);
+ char try[MaxPathSize];
+ snprintf(try, MaxPathSize, "%s-[0-9]*", pkgspec);
if (findmatchingname(dbdir, try, foundpkg, dbdir) > 0) {
error = 0;
}
@@ -385,7 +385,7 @@ pkg_perform(lpkg_head_t *pkghead)
/* Show all packges with description */
if ((dirp = opendir(dbdir)) != (DIR *) NULL) {
while ((dp = readdir(dirp)) != (struct dirent *) NULL) {
- char tmp2[FILENAME_MAX];
+ char tmp2[MaxPathSize];
if (strcmp(dp->d_name, ".") == 0 ||
strcmp(dp->d_name, "..") == 0)
diff --git a/pkgtools/pkg_install/files/lib/file.c b/pkgtools/pkg_install/files/lib/file.c
index c3e65b17aee..b335fbc495d 100644
--- a/pkgtools/pkg_install/files/lib/file.c
+++ b/pkgtools/pkg_install/files/lib/file.c
@@ -1,4 +1,4 @@
-/* $NetBSD: file.c,v 1.12 2004/01/14 23:55:29 jlam Exp $ */
+/* $NetBSD: file.c,v 1.13 2004/12/29 12:16:56 agc Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#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.12 2004/01/14 23:55:29 jlam Exp $");
+__RCSID("$NetBSD: file.c,v 1.13 2004/12/29 12:16:56 agc Exp $");
#endif
#endif
@@ -255,10 +255,10 @@ fileURLFilename(const char *fname, char *where, int max)
char *
fileGetURL(const char *spec)
{
- char host[MAXHOSTNAMELEN], file[FILENAME_MAX];
+ char host[MAXHOSTNAMELEN], file[MaxPathSize];
const char *cp;
char *rp;
- char pen[FILENAME_MAX];
+ char pen[MaxPathSize];
int rc;
rp = NULL;
@@ -272,7 +272,7 @@ fileGetURL(const char *spec)
warnx("URL `%s' has bad host part!", spec);
return NULL;
}
- cp = fileURLFilename(spec, file, FILENAME_MAX);
+ cp = fileURLFilename(spec, file, MaxPathSize);
if (!*cp) {
warnx("URL `%s' has bad filename part!", spec);
return NULL;
@@ -302,7 +302,7 @@ fileGetURL(const char *spec)
static char *
resolvepattern1(const char *name)
{
- static char tmp[FILENAME_MAX];
+ static char tmp[MaxPathSize];
char *cp;
if (IS_URL(name)) {
@@ -338,7 +338,7 @@ resolvepattern1(const char *name)
static char *
resolvepattern(const char *name)
{
- char tmp[FILENAME_MAX];
+ char tmp[MaxPathSize];
char *cp;
const char *suf;
@@ -375,7 +375,7 @@ resolvepattern(const char *name)
char *
fileFindByPath(const char *fname)
{
- char tmp[FILENAME_MAX];
+ char tmp[MaxPathSize];
struct path *path;
/*
@@ -399,7 +399,7 @@ fileFindByPath(const char *fname)
snprintf(tmp, sizeof(tmp), "%s/%s", cp2, fname);
}
else {
- char cwdtmp[MAXPATHLEN];
+ char cwdtmp[MaxPathSize];
if (getcwd(cwdtmp, sizeof(cwdtmp)) == NULL)
errx(EXIT_FAILURE, "getcwd");
snprintf(tmp, sizeof(tmp), "%s/%s/%s", cwdtmp, cp2, fname);
@@ -515,7 +515,7 @@ write_file(char *name, char *str)
void
copy_file(char *dir, char *fname, char *to)
{
- char fpath[FILENAME_MAX];
+ char fpath[MaxPathSize];
(void) snprintf(fpath, sizeof(fpath), "%s%s%s",
(fname[0] != '/') ? dir : "",
@@ -530,7 +530,7 @@ copy_file(char *dir, char *fname, char *to)
void
move_file(char *dir, char *fname, char *to)
{
- char fpath[FILENAME_MAX];
+ char fpath[MaxPathSize];
(void) snprintf(fpath, sizeof(fpath), "%s%s%s",
(fname[0] != '/') ? dir : "",
@@ -545,7 +545,7 @@ move_file(char *dir, char *fname, char *to)
void
remove_files(const char *path, const char *pattern)
{
- char fpath[FILENAME_MAX];
+ char fpath[MaxPathSize];
glob_t globbed;
int i;
@@ -583,7 +583,7 @@ int
unpack(const char *pkg, const char *flist)
{
char args[10] = "-";
- char cmd[FILENAME_MAX];
+ char cmd[MaxPathSize];
const char *decompress_cmd = NULL;
const char *suf;
@@ -630,7 +630,7 @@ unpack(const char *pkg, const char *flist)
void
format_cmd(char *buf, size_t size, char *fmt, char *dir, char *name)
{
- char scratch[FILENAME_MAX * 2];
+ char scratch[MaxPathSize * 2];
char *bufp;
char *cp;
diff --git a/pkgtools/pkg_install/files/lib/ftpio.c b/pkgtools/pkg_install/files/lib/ftpio.c
index d5817f7f7f1..f69d7928e72 100644
--- a/pkgtools/pkg_install/files/lib/ftpio.c
+++ b/pkgtools/pkg_install/files/lib/ftpio.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ftpio.c,v 1.12 2004/11/02 00:44:00 erh Exp $ */
+/* $NetBSD: ftpio.c,v 1.13 2004/12/29 12:16:56 agc Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -8,7 +8,7 @@
#include <sys/cdefs.h>
#endif
#ifndef lint
-__RCSID("$NetBSD: ftpio.c,v 1.12 2004/11/02 00:44:00 erh Exp $");
+__RCSID("$NetBSD: ftpio.c,v 1.13 2004/12/29 12:16:56 agc Exp $");
#endif
/*-
@@ -612,7 +612,7 @@ expandURL(char *expandedurl, const char *wildcardurl)
{
char *pattern;
char *bestmatch;
- char base[FILENAME_MAX];
+ char base[MaxPathSize];
pattern=strrchr(wildcardurl, '/');
if (pattern == NULL){
@@ -641,7 +641,7 @@ expandURL(char *expandedurl, const char *wildcardurl)
if (bestmatch == NULL)
return -1;
- snprintf(expandedurl, FILENAME_MAX, "%s%s", base, bestmatch);
+ snprintf(expandedurl, MaxPathSize, "%s%s", base, bestmatch);
if (Verbose)
printf("best match: '%s'\n", expandedurl);
@@ -652,9 +652,9 @@ expandURL(char *expandedurl, const char *wildcardurl)
static char *
ftp_expand_URL(const char *base, char *pattern)
{
- char *s, buf[FILENAME_MAX];
- char tmpname[FILENAME_MAX];
- char best[FILENAME_MAX];
+ char *s, buf[MaxPathSize];
+ char tmpname[MaxPathSize];
+ char best[MaxPathSize];
int rc, tfd;
rc = ftp_start(base);
@@ -708,7 +708,7 @@ ftp_expand_URL(const char *base, char *pattern)
if (access(tmpname, R_OK)==0) {
int matches;
FILE *f;
- char filename[FILENAME_MAX];
+ char filename[MaxPathSize];
f=fopen(tmpname, "r");
if (f == NULL) {
@@ -726,8 +726,8 @@ ftp_expand_URL(const char *base, char *pattern)
* suffix here
*/
- char s_filename[FILENAME_MAX];
- char s_pattern[FILENAME_MAX];
+ char s_filename[MaxPathSize];
+ char s_pattern[MaxPathSize];
filename[strlen(filename)-1] = '\0';
@@ -759,9 +759,9 @@ ftp_expand_URL(const char *base, char *pattern)
static char *
http_expand_URL(const char *base, char *pattern)
{
- char best[FILENAME_MAX];
+ char best[MaxPathSize];
char line[BUFSIZ];
- char filename[FILENAME_MAX];
+ char filename[MaxPathSize];
FILE *fp;
int pipefds[2];
int state;
@@ -798,7 +798,7 @@ http_expand_URL(const char *base, char *pattern)
if ((fp=fdopen(pipefds[0], "r")) == NULL)
warn("can't fdopen pipe end");
else {
- char s_pattern[FILENAME_MAX];
+ char s_pattern[MaxPathSize];
int len, offset;
/* strip of .t[bg]z for comparison */
@@ -812,7 +812,7 @@ http_expand_URL(const char *base, char *pattern)
len = offset = 0;
while ((len=http_extract_fn(line+offset, filename,
sizeof(filename))) > 0) {
- char s_filename[FILENAME_MAX];
+ char s_filename[MaxPathSize];
offset += len;
strip_txz(s_filename, NULL, filename);
@@ -854,7 +854,7 @@ static int
http_extract_fn(char *input, char *outbuf, size_t outbuflen)
{
/* partial copied hrefs from previous calls are saved here */
- static char tempbuf[FILENAME_MAX];
+ static char tempbuf[MaxPathSize];
/* fill state of tempbuf */
static int tempbuffill = 0;
/* parsing state information */
@@ -1171,12 +1171,12 @@ unpackURL(const char *url, const char *dir)
{
char *pkg;
int rc;
- char base[FILENAME_MAX];
- char pkg_path[FILENAME_MAX];
+ char base[MaxPathSize];
+ char pkg_path[MaxPathSize];
{
/* Verify if the URL is really ok */
- char expnd[FILENAME_MAX];
+ char expnd[MaxPathSize];
rc=expandURL(expnd, url);
if (rc == -1) {
@@ -1285,7 +1285,7 @@ main(int argc, char *argv[])
usage();
while(argv[0] != NULL) {
- char newurl[FILENAME_MAX];
+ char newurl[MaxPathSize];
printf("Expand %s:\n", argv[0]);
rc = expandURL(newurl, argv[0]);
@@ -1296,7 +1296,7 @@ main(int argc, char *argv[])
/* test out connection caching */
if (1) {
- char *s, buf[FILENAME_MAX];
+ char *s, buf[MaxPathSize];
if ((s=getenv(PKG_FTPIO_CNT)) && atoi(s)>0){
(void) snprintf(buf, sizeof(buf),"%d", atoi(s)-1);
diff --git a/pkgtools/pkg_install/files/lib/lib.h b/pkgtools/pkg_install/files/lib/lib.h
index f0a264aabaa..eb4debb13eb 100644
--- a/pkgtools/pkg_install/files/lib/lib.h
+++ b/pkgtools/pkg_install/files/lib/lib.h
@@ -1,4 +1,4 @@
-/* $NetBSD: lib.h,v 1.14 2004/12/09 20:10:34 erh Exp $ */
+/* $NetBSD: lib.h,v 1.15 2004/12/29 12:16:56 agc Exp $ */
/* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */
@@ -131,6 +131,15 @@
# endif
#endif
+/* some operating systems don't have this */
+#ifndef MAXPATHLEN
+#define MAXPATHLEN 1024
+#endif
+
+enum {
+ MaxPathSize = MAXPATHLEN
+};
+
/* The names of our "special" files */
#define CONTENTS_FNAME "+CONTENTS"
#define COMMENT_FNAME "+COMMENT"
@@ -160,7 +169,7 @@
/* The name of the "prefix" environment variable given to scripts */
#define PKG_PREFIX_VNAME "PKG_PREFIX"
-#define PKG_PATTERN_MAX FILENAME_MAX /* max length of pattern, including nul */
+#define PKG_PATTERN_MAX MaxPathSize /* max length of pattern, including nul */
#define PKG_SUFFIX_MAX 10 /* max length of suffix, including nul */
enum {
diff --git a/pkgtools/pkg_install/files/lib/path.c b/pkgtools/pkg_install/files/lib/path.c
index 9a4eef13467..5ef484ebffd 100644
--- a/pkgtools/pkg_install/files/lib/path.c
+++ b/pkgtools/pkg_install/files/lib/path.c
@@ -1,4 +1,4 @@
-/* $NetBSD: path.c,v 1.5 2003/09/23 07:13:53 grant Exp $ */
+/* $NetBSD: path.c,v 1.6 2004/12/29 12:16:56 agc Exp $ */
/*-
* Copyright (c)2002 YAMAMOTO Takashi,
@@ -34,7 +34,7 @@
#include <sys/cdefs.h>
#endif
#ifndef lint
-__RCSID("$NetBSD: path.c,v 1.5 2003/09/23 07:13:53 grant Exp $");
+__RCSID("$NetBSD: path.c,v 1.6 2004/12/29 12:16:56 agc Exp $");
#endif
#if HAVE_ERR_H
@@ -120,7 +120,7 @@ path_new_entry(const char *cp, size_t len)
if (!IS_FULLPATH(cp) && !IS_URL(cp)) {
/* this is a relative path */
size_t total;
- char cwd[MAXPATHLEN];
+ char cwd[MaxPathSize];
size_t cwdlen;
if (getcwd(cwd, sizeof(cwd)) == NULL)
diff --git a/pkgtools/pkg_install/files/lib/pen.c b/pkgtools/pkg_install/files/lib/pen.c
index 11dc7cf86e8..d16b18b4598 100644
--- a/pkgtools/pkg_install/files/lib/pen.c
+++ b/pkgtools/pkg_install/files/lib/pen.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pen.c,v 1.15 2004/08/20 20:09:53 jlam Exp $ */
+/* $NetBSD: pen.c,v 1.16 2004/12/29 12:16:56 agc Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static const char *rcsid = "from FreeBSD Id: pen.c,v 1.25 1997/10/08 07:48:12 charnier Exp";
#else
-__RCSID("$NetBSD: pen.c,v 1.15 2004/08/20 20:09:53 jlam Exp $");
+__RCSID("$NetBSD: pen.c,v 1.16 2004/12/29 12:16:56 agc Exp $");
#endif
#endif
@@ -56,8 +56,8 @@ __RCSID("$NetBSD: pen.c,v 1.15 2004/08/20 20:09:53 jlam Exp $");
#endif
/* For keeping track of where we are */
-static char Current[FILENAME_MAX];
-static char Previous[FILENAME_MAX];
+static char Current[MaxPathSize];
+static char Previous[MaxPathSize];
static int CurrentSet; /* rm -fr Current only if it's really set! */
/* CurrentSet is set to 0 before strcpy()s
* to prevent rm'ing of a partial string
@@ -161,7 +161,7 @@ make_playpen(char *pen, size_t pensize, size_t sz)
}
if (Current[0])
strlcpy(Previous, Current, sizeof(Previous));
- else if (!getcwd(Previous, FILENAME_MAX)) {
+ else if (!getcwd(Previous, MaxPathSize)) {
cleanup(0);
err(EXIT_FAILURE, "fatal error during execution: getcwd");
}
diff --git a/pkgtools/pkg_install/files/lib/pkgdb.c b/pkgtools/pkg_install/files/lib/pkgdb.c
index 67b04906d93..2d48d344c75 100644
--- a/pkgtools/pkg_install/files/lib/pkgdb.c
+++ b/pkgtools/pkg_install/files/lib/pkgdb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pkgdb.c,v 1.21 2004/08/20 20:09:53 jlam Exp $ */
+/* $NetBSD: pkgdb.c,v 1.22 2004/12/29 12:16:56 agc Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -8,7 +8,7 @@
#include <sys/cdefs.h>
#endif
#ifndef lint
-__RCSID("$NetBSD: pkgdb.c,v 1.21 2004/08/20 20:09:53 jlam Exp $");
+__RCSID("$NetBSD: pkgdb.c,v 1.22 2004/12/29 12:16:56 agc Exp $");
#endif
/*
@@ -80,7 +80,7 @@ __RCSID("$NetBSD: pkgdb.c,v 1.21 2004/08/20 20:09:53 jlam Exp $");
static DB *pkgdbp;
#endif
static char *pkgdb_dir = NULL;
-static char pkgdb_cache[FILENAME_MAX];
+static char pkgdb_cache[MaxPathSize];
#if HAVE_DBOPEN
/*
@@ -93,7 +93,7 @@ int
pkgdb_open(int mode)
{
BTREEINFO info;
- char cachename[FILENAME_MAX];
+ char cachename[MaxPathSize];
/* try our btree format first */
info.flags = 0;
@@ -142,7 +142,7 @@ pkgdb_store(const char *key, const char *val)
vald.data = (void *) val;
vald.size = strlen(val) + 1;
- if (keyd.size > FILENAME_MAX || vald.size > FILENAME_MAX)
+ if (keyd.size > MaxPathSize || vald.size > MaxPathSize)
return -1;
return (*pkgdbp->put) (pkgdbp, &keyd, &vald, R_NOOVERWRITE);
@@ -214,7 +214,7 @@ pkgdb_remove(const char *key)
keyd.data = (char *) key;
keyd.size = strlen(key) + 1;
- if (keyd.size > FILENAME_MAX)
+ if (keyd.size > MaxPathSize)
return -1;
return (*pkgdbp->del) (pkgdbp, &keyd, 0);
@@ -234,7 +234,7 @@ pkgdb_remove_pkg(const char *pkg)
int type;
int ret;
int cc;
- char cachename[FILENAME_MAX];
+ char cachename[MaxPathSize];
if (pkgdbp == NULL) {
return 0;
diff --git a/pkgtools/pkg_install/files/lib/plist.c b/pkgtools/pkg_install/files/lib/plist.c
index 31a7ad5ffbc..8aa8fdd7c27 100644
--- a/pkgtools/pkg_install/files/lib/plist.c
+++ b/pkgtools/pkg_install/files/lib/plist.c
@@ -1,4 +1,4 @@
-/* $NetBSD: plist.c,v 1.11 2004/11/02 00:10:15 erh Exp $ */
+/* $NetBSD: plist.c,v 1.12 2004/12/29 12:16:56 agc Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static const char *rcsid = "from FreeBSD Id: plist.c,v 1.24 1997/10/08 07:48:15 charnier Exp";
#else
-__RCSID("$NetBSD: plist.c,v 1.11 2004/11/02 00:10:15 erh Exp $");
+__RCSID("$NetBSD: plist.c,v 1.12 2004/12/29 12:16:56 agc Exp $");
#endif
#endif
@@ -243,7 +243,7 @@ int
plist_cmd(char *s, char **arg)
{
const cmd_t *cmdp;
- char cmd[FILENAME_MAX + 20]; /* 20 == fudge for max cmd len */
+ char cmd[MaxPathSize + 20]; /* 20 == fudge for max cmd len */
char *cp;
char *sp;
@@ -270,12 +270,12 @@ plist_cmd(char *s, char **arg)
void
read_plist(package_t *pkg, FILE * fp)
{
- char pline[FILENAME_MAX];
+ char pline[MaxPathSize];
char *cp;
int cmd;
int len;
- while (fgets(pline, FILENAME_MAX, fp) != (char *) NULL) {
+ while (fgets(pline, MaxPathSize, fp) != (char *) NULL) {
for (len = strlen(pline); len &&
isspace((unsigned char) pline[len - 1]);) {
pline[--len] = '\0';
@@ -341,7 +341,7 @@ delete_package(Boolean ign_err, Boolean nukedirs, package_t *pkg, Boolean NoDele
char *Where = ".", *last_file = "";
int fail = SUCCESS;
Boolean preserve;
- char tmp[FILENAME_MAX], *name = NULL;
+ char tmp[MaxPathSize], *name = NULL;
if (!pkgdb_open(ReadWrite)) {
err(EXIT_FAILURE, "cannot open pkgdb");
@@ -401,7 +401,7 @@ delete_package(Boolean ign_err, Boolean nukedirs, package_t *pkg, Boolean NoDele
}
}
} else if (strncmp(p->next->name, SYMLINK_HEADER, SymlinkHeaderLen) == 0) {
- char buf[FILENAME_MAX + SymlinkHeaderLen];
+ char buf[MaxPathSize + SymlinkHeaderLen];
int cc;
(void) strlcpy(buf, SYMLINK_HEADER,
@@ -440,9 +440,9 @@ delete_package(Boolean ign_err, Boolean nukedirs, package_t *pkg, Boolean NoDele
if (delete_hierarchy(tmp, ign_err, nukedirs))
fail = FAIL;
if (preserve && name) {
- char tmp2[FILENAME_MAX];
+ char tmp2[MaxPathSize];
- if (make_preserve_name(tmp2, FILENAME_MAX, name, tmp)) {
+ if (make_preserve_name(tmp2, MaxPathSize, name, tmp)) {
if (fexists(tmp2)) {
if (rename(tmp2, tmp))
warn("preserve: unable to restore %s as %s",
diff --git a/pkgtools/pkg_install/files/lib/str.c b/pkgtools/pkg_install/files/lib/str.c
index cb3c06c9d9b..82d886ff063 100644
--- a/pkgtools/pkg_install/files/lib/str.c
+++ b/pkgtools/pkg_install/files/lib/str.c
@@ -1,4 +1,4 @@
-/* $NetBSD: str.c,v 1.9 2004/11/10 16:50:39 wiz Exp $ */
+/* $NetBSD: str.c,v 1.10 2004/12/29 12:16:56 agc Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static const char *rcsid = "Id: str.c,v 1.5 1997/10/08 07:48:21 charnier Exp";
#else
-__RCSID("$NetBSD: str.c,v 1.9 2004/11/10 16:50:39 wiz Exp $");
+__RCSID("$NetBSD: str.c,v 1.10 2004/12/29 12:16:56 agc Exp $");
#endif
#endif
@@ -168,7 +168,7 @@ static const test_t modifiers[] = {
{ "pl", 2, Dot },
{ "_", 1, Dot },
{ ".", 1, Dot },
- { NULL, 0, 0 }
+ { NULL, 0, 0 }
};
@@ -325,7 +325,7 @@ static int
alternate_match(const char *pattern, const char *pkg)
{
char *sep;
- char buf[FILENAME_MAX];
+ char buf[MaxPathSize];
char *last;
char *alt;
char *cp;
@@ -374,7 +374,7 @@ dewey_match(const char *pattern, const char *pkg)
char *cp;
char *sep;
char *ver;
- char name[FILENAME_MAX];
+ char name[MaxPathSize];
int op;
int n;
@@ -470,7 +470,7 @@ findmatchingname(const char *dir, const char *pattern, matchfn match, void *data
strip_txz(tmp_pattern, pat_sfx, pattern);
while ((dp = readdir(dirp)) != (struct dirent *) NULL) {
- char tmp_file[FILENAME_MAX];
+ char tmp_file[MaxPathSize];
if (strcmp(dp->d_name, ".") == 0 ||
strcmp(dp->d_name, "..") == 0)
@@ -566,7 +566,7 @@ findbestmatchingname_fn(const char *found, void *vp)
char *
findbestmatchingname(const char *dir, const char *pattern)
{
- char buf[FILENAME_MAX];
+ char buf[MaxPathSize];
buf[0] = '\0';
if (findmatchingname(dir, pattern, findbestmatchingname_fn, buf) > 0
@@ -626,7 +626,7 @@ note_whats_installed(const char *found, void *vp)
{
char *note = vp;
- (void) strlcpy(note, found, FILENAME_MAX);
+ (void) strlcpy(note, found, MaxPathSize);
return 0;
}
@@ -638,7 +638,7 @@ add_to_list_fn(const char *pkg, void *vp)
{
lpkg_head_t *pkgs = vp;
lpkg_t *lpp;
- char fn[FILENAME_MAX];
+ char fn[MaxPathSize];
snprintf(fn, sizeof(fn), "%s/%s", _pkgdb_getPKGDB_DIR(), pkg);
if (isdir(fn) || islinktodir(fn)) {
diff --git a/pkgtools/pkg_install/files/lib/version.h b/pkgtools/pkg_install/files/lib/version.h
index 3b2128b55aa..8308a1afca9 100644
--- a/pkgtools/pkg_install/files/lib/version.h
+++ b/pkgtools/pkg_install/files/lib/version.h
@@ -1,4 +1,4 @@
-/* $NetBSD: version.h,v 1.37 2004/12/10 21:14:40 erh Exp $ */
+/* $NetBSD: version.h,v 1.38 2004/12/29 12:16:56 agc Exp $ */
/*
* Copyright (c) 2001 Thomas Klausner. All rights reserved.
@@ -33,6 +33,6 @@
#ifndef _INST_LIB_VERSION_H_
#define _INST_LIB_VERSION_H_
-#define PKGTOOLS_VERSION "20041209"
+#define PKGTOOLS_VERSION "20041226"
#endif /* _INST_LIB_VERSION_H_ */