1 #define _XOPEN_SOURCE 500
10 int main(int argc
, char **argv
) {
11 struct isds_ctx
*ctx
= NULL
;
13 struct isds_DbOwnerInfo
*db_owner_info
= NULL
;
14 struct isds_DbUserInfo
*db_user_info
= NULL
;
16 setlocale(LC_ALL
, "");
20 printf("isds_init() failed: %s\n", isds_strerror(err
));
24 isds_set_logging(ILF_ALL
& ~ILF_HTTP
, ILL_ALL
);
26 ctx
= isds_ctx_create();
28 printf("isds_ctx_create() failed");
31 err
= isds_set_timeout(ctx
, 10000);
33 printf("isds_set_timeout() failed: %s\n", isds_strerror(err
));
36 err
= isds_login(ctx
, url
, username(), password(), NULL
, NULL
);
38 printf("isds_login() failed: %s: %s\n", isds_strerror(err
),
39 isds_long_message(ctx
));
41 printf("Logged in :)\n");
46 /* Get info about my box */
47 printf("Getting info about my box:\n");
48 err
= isds_GetOwnerInfoFromLogin(ctx
, &db_owner_info
);
50 printf("isds_GetOwnerInfoFromLogin() failed: %s: %s\n",
51 isds_strerror(err
), isds_long_message(ctx
));
53 printf("isds_GetOwnerInfoFromLogin() succeeded\n");
55 print_DbOwnerInfo(db_owner_info
);
59 /* Get info about my account */
60 printf("Getting info about my account:\n");
61 err
= isds_GetUserInfoFromLogin(ctx
, &db_user_info
);
63 printf("isds_GetUserInfoFromLogin() failed: %s: %s\n",
64 isds_strerror(err
), isds_long_message(ctx
));
66 printf("isds_GetUserInfoFromLogin() succeeded\n");
67 print_DbUserInfo(db_user_info
);
71 if (db_owner_info
&& db_user_info
) {
72 char *refnumber
= NULL
;
74 printf("Deleting user\n");
75 isds_error err
= isds_delete_user(ctx
, db_owner_info
, db_user_info
,
78 printf("isds_delete_user() failed: %s: %s\n",
79 isds_strerror(err
), isds_long_message(ctx
));
81 printf("isds_delete_user() succeeded as request #%s.\n"
82 "This should not happen\n", refnumber
);
87 isds_DbOwnerInfo_free(&db_owner_info
);
88 isds_DbUserInfo_free(&db_user_info
);
91 err
= isds_logout(ctx
);
93 printf("isds_logout() failed: %s\n", isds_strerror(err
));
97 err
= isds_ctx_free(&ctx
);
99 printf("isds_ctx_free() failed: %s\n", isds_strerror(err
));
103 err
= isds_cleanup();
105 printf("isds_cleanup() failed: %s\n", isds_strerror(err
));