From b79c513c07be42378167f412fa9bc35303f1a94a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AB=8F=E8=A8=AA=E5=AD=90?= Date: Wed, 19 Jun 2024 15:43:28 +0900 Subject: =?UTF-8?q?Linux:=20Debian=E3=83=99=E3=83=BC=E3=82=B9=E3=81=AE?= =?UTF-8?q?=E3=83=87=E3=82=A3=E3=82=B9=E3=83=88=E3=83=AD=E3=81=AE=E3=83=91?= =?UTF-8?q?=E3=83=83=E3=82=B1=E3=83=BC=E3=82=B8=E6=83=85=E5=A0=B1=E5=AF=BE?= =?UTF-8?q?=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/packages.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/packages.c b/src/packages.c index a3a661a..e89eb82 100644 --- a/src/packages.c +++ b/src/packages.c @@ -3,6 +3,7 @@ #include #include #include +#include #if defined(__linux__) #include "distro.h" @@ -53,9 +54,12 @@ void display_packages() { printf("%s (pkg)", run_package_command("pkg info -a | wc -l | " "sed \"s/ //g\"")); #elif defined(__linux__) - if (strncmp(distroname, "void", strlen("void")) == 0) { + if (access("/bin/xbps-query", F_OK) != -1) { printf("%s (xbps-query)", run_package_command("xbps-query -l | wc -l | " "sed \"s/ //g\"")); + } else if (access("/usr/bin/dpkg-query", F_OK) != -1) { + printf("%s (dpkg)", run_package_command("dpkg-query -f '.\n' -W | wc -l | " + "sed \"s/ //g\"")); } #endif } -- cgit v1.2.3