From 109c957e897a96e06e2441ba05899fc84a128e32 Mon Sep 17 00:00:00 2001 From: nishi Date: Sat, 27 Jan 2024 08:06:58 +0000 Subject: [PATCH] a git-svn-id: file:///raid/svn-main/nishi-libw3/trunk@111 d27a3e52-49c5-7645-884c-6793ebffc270 --- Example/pop3-list/pop3-list.c | 3 ++- Library/POP3.c | 10 ++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Example/pop3-list/pop3-list.c b/Example/pop3-list/pop3-list.c index 2c2a38a..2ccf98d 100644 --- a/Example/pop3-list/pop3-list.c +++ b/Example/pop3-list/pop3-list.c @@ -22,7 +22,7 @@ void list_handler(struct W3* w3, bool ok, char* data) { W3_POP3_Disconnect(w3); } -void login_handler(struct W3* w3){ +void login_handler(struct W3* w3) { printf("Logged in\n"); W3_Set_Method(w3, "LIST"); W3_POP3_Send_Request(w3); @@ -30,6 +30,7 @@ void login_handler(struct W3* w3){ int main(int argc, char** argv) { if(argc < 4) { + fprintf(stderr, "%s: usage: %s hostname username password\n", argv[0], argv[0]); return 1; } W3_Library_Init(); diff --git a/Library/POP3.c b/Library/POP3.c index 82af69e..b8b9036 100644 --- a/Library/POP3.c +++ b/Library/POP3.c @@ -37,9 +37,9 @@ void __W3_POP3_Request(struct W3* w3) { char c = buf[i]; if(c == '\r') continue; bool newl = false; - if(c == '\n' && newl_cond){ + if(c == '\n' && newl_cond) { newl = true; - }else if(c == '.' && !newl_cond){ + } else if(c == '.' && !newl_cond) { newl_cond = true; } if(newl) { @@ -125,12 +125,10 @@ void W3_POP3_Set_Username(struct W3* w3, const char* username) { __W3_Add_Prop(w void W3_POP3_Set_Password(struct W3* w3, const char* password) { __W3_Add_Prop(w3, "POP3_PASSWORD", password); } void W3_POP3_Send_Request(struct W3* w3) { - if(strcasecmp(w3->method, "LIST") == 0){ + if(strcasecmp(w3->method, "LIST") == 0) { *((bool*)w3->generic) = false; __W3_Auto_Write(w3, "LIST\r\n", 6); } } -void W3_POP3_Disconnect(struct W3* w3){ - __W3_Auto_Write(w3, "QUIT\r\n", 6); -} +void W3_POP3_Disconnect(struct W3* w3) { __W3_Auto_Write(w3, "QUIT\r\n", 6); } -- 2.43.0