Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/rofl0r/proxychains-ng.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorrofl0r <retnyg@gmx.net>2012-11-04 08:10:50 +0400
committerrofl0r <retnyg@gmx.net>2012-11-04 08:10:50 +0400
commit8ce1e51a60da1666b3911d68531195faed213605 (patch)
tree41e1097577cf3539a88818926c6d785cf6c027bd /tests
parent2d58820635154320b097779d98050f370a81de6e (diff)
add some test/debug programs
Diffstat (limited to 'tests')
-rw-r--r--tests/test_gethostent.c24
-rw-r--r--tests/test_proxy_gethostbyname.c23
2 files changed, 47 insertions, 0 deletions
diff --git a/tests/test_gethostent.c b/tests/test_gethostent.c
new file mode 100644
index 000000000..855b2c2
--- /dev/null
+++ b/tests/test_gethostent.c
@@ -0,0 +1,24 @@
+#include <netdb.h>
+#include <stdio.h>
+#include "../src/core.h"
+
+void printhostent(struct hostent *hp) {
+ char ipbuf[16];
+ pc_stringfromipv4(hp->h_addr_list[0], ipbuf);
+ printf("alias: %p, len: %d, name: %s, addrlist: %p, addrtype: %d, ip: %s\n",
+ hp->h_aliases,
+ hp->h_length,
+ hp->h_name,
+ hp->h_addr_list,
+ hp->h_addrtype,
+ ipbuf
+ );
+}
+
+int main(int argc, char** argv) {
+ struct hostent *hp;
+ while((hp = gethostent())) {
+ printhostent(hp);
+ }
+ return 0;
+}
diff --git a/tests/test_proxy_gethostbyname.c b/tests/test_proxy_gethostbyname.c
new file mode 100644
index 000000000..a0902fe
--- /dev/null
+++ b/tests/test_proxy_gethostbyname.c
@@ -0,0 +1,23 @@
+#include "../src/core.h"
+#include <stdio.h>
+
+void printhostent(struct hostent *hp) {
+ char ipbuf[16];
+ pc_stringfromipv4(hp->h_addr_list[0], ipbuf);
+ printf("alias: %p, len: %d, name: %s, addrlist: %p, addrtype: %d, ip: %s\n",
+ hp->h_aliases,
+ hp->h_length,
+ hp->h_name,
+ hp->h_addr_list,
+ hp->h_addrtype,
+ ipbuf
+ );
+}
+int main(int argc, char**argv) {
+ struct hostent* ret;
+ struct gethostbyname_data data;
+ if(argc == 1) return 1;
+ ret = proxy_gethostbyname(argv[1], &data);
+ if(ret) printhostent(ret);
+ return 0;
+} \ No newline at end of file