diff --git a/case.h b/case.h index a46b346..e2f164a 100644 --- a/case.h +++ b/case.h @@ -4,12 +4,12 @@ /* turn upper case letters to lower case letters, ASCIIZ */ extern void case_lowers(char *s); /* turn upper case letters to lower case letters, binary */ -extern void case_lowerb(char *buf,unsigned long len); +extern void case_lowerb(void *buf,unsigned long len); /* like str_diff, ignoring case */ extern int case_diffs(const char *,const char *); /* like byte_diff, ignoring case */ -extern int case_diffb(const char *,unsigned long,const char *); +extern int case_diffb(const void *,unsigned long,const void *); /* like str_start, ignoring case */ extern int case_starts(const char *,const char *); diff --git a/case/case_diffb.3 b/case/case_diffb.3 index 35db5de..826fa45 100644 --- a/case/case_diffb.3 +++ b/case/case_diffb.3 @@ -4,7 +4,7 @@ case_diffb \- compare strings case-insensitively .SH SYNTAX .B #include -int \fBcase_diffb\fP(const char* \fIa\fR,unsigned long \fIlen\fR,const char* \fIb\fR); +int \fBcase_diffb\fP(const void* \fIa\fR,unsigned long \fIlen\fR,const void* \fIb\fR); .SH DESCRIPTION case_diffb is similar to byte_diff. The difference is that for the comparison 'A' == 'a', 'B' == 'b', ..., 'Z' == 'z'. diff --git a/case/case_diffb.c b/case/case_diffb.c index cede832..569ba8e 100644 --- a/case/case_diffb.c +++ b/case/case_diffb.c @@ -1,9 +1,11 @@ #include "case.h" -int case_diffb(register const char *s,register unsigned long len,register const char *t) +int case_diffb(register const void* S,register unsigned long len,register const void* T) { register unsigned char x; register unsigned char y; + register const char* s=(const char*)S; + register const char* t=(const char*)T; while (len > 0) { --len; diff --git a/case/case_lowerb.3 b/case/case_lowerb.3 index e91c0eb..2363fc6 100644 --- a/case/case_lowerb.3 +++ b/case/case_lowerb.3 @@ -4,7 +4,7 @@ case_lowerb \- compare strings case-insensitively .SH SYNTAX .B #include -void \fBcase_lowerb\fP(char* \fIs\fR,unsigned long \fIlen\fR); +void \fBcase_lowerb\fP(void* \fIs\fR,unsigned long \fIlen\fR); .SH DESCRIPTION case_lowerb converts each 'A' to 'a', 'B' to 'b', ..., 'Z' to 'z' in \fIs\fR[0], \fIs\fR[1], ..., \fIs\fR[\fIlen\fR]. diff --git a/case/case_lowerb.c b/case/case_lowerb.c index b8fd416..c7461ec 100644 --- a/case/case_lowerb.c +++ b/case/case_lowerb.c @@ -1,6 +1,7 @@ #include "case.h" -void case_lowerb(char *s,unsigned long len) { +void case_lowerb(void *S,unsigned long len) { + char* s=(char*)S; unsigned char x; while (len > 0) { --len; diff --git a/test/dllink.c b/test/dllink.c index b14e915..8bf4ed3 100644 --- a/test/dllink.c +++ b/test/dllink.c @@ -4,6 +4,7 @@ #include "buffer.h" #include #include +#include "case.h" main(int argc,char* argv[]) { int s=socket_tcp4(); @@ -22,7 +23,13 @@ main(int argc,char* argv[]) { perror("connect"); return 1; } - strcpy(buf,"dllink "); strcat(buf,argv[1]); strcat(buf,"\nq\n"); + strcpy(buf,"dllink "); + if (case_equalb(argv[1],6,"ed2k:|")) { + strcat(buf,"ed2k://"); + strcat(buf,argv[1]+5); + } else + strcat(buf,argv[1]); + strcat(buf,"\nq\n"); write(s,buf,strlen(buf)); for (;;) { line[0]=0;