]> Nishi Git Mirror - libw3.git/commitdiff
finger
authornishi <nishi@d27a3e52-49c5-7645-884c-6793ebffc270>
Tue, 13 Feb 2024 15:28:13 +0000 (15:28 +0000)
committernishi <nishi@d27a3e52-49c5-7645-884c-6793ebffc270>
Tue, 13 Feb 2024 15:28:13 +0000 (15:28 +0000)
git-svn-id: file:///raid/svn-main/nishi-libw3/trunk@208 d27a3e52-49c5-7645-884c-6793ebffc270

Library/Finger.c [new file with mode: 0644]
Library/W3Finger.h [new file with mode: 0644]

diff --git a/Library/Finger.c b/Library/Finger.c
new file mode 100644 (file)
index 0000000..8645840
--- /dev/null
@@ -0,0 +1,25 @@
+/* $Id$ */
+#include "W3Finger.h"
+
+#include "W3Core.h"
+#include "W3Util.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+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 (file)
index 0000000..f38c7b8
--- /dev/null
@@ -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