summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author諏訪子 <suwako@076.moe>2024-06-18 19:34:17 +0900
committer諏訪子 <suwako@076.moe>2024-06-18 19:34:17 +0900
commit650879c4925ac04599735302378387741421345c (patch)
tree05d5dc44e6f02d0063f21ed2e807d2fd72db996e /src
parentcc8dbce294390089e5189d348270ed67ab22d693 (diff)
Linux: voidのパッケージ情報
Diffstat (limited to 'src')
-rw-r--r--src/packages.c17
1 files changed, 15 insertions, 2 deletions
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 <stdlib.h>
#include <string.h>
+#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
}