[pacman-dev] Arguments for alpm_initialize

Allan McRae allan at archlinux.org
Thu Mar 1 02:14:26 EST 2012


On 01/03/12 17:10, Zameer Manji wrote:
> Hello,
> 
> This is my first time posting on this list, so my apologies if this is
> the incorrect place to ask for help. I've been trying to create a
> wrapper around libalpm for my own uses and I'm trying to get the
> project off the ground with a simple program:
> 
> #include <alpm.h>
> #include <stdio.h>
> 
> int main(void)
> {
>     enum _alpm_errno_t errno = 0;
> 
>     alpm_handle_t* t = alpm_initialize("/", "/var/lib/pacman", &errno);
> 
>     if(t == NULL)

alpm_initialize returns NULL on error, not on success.

>     {
>         printf("Got APLM handle");
>     }
>     else
>     {
>         printf("No Handle");
> 
>         if(errno == 0)
>         {
>             printf("No Error Code Given");
>         }
>     }
> 
>     alpm_release(t);
>     return 0;
> }
> 
> Currently the program outputs "No Handle" and "No Error Code Given".
> What can I do inorder to either get the handle correctly or get an
> error code so I can investigate further?
> 
> --
> - Zameer Manji
> 
> 
> 



More information about the pacman-dev mailing list