Avoided extern references to pmo_root.

Better use PM_OPT_ROOT to know the root.
This commit is contained in:
Aurelien Foret 2005-03-18 18:41:27 +00:00
parent 4764f08852
commit 4b272ae5b6
2 changed files with 8 additions and 5 deletions

View File

@ -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) {

View File

@ -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));