Avoided extern references to pmo_root.
Better use PM_OPT_ROOT to know the root.
This commit is contained in:
parent
4764f08852
commit
4b272ae5b6
|
@ -29,8 +29,6 @@
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "package.h"
|
#include "package.h"
|
||||||
|
|
||||||
extern char *pmo_root;
|
|
||||||
|
|
||||||
/* Display the content of an installed package
|
/* Display the content of an installed package
|
||||||
*/
|
*/
|
||||||
void dump_pkg_full(PM_PKG *pkg, int level)
|
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) {
|
/*if(level > 1 && info->backup) {
|
||||||
PM_LIST *i;
|
PM_LIST *i;
|
||||||
|
char *root;
|
||||||
|
|
||||||
|
alpm_get_option(PM_OPT_ROOT, (long *)&root);
|
||||||
fprintf(stdout, "\n");
|
fprintf(stdout, "\n");
|
||||||
for(i = alpm_first_entry(info->backup); i; i = alpm_next_entry(i)) {
|
for(i = alpm_first_entry(info->backup); i; i = alpm_next_entry(i)) {
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
|
@ -98,7 +99,7 @@ void dump_pkg_full(PM_PKG *pkg, int level)
|
||||||
}
|
}
|
||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
ptr++;
|
ptr++;
|
||||||
snprintf(path, PATH_MAX-1, "%s%s", pmo_root, str);
|
snprintf(path, PATH_MAX-1, "%s%s", root, str);
|
||||||
if(!stat(path, &buf)) {
|
if(!stat(path, &buf)) {
|
||||||
md5sum = alpm_get_md5sum(path);
|
md5sum = alpm_get_md5sum(path);
|
||||||
if(md5sum == NULL) {
|
if(md5sum == NULL) {
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#include "query.h"
|
#include "query.h"
|
||||||
#include "pacman.h"
|
#include "pacman.h"
|
||||||
|
|
||||||
extern char *pmo_root;
|
|
||||||
extern unsigned short pmo_q_isfile;
|
extern unsigned short pmo_q_isfile;
|
||||||
extern unsigned short pmo_q_info;
|
extern unsigned short pmo_q_info;
|
||||||
extern unsigned short pmo_q_list;
|
extern unsigned short pmo_q_list;
|
||||||
|
@ -49,6 +48,7 @@ static int query_fileowner(PM_DB *db, char *filename)
|
||||||
int gotcha = 0;
|
int gotcha = 0;
|
||||||
char rpath[PATH_MAX];
|
char rpath[PATH_MAX];
|
||||||
PM_LIST *lp;
|
PM_LIST *lp;
|
||||||
|
char *root;
|
||||||
|
|
||||||
if(db == NULL) {
|
if(db == NULL) {
|
||||||
return(0);
|
return(0);
|
||||||
|
@ -63,6 +63,8 @@ static int query_fileowner(PM_DB *db, char *filename)
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
alpm_get_option(PM_OPT_ROOT, (long *)&root);
|
||||||
|
|
||||||
for(lp = alpm_db_getpkgcache(db); lp && !gotcha; lp = alpm_list_next(lp)) {
|
for(lp = alpm_db_getpkgcache(db); lp && !gotcha; lp = alpm_list_next(lp)) {
|
||||||
PM_PKG *info;
|
PM_PKG *info;
|
||||||
char *pkgname;
|
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)) {
|
for(i = alpm_pkg_getinfo(info, PM_PKG_FILES); i && !gotcha; i = alpm_list_next(i)) {
|
||||||
char path[PATH_MAX];
|
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)) {
|
if(!strcmp(path, rpath)) {
|
||||||
printf("%s is owned by %s %s\n", filename, pkgname,
|
printf("%s is owned by %s %s\n", filename, pkgname,
|
||||||
(char *)alpm_pkg_getinfo(info, PM_PKG_VERSION));
|
(char *)alpm_pkg_getinfo(info, PM_PKG_VERSION));
|
||||||
|
|
Loading…
Reference in New Issue