diff options
author | Aurelien Foret <aurelien@archlinux.org> | 2005-03-18 19:41:27 +0100 |
---|---|---|
committer | Aurelien Foret <aurelien@archlinux.org> | 2005-03-18 19:41:27 +0100 |
commit | 4b272ae5b6a7de9a110ba9e444607ef44ff1f652 (patch) | |
tree | c5ee07999b30fa3ac2a60e3b419582bc5804d281 | |
parent | 4764f08852808bda58b8038a313f71005571a0d1 (diff) | |
download | pacman-4b272ae5b6a7de9a110ba9e444607ef44ff1f652.tar.gz pacman-4b272ae5b6a7de9a110ba9e444607ef44ff1f652.tar.xz |
Avoided extern references to pmo_root.
Better use PM_OPT_ROOT to know the root.
-rw-r--r-- | src/pacman/package.c | 7 | ||||
-rw-r--r-- | src/pacman/query.c | 6 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/pacman/package.c b/src/pacman/package.c index 36db89aa..860f2888 100644 --- a/src/pacman/package.c +++ b/src/pacman/package.c @@ -29,8 +29,6 @@ #include "list.h" #include "package.h" -extern char *pmo_root; - /* Display the content of an installed package */ void dump_pkg_full(PM_PKG *pkg, int level) @@ -84,6 +82,9 @@ void dump_pkg_full(PM_PKG *pkg, int level) /*if(level > 1 && info->backup) { PM_LIST *i; + char *root; + + alpm_get_option(PM_OPT_ROOT, (long *)&root); fprintf(stdout, "\n"); for(i = alpm_first_entry(info->backup); i; i = alpm_next_entry(i)) { struct stat buf; @@ -98,7 +99,7 @@ void dump_pkg_full(PM_PKG *pkg, int level) } *ptr = '\0'; ptr++; - snprintf(path, PATH_MAX-1, "%s%s", pmo_root, str); + snprintf(path, PATH_MAX-1, "%s%s", root, str); if(!stat(path, &buf)) { md5sum = alpm_get_md5sum(path); if(md5sum == NULL) { diff --git a/src/pacman/query.c b/src/pacman/query.c index 5eec0004..235a8b6d 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -33,7 +33,6 @@ #include "query.h" #include "pacman.h" -extern char *pmo_root; extern unsigned short pmo_q_isfile; extern unsigned short pmo_q_info; extern unsigned short pmo_q_list; @@ -49,6 +48,7 @@ static int query_fileowner(PM_DB *db, char *filename) int gotcha = 0; char rpath[PATH_MAX]; PM_LIST *lp; + char *root; if(db == NULL) { return(0); @@ -63,6 +63,8 @@ static int query_fileowner(PM_DB *db, char *filename) return(1); } + alpm_get_option(PM_OPT_ROOT, (long *)&root); + for(lp = alpm_db_getpkgcache(db); lp && !gotcha; lp = alpm_list_next(lp)) { PM_PKG *info; char *pkgname; @@ -79,7 +81,7 @@ static int query_fileowner(PM_DB *db, char *filename) for(i = alpm_pkg_getinfo(info, PM_PKG_FILES); i && !gotcha; i = alpm_list_next(i)) { char path[PATH_MAX]; - snprintf(path, PATH_MAX, "%s%s", pmo_root, (char *)alpm_list_getdata(i)); + snprintf(path, PATH_MAX, "%s%s", root, (char *)alpm_list_getdata(i)); if(!strcmp(path, rpath)) { printf("%s is owned by %s %s\n", filename, pkgname, (char *)alpm_pkg_getinfo(info, PM_PKG_VERSION)); |