first commit
This commit is contained in:
3
CS4210/Project 3/common/strtok_r/CVS/Entries
Normal file
3
CS4210/Project 3/common/strtok_r/CVS/Entries
Normal file
@@ -0,0 +1,3 @@
|
||||
/strtok_r.c/1.3/Sun Apr 2 10:06:57 2006//
|
||||
/strtok_r.h/1.3/Sun Apr 2 10:06:57 2006//
|
||||
D
|
||||
2
CS4210/Project 3/common/strtok_r/CVS/Entries.Extra
Normal file
2
CS4210/Project 3/common/strtok_r/CVS/Entries.Extra
Normal file
@@ -0,0 +1,2 @@
|
||||
/strtok_r.c////*///
|
||||
/strtok_r.h////*///
|
||||
2
CS4210/Project 3/common/strtok_r/CVS/Entries.Extra.Old
Normal file
2
CS4210/Project 3/common/strtok_r/CVS/Entries.Extra.Old
Normal file
@@ -0,0 +1,2 @@
|
||||
/strtok_r.c////*///
|
||||
/strtok_r.h////*///
|
||||
3
CS4210/Project 3/common/strtok_r/CVS/Entries.Old
Normal file
3
CS4210/Project 3/common/strtok_r/CVS/Entries.Old
Normal file
@@ -0,0 +1,3 @@
|
||||
/strtok_r.c/0/dummy timestamp//
|
||||
/strtok_r.h/0/dummy timestamp//
|
||||
D
|
||||
1
CS4210/Project 3/common/strtok_r/CVS/Repository
Normal file
1
CS4210/Project 3/common/strtok_r/CVS/Repository
Normal file
@@ -0,0 +1 @@
|
||||
CS4210/Project 3/common/strtok_r
|
||||
1
CS4210/Project 3/common/strtok_r/CVS/Root
Normal file
1
CS4210/Project 3/common/strtok_r/CVS/Root
Normal file
@@ -0,0 +1 @@
|
||||
:ext:asskoala@192.168.0.3:/usr/_CVS
|
||||
48
CS4210/Project 3/common/strtok_r/strtok_r.c
Normal file
48
CS4210/Project 3/common/strtok_r/strtok_r.c
Normal file
@@ -0,0 +1,48 @@
|
||||
#include "include/strtok_r.h"
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
char *strtok_r(char *s, const char *delim, char** s3)
|
||||
{
|
||||
char *pR;
|
||||
short bDone=0;
|
||||
size_t i,j;
|
||||
|
||||
if(s != NULL){
|
||||
*s3 = s;
|
||||
}
|
||||
if(**s3 == '\0'){
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for(;;){
|
||||
bDone = 1;
|
||||
for(j=0; *(delim+j) != '\0'; j++){
|
||||
if(**s3 == *(delim+j)){
|
||||
**s3 = '\0';
|
||||
(*s3)+=1;
|
||||
bDone = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(bDone == 1){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0; *(*s3+i) != '\0'; i++){
|
||||
|
||||
for(j=0; *(delim+j) != '\0'; j++){
|
||||
if(*(*s3+i) == *(delim+j)){
|
||||
pR = *s3;
|
||||
*(*s3+i) = '\0';
|
||||
*s3 += i+1;
|
||||
|
||||
return pR;
|
||||
}
|
||||
}
|
||||
}
|
||||
pR = *s3;
|
||||
*s3 += i;
|
||||
return pR;
|
||||
}
|
||||
13
CS4210/Project 3/common/strtok_r/strtok_r.h
Normal file
13
CS4210/Project 3/common/strtok_r/strtok_r.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef _STRTOK_R_H_
|
||||
#define _STRTOK_R_H_
|
||||
|
||||
/*
|
||||
* String Tokenizer! :)
|
||||
* Toke up some strings to get
|
||||
*
|
||||
* s = string to toke
|
||||
* delim = deliminator, thing to delim
|
||||
*/
|
||||
char *strtok_r(char *s, const char *delim, char** s3);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user