From 650879c4925ac04599735302378387741421345c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AB=8F=E8=A8=AA=E5=AD=90?= Date: Tue, 18 Jun 2024 19:34:17 +0900 Subject: =?UTF-8?q?Linux:=20void=E3=81=AE=E3=83=91=E3=83=83=E3=82=B1?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E6=83=85=E5=A0=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/packages.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/packages.c b/src/packages.c index 835aac4..a3a661a 100644 --- a/src/packages.c +++ b/src/packages.c @@ -4,6 +4,12 @@ #include #include +#if defined(__linux__) +#include "distro.h" + +/*const char *distroname;*/ +#endif + const char *run_package_command(const char *command) { char buf[64]; char *out = NULL; @@ -41,8 +47,15 @@ const char *run_package_command(const char *command) { void display_packages() { #if defined(__OpenBSD__) || defined(__NetBSD__) - printf("%s (pkg_info)", run_package_command("pkg_info -a | wc -l | sed \"s/ //g\"")); + printf("%s (pkg_info)", run_package_command("pkg_info -a | wc -l | " + "sed \"s/ //g\"")); #elif defined(__FreeBSD__) || defined(__DragonFly__) - printf("%s (pkg)", run_package_command("pkg info -a | wc -l | sed \"s/ //g\"")); + printf("%s (pkg)", run_package_command("pkg info -a | wc -l | " + "sed \"s/ //g\"")); +#elif defined(__linux__) + if (strncmp(distroname, "void", strlen("void")) == 0) { + printf("%s (xbps-query)", run_package_command("xbps-query -l | wc -l | " + "sed \"s/ //g\"")); + } #endif } -- cgit v1.2.3