From e135c96760ad320e48cabec7a8f4b9f49f37724f Mon Sep 17 00:00:00 2001 From: nishi Date: Tue, 13 Feb 2024 15:28:13 +0000 Subject: [PATCH] finger git-svn-id: file:///raid/svn-main/nishi-libw3/trunk@208 d27a3e52-49c5-7645-884c-6793ebffc270 --- Library/Finger.c | 25 +++++++++++++++++++++++++ Library/W3Finger.h | 17 +++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 Library/Finger.c create mode 100644 Library/W3Finger.h diff --git a/Library/Finger.c b/Library/Finger.c new file mode 100644 index 0000000..8645840 --- /dev/null +++ b/Library/Finger.c @@ -0,0 +1,25 @@ +/* $Id$ */ +#include "W3Finger.h" + +#include "W3Core.h" +#include "W3Util.h" + +#include +#include + +void __W3_Finger_Request(struct W3* w3) { + __W3_Debug("LibW3-Finger", "Sending the request"); + if(w3->path != NULL) __W3_Auto_Write(w3, w3->path + 1, strlen(w3->path) - 1); + __W3_Auto_Write(w3, "\r\n", 2); + char* buf = malloc(w3->readsize); + while(true) { + int len = __W3_Auto_Read(w3, buf, w3->readsize); + if(len <= 0) break; + void* funcptr = __W3_Get_Event(w3, "data"); + if(funcptr != NULL) { + void (*func)(struct W3*, char*, size_t) = (void (*)(struct W3*, char*, size_t))funcptr; + func(w3, buf, len); + } + } + free(buf); +} diff --git a/Library/W3Finger.h b/Library/W3Finger.h new file mode 100644 index 0000000..f38c7b8 --- /dev/null +++ b/Library/W3Finger.h @@ -0,0 +1,17 @@ +/* $Id$ */ +#ifndef __W3FINGER_H__ +#define __W3FINGER_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "W3Core.h" + +void __W3_Finger_Request(struct W3* w3); + +#ifdef __cplusplus +} +#endif + +#endif -- 2.43.0