Created
May 12, 2021 11:06
-
-
Save msehnout/2d660bcffed57406ed4181cea585a34c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <glib.h> | |
#include <librepo/repoconf.h> | |
int main() { | |
printf("Testing librepo\n"); | |
LrYumRepoConfs *confs = lr_yum_repoconfs_init(); | |
GError *error = NULL; | |
const char *repofile = "/etc/yum.repos.d/redhat.repo"; | |
gboolean success = lr_yum_repoconfs_parse(confs, repofile, &error); | |
if (!success) { | |
printf("Failed to load the repo file\n"); | |
} | |
error = NULL; | |
GSList *repos = lr_yum_repoconfs_get_list(confs, &error); | |
if (!success) { | |
printf("...\n"); | |
} | |
for (GSList *elem = repos; elem; elem = g_slist_next(elem)) { | |
error = NULL; | |
char *name = (char *)calloc('\0', 1000); | |
success = lr_yum_repoconf_getinfo(elem->data, &error, LR_YRC_NAME, &name); | |
if (!success) { | |
printf("Failed to load config options\n"); | |
} else { | |
printf("Name: %s\n", name); | |
} | |
} | |
lr_yum_repoconfs_free(confs); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment