www.pudn.com > openwebspiderv0.1a.zip > ndzlist.h
/* OpenWebSpider * * Coded by Shen139 * shen139 [at] eviltime (dot) com * * * This file is part of OpenWebSpider * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*TODO*/ #ifndef __NDZLIST #define __NDZLIST #include#include "list.h" NODE* ndzFirst; NODE* ndzCur; NODE* ndzInit() { NODE* first=malloc(sizeof(NODE)); first->field = 0; first->next = NULL; return first; } int lstAddWord(NODE* ndzFirst,char* word) { NODE* newN = malloc(sizeof(NODE)); char* nStr = malloc(MIN(strlen(word)+1,MAXWORDSIZE)); ndzCur = lstGetLastNode(ndzFirst,NULL); ndzCur->next = newN; newN->field = (void*)nStr; strncpy(nStr , word, MIN(strlen(word)+1,MAXWORDSIZE)); newN->next = NULL; return 1; } NODE* ndzLookForWord(NODE* first, char* word) { ndzCur = first; while(ndzCur != NULL) { if(ndzCur->field!=NULL) if(strncmp(((char*)ndzCur->field),word ,strlen(word))==0) return ndzCur; ndzCur=ndzCur->next; } return NULL; } #endif /*EOF*/