KDK_PACKAGE_IS_INSTALLED(3)

📦 version 3.0.1.4, in arch rolling, ubuntu resolute, ubuntu stonking

💖 KDK_PACKAGE_IS_INSTALLED(3) 💖

okay bestie, so this one lives in the Library Functions Manual section 3, and honestly? it's a whole vibe. it's called kdk_package_is_installed and it's here to answer the one question we all ask: is this package actually installed, or are we being lied to 🫶


✨ NAME ✨

kdk_package_is_installed — 检测指定包名的软件包是否正确安装 (<- that's "check whether the package with the given name is correctly installed", iykyk 💅)


🌸 SYNOPSIS 🌸

#include <libkynetinfo.h>

extern int kdk_package_is_installed(const char *name, const char *version);

Link with -lkynetinfo.

not me reminding you to actually link it fr fr — no -lkynetinfo, no slay 😭

🦋 Detailed Description 🦋

The main function of the interface is to detect whether the package with the specified package name is installed correctly.

  • the argument name is the package name 📦
  • the argument version is the package version 🔢

that's it, that's the whole job. it checks, it tells you. main character energy but make it a library call ✨


💜 RETURN VALUE 💜

  • On success, return 0. 🎉
  • On error, return -1. 💀
so like... 0 = good, -1 = not good. classic C behaviour, no cap.

🎀 EXAMPLES 🎀

here's the whole thing in action, copied exactly so you don't have to squint:

#include "libkypackages.h"
#include <stdio.h>

static void print_package(kdk_package_t *package)
{
    printf("包名:%s", package->name);
    printf("版本号:%s", package->version);
    printf("包类型:%s", package->section);
    printf("包状态:%s", package->status);
    printf("包大小:%lu0, package->size_kb);
}

int main()
{
    kdk_package_list *list = kdk_package_get_packagelist();
    printf("系统中一共%u个软件包0, list->nums);
    for (size_t i = 0; i < list->nums; i ++)
    {
        print_package(list->list[i]);
    }
    kdk_package_free_packagelist(list);

    printf("Evolution是否安装:%s0, kdk_package_is_installed("evolution", NULL) == 1 ? "是" : "否");
    char *version = kdk_package_get_version("evolution");
    printf("Evolution版本号:%s0, version);
    free(version);

    return 0;
}

🌈 CONFORMING TO 🌈

These functions are as per the withdrawn POSIX.1e draft specification.

The following functions are Linux extensions:

  • kdk_package_get_packagelist()
  • kdk_package_free_packagelist()
  • kdk_package_get_version()
"withdrawn" bestie. the draft got cancelled. it still ate though 💅

👑 SEE ALSO 👑


and that's the whole page, periodt 🫶 this was Linux Programmer's Manual business, dated Mon Sep 18 2023, filed under KDK_PACKAGE_IS_INSTALLED(3) — go forth and check ur packages, babe 💖✨🎀

📦 where this page comes from