Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/handle.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/handle.c')
-rw-r--r--lib/libalpm/handle.c53
1 files changed, 30 insertions, 23 deletions
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 36822285..af1cc78b 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -23,7 +23,6 @@
#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
#include <limits.h>
#include <sys/types.h>
#include <syslog.h>
@@ -36,10 +35,8 @@
#include "alpm_list.h"
#include "util.h"
#include "log.h"
-#include "error.h"
#include "trans.h"
#include "alpm.h"
-#include "server.h"
/* global var for handle (private to libalpm) */
pmhandle_t *handle = NULL;
@@ -55,8 +52,6 @@ pmhandle_t *_alpm_handle_new()
handle->lckfd = -1;
handle->logstream = NULL;
- /* see if we're root or not */
- handle->uid = geteuid();
handle->root = NULL;
handle->dbpath = NULL;
handle->cachedirs = NULL;
@@ -120,6 +115,15 @@ alpm_cb_download SYMEXPORT alpm_option_get_dlcb()
return handle->dlcb;
}
+alpm_cb_totaldl SYMEXPORT alpm_option_get_totaldlcb()
+{
+ if (handle == NULL) {
+ pm_errno = PM_ERR_HANDLE_NULL;
+ return NULL;
+ }
+ return handle->totaldlcb;
+}
+
const char SYMEXPORT *alpm_option_get_root()
{
if (handle == NULL) {
@@ -273,6 +277,15 @@ void SYMEXPORT alpm_option_set_dlcb(alpm_cb_download cb)
handle->dlcb = cb;
}
+void SYMEXPORT alpm_option_set_totaldlcb(alpm_cb_totaldl cb)
+{
+ if (handle == NULL) {
+ pm_errno = PM_ERR_HANDLE_NULL;
+ return;
+ }
+ handle->totaldlcb = cb;
+}
+
int SYMEXPORT alpm_option_set_root(const char *root)
{
struct stat st;
@@ -386,7 +399,7 @@ void SYMEXPORT alpm_option_set_cachedirs(alpm_list_t *cachedirs)
int SYMEXPORT alpm_option_remove_cachedir(const char *cachedir)
{
- void *vdata = NULL;
+ char *vdata = NULL;
char *newcachedir;
size_t cachedirlen;
/* verify cachedir ends in a '/' */
@@ -397,8 +410,7 @@ int SYMEXPORT alpm_option_remove_cachedir(const char *cachedir)
newcachedir = calloc(cachedirlen + 1, sizeof(char));
strncpy(newcachedir, cachedir, cachedirlen);
newcachedir[cachedirlen-1] = '/';
- handle->cachedirs = alpm_list_remove(handle->cachedirs, newcachedir,
- _alpm_str_cmp, &vdata);
+ handle->cachedirs = alpm_list_remove_str(handle->cachedirs, newcachedir, &vdata);
FREE(newcachedir);
if(vdata != NULL) {
FREE(vdata);
@@ -451,9 +463,8 @@ void SYMEXPORT alpm_option_set_noupgrades(alpm_list_t *noupgrade)
int SYMEXPORT alpm_option_remove_noupgrade(const char *pkg)
{
- void *vdata = NULL;
- handle->noupgrade = alpm_list_remove(handle->noupgrade, pkg,
- _alpm_str_cmp, &vdata);
+ char *vdata = NULL;
+ handle->noupgrade = alpm_list_remove_str(handle->noupgrade, pkg, &vdata);
if(vdata != NULL) {
FREE(vdata);
return(1);
@@ -474,9 +485,8 @@ void SYMEXPORT alpm_option_set_noextracts(alpm_list_t *noextract)
int SYMEXPORT alpm_option_remove_noextract(const char *pkg)
{
- void *vdata = NULL;
- handle->noextract = alpm_list_remove(handle->noextract, pkg,
- _alpm_str_cmp, &vdata);
+ char *vdata = NULL;
+ handle->noextract = alpm_list_remove_str(handle->noextract, pkg, &vdata);
if(vdata != NULL) {
FREE(vdata);
return(1);
@@ -497,9 +507,8 @@ void SYMEXPORT alpm_option_set_ignorepkgs(alpm_list_t *ignorepkgs)
int SYMEXPORT alpm_option_remove_ignorepkg(const char *pkg)
{
- void *vdata = NULL;
- handle->ignorepkg = alpm_list_remove(handle->ignorepkg, pkg,
- _alpm_str_cmp, &vdata);
+ char *vdata = NULL;
+ handle->ignorepkg = alpm_list_remove_str(handle->ignorepkg, pkg, &vdata);
if(vdata != NULL) {
FREE(vdata);
return(1);
@@ -520,9 +529,8 @@ void SYMEXPORT alpm_option_set_holdpkgs(alpm_list_t *holdpkgs)
int SYMEXPORT alpm_option_remove_holdpkg(const char *pkg)
{
- void *vdata = NULL;
- handle->holdpkg = alpm_list_remove(handle->holdpkg, pkg,
- _alpm_str_cmp, &vdata);
+ char *vdata = NULL;
+ handle->holdpkg = alpm_list_remove_str(handle->holdpkg, pkg, &vdata);
if(vdata != NULL) {
FREE(vdata);
return(1);
@@ -543,9 +551,8 @@ void SYMEXPORT alpm_option_set_ignoregrps(alpm_list_t *ignoregrps)
int SYMEXPORT alpm_option_remove_ignoregrp(const char *grp)
{
- void *vdata = NULL;
- handle->ignoregrp = alpm_list_remove(handle->ignoregrp, grp,
- _alpm_str_cmp, &vdata);
+ char *vdata = NULL;
+ handle->ignoregrp = alpm_list_remove_str(handle->ignoregrp, grp, &vdata);
if(vdata != NULL) {
FREE(vdata);
return(1);