change case_*b from char* to void* so it is function pointer compatible

to byte_*
master
leitner 22 years ago
parent 5226dd010d
commit 9e8043f4d8

@ -4,12 +4,12 @@
/* turn upper case letters to lower case letters, ASCIIZ */ /* turn upper case letters to lower case letters, ASCIIZ */
extern void case_lowers(char *s); extern void case_lowers(char *s);
/* turn upper case letters to lower case letters, binary */ /* 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 */ /* like str_diff, ignoring case */
extern int case_diffs(const char *,const char *); extern int case_diffs(const char *,const char *);
/* like byte_diff, ignoring case */ /* 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 */ /* like str_start, ignoring case */
extern int case_starts(const char *,const char *); extern int case_starts(const char *,const char *);

@ -4,7 +4,7 @@ case_diffb \- compare strings case-insensitively
.SH SYNTAX .SH SYNTAX
.B #include <case.h> .B #include <case.h>
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 .SH DESCRIPTION
case_diffb is similar to byte_diff. The difference is that for the case_diffb is similar to byte_diff. The difference is that for the
comparison 'A' == 'a', 'B' == 'b', ..., 'Z' == 'z'. comparison 'A' == 'a', 'B' == 'b', ..., 'Z' == 'z'.

@ -1,9 +1,11 @@
#include "case.h" #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 x;
register unsigned char y; register unsigned char y;
register const char* s=(const char*)S;
register const char* t=(const char*)T;
while (len > 0) { while (len > 0) {
--len; --len;

@ -4,7 +4,7 @@ case_lowerb \- compare strings case-insensitively
.SH SYNTAX .SH SYNTAX
.B #include <case.h> .B #include <case.h>
void \fBcase_lowerb\fP(char* \fIs\fR,unsigned long \fIlen\fR); void \fBcase_lowerb\fP(void* \fIs\fR,unsigned long \fIlen\fR);
.SH DESCRIPTION .SH DESCRIPTION
case_lowerb converts each 'A' to 'a', 'B' to 'b', ..., 'Z' to 'z' in case_lowerb converts each 'A' to 'a', 'B' to 'b', ..., 'Z' to 'z' in
\fIs\fR[0], \fIs\fR[1], ..., \fIs\fR[\fIlen\fR]. \fIs\fR[0], \fIs\fR[1], ..., \fIs\fR[\fIlen\fR].

@ -1,6 +1,7 @@
#include "case.h" #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; unsigned char x;
while (len > 0) { while (len > 0) {
--len; --len;

@ -4,6 +4,7 @@
#include "buffer.h" #include "buffer.h"
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
#include "case.h"
main(int argc,char* argv[]) { main(int argc,char* argv[]) {
int s=socket_tcp4(); int s=socket_tcp4();
@ -22,7 +23,13 @@ main(int argc,char* argv[]) {
perror("connect"); perror("connect");
return 1; 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)); write(s,buf,strlen(buf));
for (;;) { for (;;) {
line[0]=0; line[0]=0;

Loading…
Cancel
Save