summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-09-27 08:50:58 +0800
committerꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-09-27 08:50:58 +0800
commit0bfbe518bf7baa28f0720b6c753b550855b495f0 (patch)
tree16354732cfc001b6647807a8c9bfdc7e99c40b2e
parent85bcd2881bb69fdff880b517541fd6ec77cc2a95 (diff)
Move All-Products function to client code
-rw-r--r--client.c9
-rw-r--r--icclient/client.h5
-rw-r--r--icclient/product.h3
-rw-r--r--main.c3
-rw-r--r--product.c6
5 files changed, 15 insertions, 11 deletions
diff --git a/client.c b/client.c
index 9a3857c..61ed428 100644
--- a/client.c
+++ b/client.c
@@ -1,8 +1,11 @@
#include <stdbool.h>
#include <stdlib.h>
#include "login.h"
+#include "icclient/product.h"
#include "icclient/client.h"
+typedef struct icclient_catalog icclient_catalog;
+
CURL *curl = NULL;
char *server_url = NULL;
@@ -29,6 +32,12 @@ bool icclient_init(const char *url, const char *certificate)
return (bool)curl;
}
+void icclient_allproducts(icclient_catalog **catalogptr
+ , size_t (*callback)(void *, size_t, size_t, void *))
+{
+ request(NULL, NULL, NULL, "%s", "All-Products");
+}
+
void icclient_newaccount(const char *username, const char *password
, const char *verify, const char *successpage, const char *nextpage
, const char *failpage)
diff --git a/icclient/client.h b/icclient/client.h
index 6116c1f..503eac3 100644
--- a/icclient/client.h
+++ b/icclient/client.h
@@ -1,11 +1,16 @@
#ifndef ICCLIENT_CLIENT_H
#define ICCLIENT_CLIENT_H
+struct icclient_catalog;
+
#ifdef __cplusplus
extern "C" {
#endif
bool icclient_init(const char *url, const char *certificate);
+ void icclient_allproducts(struct icclient_catalog **catalogptr
+ , size_t (*callback)(void *contents, size_t size
+ , size_t nmemb, void *userdata));
void icclient_newaccount(const char *username, const char *password
, const char *verify, const char *successpage
, const char *nextpage, const char *failpage);
diff --git a/icclient/product.h b/icclient/product.h
index 12da846..6b2b890 100644
--- a/icclient/product.h
+++ b/icclient/product.h
@@ -15,9 +15,6 @@ struct icclient_catalog {
extern "C" {
#endif
- void icclient_product_all(struct icclient_catalog **catalogptr
- , size_t (*callback)(void *contents, size_t size
- , size_t nmemb, void *userdata));
void icclient_product_freecatalog(struct icclient_catalog *catalog);
#ifdef __cplusplus
diff --git a/main.c b/main.c
index 13df866..2d72969 100644
--- a/main.c
+++ b/main.c
@@ -2,7 +2,6 @@
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
-#include <icclient/product.h>
#include <icclient/client.h>
int main(void)
@@ -33,7 +32,7 @@ int main(void)
icclient_logout();
- icclient_product_all(NULL, NULL);
+ icclient_allproducts(NULL, NULL);
icclient_cleanup();
}
diff --git a/product.c b/product.c
index 7eca728..6c30834 100644
--- a/product.c
+++ b/product.c
@@ -4,12 +4,6 @@
typedef struct icclient_catalog icclient_catalog;
-void icclient_product_all(icclient_catalog **catalogptr
- , size_t (*callback)(void *, size_t, size_t, void *))
-{
- request(NULL, NULL, NULL, "%s", "All-Products");
-}
-
void icclient_product_freecatalog(icclient_catalog *catalog)
{
for (size_t i = 0; i < catalog->length; i++) {