XBPS API example: list installed pkgs (emulating pacman -Q)
In this post I’ll show another simple example of the XBPS API that allows
you to list all installed packages in a root directory; the output emulates
the pacman -Q command from the Archlinux distribution:
To compile the example you’ll have to install some additional packages:
# xbps-install -Sy gcc libxbps-devel pkg-config
And then to compile the C source code:
$ cc `pkg-config --cflags --libs libxbps` list_installed_pkgs.c
You can then specify a path to the root directory to list installed packages: