APPENDICES SECTION APPENDIX C

{

int wsize; char *word; int ll;

wsize = 102400; ll=0;

word = (char *) malloc(sizeof(char) * (wsize + 1));

while(1)

{

word[ll] = (char)fgetc(f); if(ll==wsize)

{

word[ll+1] = '\0'; wsize+=102400; word = (char

*)realloc(word,sizeof(char)*(wsize+1));

}

--(*cl);

if((word[ll] == stop) (feof(f)) (!(*cl)))

{

if(word[ll] != stop) ll++;

word[ll] = '\0'; return word;

}

++ll;

}

}

/* to_upper:

*Change the string to upper case */

int to_upper(char *string)

{

int len; int i;

char *tmp=NULL;

if (string && strlen(string))

{

if (!(tmp=(char*)strdup(string))) return 0;

len=strlen(string); for (i=0; i<len; i++)

{

string[i]=toupper(tmp[i]);

}

free(tmp);

8E6 TECHNOLOGIES, PROXYBLOCKER USER GUIDE

421

Page 435
Image 435
8e6 Technologies ProxyBlocker manual 421