summaryrefslogtreecommitdiff
path: root/sicepat.c
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2021-07-24 14:09:07 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2021-07-24 14:09:07 +0800
commit43bccf79db07e0480b99842615e77183cf2949eb (patch)
treea1e5cedfbb2f6c48438f358b74163a40e38af4c5 /sicepat.c
parentacd4ab68d1f9521983390bfff88dce3980633038 (diff)
parentb960919d909c75dc9c483846c2acec5315a0b7db (diff)
Merge branch 'master' into sicepat
Diffstat (limited to 'sicepat.c')
-rw-r--r--sicepat.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sicepat.c b/sicepat.c
index 9ea4af5..9dd3d19 100644
--- a/sicepat.c
+++ b/sicepat.c
@@ -6,31 +6,33 @@
const char **sicepat_init(char *provisions[])
{
- shipping.base = malloc(strlen(BASE) + 1);
- strcpy(shipping.base, BASE);
+ struct shipping *shipping = shipping_list[PIKUL_SICEPAT];
+ shipping->base = malloc(strlen(BASE) + 1);
+ strcpy(shipping->base, BASE);
static const char *status_trail[] = {
"sicepat",
"status",
"code",
NULL
};
- shipping.status_trail = status_trail;
+ shipping->status_trail = status_trail;
static const char *fields[] = { "api-key", NULL };
return fields;
}
const char **sicepat_services(const char *origin, const char *destination, double weight)
{
- shipping.url = malloc(strlen(shipping.base) + strlen("tariff?origin=") + strlen(origin)
+ struct shipping *shipping = shipping_list[PIKUL_SICEPAT];
+ shipping->url = malloc(strlen(shipping->base) + strlen("tariff?origin=") + strlen(origin)
+ strlen("&destination=") + strlen(destination) + strlen("&weight=") + 9);
- sprintf(shipping.url, "%stariff?origin=%s&destination=%s&weight=%f", shipping.base, origin,
+ sprintf(shipping->url, "%stariff?origin=%s&destination=%s&weight=%f", shipping->base, origin,
destination, weight);
static const char *trail[] = {
"sicepat",
"results",
NULL
};
- shipping.trail = trail;
+ shipping->trail = trail;
static const char *attributes[] = {
"service",
"description",