summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_install/files/info
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2007-08-15 02:08:40 +0000
committerjoerg <joerg@pkgsrc.org>2007-08-15 02:08:40 +0000
commit14b81a308968c2dad98d0b3837bc7e6da467a15a (patch)
treeef7119a3234d243b7b2acce54cee8e0f2b51ef64 /pkgtools/pkg_install/files/info
parent6b930e476d38f70d09002de3c41f3a4f714dc406 (diff)
downloadpkgsrc-14b81a308968c2dad98d0b3837bc7e6da467a15a.tar.gz
Start abstracting pkgdb access by introducing pkgdb_pkg_file.
The function returns the path name of the given file for the package. The memory needs to be freed by the caller.
Diffstat (limited to 'pkgtools/pkg_install/files/info')
-rw-r--r--pkgtools/pkg_install/files/info/show.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/pkgtools/pkg_install/files/info/show.c b/pkgtools/pkg_install/files/info/show.c
index 6e73fcc633d..a1cc73a2b83 100644
--- a/pkgtools/pkg_install/files/info/show.c
+++ b/pkgtools/pkg_install/files/info/show.c
@@ -1,4 +1,4 @@
-/* $NetBSD: show.c,v 1.16 2007/08/09 23:54:17 joerg Exp $ */
+/* $NetBSD: show.c,v 1.17 2007/08/15 02:08:40 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static const char *rcsid = "from FreeBSD Id: show.c,v 1.11 1997/10/08 07:47:38 charnier Exp";
#else
-__RCSID("$NetBSD: show.c,v 1.16 2007/08/09 23:54:17 joerg Exp $");
+__RCSID("$NetBSD: show.c,v 1.17 2007/08/15 02:08:40 joerg Exp $");
#endif
#endif
@@ -139,16 +139,15 @@ show_file(const char *pkg, const char *title, const char *fname, Boolean separat
void
show_var(const char *pkg, const char *fname, const char *variable)
{
- char *value;
- char filename[BUFSIZ];
+ char *filename, *value;
- (void)snprintf(filename, sizeof(filename), "%s/%s/%s",
- _pkgdb_getPKGDB_DIR(), pkg, fname);
+ filename = pkgdb_pkg_file(pkg, fname);
- if ((value=var_get(fname, variable)) != NULL) {
- (void) printf("%s\n", value);
- free(value);
+ if ((value = var_get(filename, variable)) != NULL) {
+ (void) printf("%s\n", value);
+ free(value);
}
+ free(filename);
}
void