update: recvfile and sendfile callbacks and more ctx function implementations
This commit is contained in:
@ -6,14 +6,15 @@
|
||||
#define DATA_DIR "/tmp/data"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int ret = EXIT_FAILURE;
|
||||
int ret = EXIT_FAILURE;
|
||||
lm_pkg_t *pkg = NULL;
|
||||
lm_ctx_t ctx;
|
||||
|
||||
if (argc != 2) {
|
||||
printf("usage: %s <pool url>\n", argv[0]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
lm_ctx_t ctx;
|
||||
lm_ctx_init(&ctx);
|
||||
|
||||
if (!lm_ctx_set_data(&ctx, DATA_DIR)) {
|
||||
@ -26,11 +27,20 @@ int main(int argc, char *argv[]) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
lm_ctx_pool_test(&ctx, NULL, NULL);
|
||||
lm_ctx_pool_get_info(&ctx, true, true, NULL, NULL);
|
||||
lm_ctx_pool_get_list(&ctx, true, true, NULL, NULL);
|
||||
lm_ctx_ping(&ctx, NULL, NULL);
|
||||
lm_ctx_sync(&ctx, true, NULL, NULL);
|
||||
|
||||
if (!lm_ctx_install(&ctx, "which")) {
|
||||
if ((pkg = lm_ctx_find(&ctx, "which", NULL)) == NULL) {
|
||||
printf("failed to find package: %s (%d)", lm_strerror(), lm_error());
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!lm_ctx_download(&ctx, pkg, NULL, NULL)) {
|
||||
printf("failed to download package: %s (%d)", lm_strerror(), lm_error());
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!lm_ctx_install(&ctx, pkg, NULL, NULL)) {
|
||||
printf("failed to install the package: %s (%d)\n", lm_strerror(), lm_error());
|
||||
goto end;
|
||||
}
|
||||
|
@ -6,14 +6,14 @@
|
||||
#define DATA_DIR "./examples"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int ret = EXIT_FAILURE;
|
||||
int ret = EXIT_FAILURE;
|
||||
lm_ctx_t ctx;
|
||||
|
||||
if (argc != 2) {
|
||||
printf("usage: %s <host>\n", argv[0]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
lm_ctx_t ctx;
|
||||
lm_ctx_init(&ctx);
|
||||
|
||||
if (!lm_ctx_set_data(&ctx, DATA_DIR)) {
|
||||
@ -26,10 +26,9 @@ int main(int argc, char *argv[]) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
lm_ctx_pool_get_info(&ctx, false, false, NULL, NULL);
|
||||
lm_ctx_pool_get_list(&ctx, false, false, NULL, NULL);
|
||||
lm_ctx_sync(&ctx, false, NULL, NULL);
|
||||
|
||||
if (!lm_ctx_pool_serve(&ctx, argv[1], 10)) {
|
||||
if (!lm_ctx_serve(&ctx, argv[1], 10)) {
|
||||
printf("failed to serve the pools: %s (%d)\n", lm_strerror(), lm_error());
|
||||
goto end;
|
||||
}
|
||||
|
Reference in New Issue
Block a user