From 7180c051d619f0605f2c45929eb516d28bcb709f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Mon, 30 Sep 2019 10:51:34 +0800 Subject: The decimal notations used so far are unsigned integers --- main.c | 4 ++-- request.h | 6 +++--- ticket.c | 2 +- user.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/main.c b/main.c index e18939f..c0183fd 100644 --- a/main.c +++ b/main.c @@ -35,7 +35,7 @@ int main(void) rtclient_user_showname(&user, name); if (user) { - printf("id: %d\nname: %s\npassword: %s\nemailaddress: %s\nrealname: %s\nnickname: %s\norganization: %s\naddress1: %s\naddress2: %s\ncity: %s\nstate: %s\nzip: %s\ncountry: %s\nhomephone: %s\nworkphone: %s\nmobilephone: %s\npagerphone: %s\ncontactinfo: %s\ncomments: %s\nsignature: %s\ngecos: %s\nlang: %d\ntimezone: %d\nprivileged: %d\ndisabled: %d\n" + printf("id: %u\nname: %s\npassword: %s\nemailaddress: %s\nrealname: %s\nnickname: %s\norganization: %s\naddress1: %s\naddress2: %s\ncity: %s\nstate: %s\nzip: %s\ncountry: %s\nhomephone: %s\nworkphone: %s\nmobilephone: %s\npagerphone: %s\ncontactinfo: %s\ncomments: %s\nsignature: %s\ngecos: %s\nlang: %u\ntimezone: %u\nprivileged: %u\ndisabled: %u\n" , user->id , user->name , user->password @@ -71,7 +71,7 @@ int main(void) if (list) { for (size_t i = 0; i < list->length; i++) { struct rtclient_ticket *ticket = list->tickets[i]; - printf("%d: %s\n", ticket->id, ticket->subject); + printf("%u: %s\n", ticket->id, ticket->subject); } rtclient_ticket_freelist(list); } diff --git a/request.h b/request.h index b8edc81..136f202 100644 --- a/request.h +++ b/request.h @@ -29,7 +29,7 @@ inline void request(size_t (*writefunction)(void *, size_t, size_t, void *) sval = va_arg(ap, char *); length += strlen(sval) - 2; break; - case 'd': + case 'u': ival = va_arg(ap, unsigned int); do { length++; @@ -54,9 +54,9 @@ inline void request(size_t (*writefunction)(void *, size_t, size_t, void *) sval = va_arg(ap, char *); strcat(url, sval); break; - case 'd': + case 'u': ival = va_arg(ap, unsigned int); - sprintf(url, "%s%d", url, ival); + sprintf(url, "%s%u", url, ival); break; default: break; diff --git a/ticket.c b/ticket.c index 2e26b81..9ec8bc7 100644 --- a/ticket.c +++ b/ticket.c @@ -107,7 +107,7 @@ void rtclient_ticket_search(rtclient_ticketlist **listptr, const char *query) void rtclient_ticket_history(unsigned int id) { - request(NULL, NULL, NULL, "%s%d%s", "REST/1.0/ticket/", id + request(NULL, NULL, NULL, "%s%u%s", "REST/1.0/ticket/", id , "/history?format=l"); } diff --git a/user.c b/user.c index adba576..9c7f94b 100644 --- a/user.c +++ b/user.c @@ -214,7 +214,7 @@ static inline void user_init(rtclient_user **userptr) void rtclient_user_showid(rtclient_user **userptr, unsigned int id) { user_init(userptr); - request(show_callback, (void *)userptr, NULL, "%s%d", "REST/1.0/user/" + request(show_callback, (void *)userptr, NULL, "%s%u", "REST/1.0/user/" , id); } -- cgit v1.2.3