1 #define _XOPEN_SOURCE 500
10 /* Get info about my account */
11 isds_error
get_my_box(struct isds_ctx
*ctx
,
12 struct isds_DbOwnerInfo
**db_owner_info
) {
13 isds_error err
= IE_SUCCESS
;
14 printf("Getting info about my box:\n");
15 err
= isds_GetOwnerInfoFromLogin(ctx
, db_owner_info
);
17 printf("isds_GetOwnerInfoFromLogin() failed: %s: %s\n",
18 isds_strerror(err
), isds_long_message(ctx
));
20 printf("isds_GetOwnerInfoFromLogin() succeeded\n");
22 print_DbOwnerInfo(*db_owner_info
);
27 int main(int argc
, char **argv
) {
28 struct isds_ctx
*ctx
= NULL
;
30 struct isds_DbOwnerInfo
*db_owner_info
= NULL
;
32 setlocale(LC_ALL
, "");
36 printf("isds_init() failed: %s\n", isds_strerror(err
));
40 isds_set_logging(ILF_ALL
& ~ILF_HTTP
, ILL_ALL
);
42 ctx
= isds_ctx_create();
44 printf("isds_ctx_create() failed");
47 err
= isds_set_timeout(ctx
, 10000);
49 printf("isds_set_timeout() failed: %s\n", isds_strerror(err
));
52 err
= isds_login(ctx
, url
, username(), password(), NULL
, NULL
);
54 printf("isds_login() failed: %s: %s\n", isds_strerror(err
),
55 isds_long_message(ctx
));
57 printf("Logged in :)\n");
62 printf("Get current box info\n");
63 get_my_box(ctx
, &db_owner_info
);
69 struct isds_DbOwnerInfo
*old_owner_info
= NULL
;
70 char *refnumber
= NULL
;
72 old_owner_info
= isds_DbOwnerInfo_duplicate(db_owner_info
);
73 if (!old_owner_info
) {
74 fprintf(stderr
, "No enough memory\n");
78 printf("Updating info about my box: with no change\n");
79 err
= isds_UpdateDataBoxDescr(ctx
, old_owner_info
, db_owner_info
,
82 printf("isds_UpdateDataBoxDescr() failed: %s: %s\n",
83 isds_strerror(err
), isds_long_message(ctx
));
85 printf("isds_UpdateDataBoxDescr() succeeded as request #%s\n",
87 printf("Get new box info\n");
88 get_my_box(ctx
, &db_owner_info
);
92 isds_DbOwnerInfo_free(&old_owner_info
);
95 isds_DbOwnerInfo_free(&db_owner_info
);
99 err
= isds_logout(ctx
);
101 printf("isds_logout() failed: %s\n", isds_strerror(err
));
105 err
= isds_ctx_free(&ctx
);
107 printf("isds_ctx_free() failed: %s\n", isds_strerror(err
));
111 err
= isds_cleanup();
113 printf("isds_cleanup() failed: %s\n", isds_strerror(err
));