示例#1
0
void inthash_delete(inthash * hashtable) {
  if (hashtable) {
    if (*hashtable) {
      if ((*hashtable)->hash) {
        unsigned int i;
        t_inthash_freehandler free_handler = NULL;

        if ((*hashtable)->flag_valueismalloc) {
          if ((*hashtable)->free_handler)
            free_handler = (*hashtable)->free_handler;
          else
            free_handler = inthash_default_free_handler;
        }
        for(i = 0; i < (*hashtable)->hash_size; i++) {
          inthash_delchain((*hashtable)->hash[i], free_handler);
          (*hashtable)->hash[i] = NULL;
        }
        freet((*hashtable)->hash);
        (*hashtable)->hash = NULL;
      }
      freet(*hashtable);
      *hashtable = NULL;
    }
  }
}
示例#2
0
void clearCallbacks(htscallbacks* chain_) {
  htscallbacks* chain;
  chain = chain_;
  while(chain != NULL) {
    if (chain->exitFnc != NULL) {
      (void) chain->exitFnc();      /* result ignored */
      chain->exitFnc = NULL;
    }
    chain = chain->next;
  }
  chain = chain_;
  while(chain != NULL) {
    if (chain->moduleHandle != NULL) {
#ifdef _WIN32
      FreeLibrary(chain->moduleHandle);
#else
      dlclose(chain->moduleHandle);
#endif
    }
    chain = chain->next;
  }
  chain = chain_->next;     // Don't free the block #0
  while(chain != NULL) {
    htscallbacks* nextchain = chain->next;
    freet(chain);
    chain = nextchain;
  }
  chain_->next = NULL;    // Empty
}
示例#3
0
文件: Turma1.c 项目: Jessycah/C
int main(){
	Aluno a1 = {10885 , "Alcino", 18.5};
	Aluno a2 = {77782, "Mariana", 9.5};
	Aluno a3 = {79175, "Vitor", 6.5};

	Turma t = NULL;

	insere(&t, a2);
	insere(&t, a1);
	insere(&t, a3);

	imprime(t);

	/*
	Teste das novas funções
	*/
	Aluno * aux;
	aux = procura(t, 77782);
	printf("%s\n", aux->nome);
	//Procura a Mariana e imprime o seu nome

	a2.nota = 10.5;

	printf("Nota da mariana antes do update: %f\n", aux->nota);
	update(t, a2);
	printf("Nota da mariana depois do update: %f\n", aux->nota);

	printf("Nº de aprovados: %d\n", aprovados(t));
	freet(t);


	return 0;
}
示例#4
0
void checkrobots_free(robots_wizard* robots) {
  if (robots->next) {
    checkrobots_free(robots->next);
    freet(robots->next);
    robots->next=NULL;
  }
}
示例#5
0
int inthash_write_value(inthash hashtable, const char *name,
                        inthash_value value) {
  int pos = (inthash_key(name) % hashtable->hash_size);
  inthash_chain *h = hashtable->hash[pos];

  while(h) {
    if (strcmp(h->name, name) == 0) {
      /* Delete element */
      if (hashtable->flag_valueismalloc) {
        void *ptr = h->value.ptr;

        if (ptr != NULL) {
          if (hashtable->free_handler)
            hashtable->free_handler(ptr);
          else
            freet(ptr);
        }
      }
      /* Insert */
      h->value = value;
      return 0;
    }
    h = h->next;
  }
  // Not found, add it!
  inthash_add_value(hashtable, name, value);
  return 1;
}
示例#6
0
static void inthash_delchain(inthash_chain * hash,
                             t_inthash_freehandler free_handler) {
  while(hash != NULL) {
    inthash_chain *next = hash->next;

    if (free_handler) {         // pos is a malloc() block, delete it!
      if (hash->value.ptr) {
        void *ptr = hash->value.ptr;

        if (free_handler)
          free_handler(ptr);
        else
          freet(ptr);
        hash->value.ptr = 0;
      }
    }
    freet(hash);
    hash = next;
  }
}
示例#7
0
// destruction chaine dans s position pos
void cookie_delete(char *s, int pos) {
  char *buff;

  if (strnotempty(s + pos) == 0) {      // rien à faire, effacer
    s[0] = '\0';
  } else {
    buff = (char *) malloct(strlen(s + pos) + 2);
    if (buff) {
      strcpybuff(buff, s + pos);        // copie temporaire
      strcpybuff(s, buff);      // copier
      freet(buff);
    }
  }
}
示例#8
0
int inthash_remove(inthash hashtable, const char *name) {
  int pos = (inthash_key(name) % hashtable->hash_size);
  inthash_chain **h = &hashtable->hash[pos];
  t_inthash_freehandler free_handler = NULL;

  if (hashtable->flag_valueismalloc) {
    if (hashtable->free_handler)
      free_handler = hashtable->free_handler;
    else
      free_handler = inthash_default_free_handler;
  }
  while(*h) {
    if (strcmp((*h)->name, name) == 0) {
      inthash_chain *next;

      if (free_handler) {
        if ((*h)->value.ptr) {
          void *ptr = (*h)->value.ptr;

          if (free_handler)
            free_handler(ptr);
          else
            freet(ptr);
          (*h)->value.ptr = 0;
        }
      }
      next = (*h)->next;
      freet(*h);
      *h = next;
      hashtable->nitems--;
      return 1;
    }
    h = &((*h)->next);
  }
  return 0;
}
示例#9
0
// insertion chaine ins avant s
void cookie_insert(char *s, char *ins) {
  char *buff;

  if (strnotempty(s) == 0) {    // rien à faire, juste concat
    strcatbuff(s, ins);
  } else {
    buff = (char *) malloct(strlen(s) + 2);
    if (buff) {
      strcpybuff(buff, s);      // copie temporaire
      strcpybuff(s, ins);       // insérer
      strcatbuff(s, buff);      // copier
      freet(buff);
    }
  }
}
示例#10
0
void* getFunctionPtr(void* handle, const char* fncname_) {
  if (handle) {
    void* userfunction = NULL;
    char *fncname = strdupt(fncname_);

    /* Strip optional comma */
    char *comma;
    if ((comma = strchr(fncname, ',')) != NULL) {   /* empty arg */
      *comma++ = '\0';
    }
    
    /* the function itself */
    userfunction = (void*) DynamicGet(handle, (char*)fncname);

    freet(fncname);

    return userfunction;
  }
  return NULL;
}
示例#11
0
void* openFunctionLib(const char* file_) {
  void* handle;
  char *file = malloct(strlen(file_) + 32);
  strcpy(file, file_);
#ifdef _WIN32
  handle = LoadLibraryA(file);
  if (handle == NULL) {
    sprintf(file, "%s.dll", file_);
    handle = LoadLibraryA(file);
  }
#else
  handle = dlopen(file, RTLD_LAZY);
  if (handle == NULL) {
    sprintf(file, "lib%s.so", file_);
    handle = dlopen(file, RTLD_LAZY);
  }
#endif
  freet(file);
  return handle;
}
示例#12
0
文件: matrix_mul.c 项目: skoneka/prir
void mnoz(double**A, int a, int b, double**B, int c, int d, double**C, int N)
{
	
	pthread_t *th = malloc(sizeof(pthread_t) * N);
    int i, j, k;
    double s;
    for(i=0; i<a; i++)
    {
        for(j=0; j<d; j++)
        {

		int t = freet(th, N);
		/*
	    int	s = 0;
            for(k=0; k<b; k++)
            {

                s+=A[i][k]*B[k][j];
            }*/
            //C[i][j] = s;
        }

    }
}
示例#13
0
HTSEXT_API int hts_buildtopindex(httrackp* opt,const char* path,const char* binpath) {
  FILE* fpo;
  int retval=0;
  char BIGSTK rpath[1024*2];
  char *toptemplate_header=NULL,*toptemplate_body=NULL,*toptemplate_footer=NULL,*toptemplate_bodycat=NULL;
 	char catbuff[CATBUFF_SIZE];

  // et templates html
  toptemplate_header=readfile_or(fconcat(catbuff, binpath,"templates/topindex-header.html"),HTS_INDEX_HEADER);
  toptemplate_body=readfile_or(fconcat(catbuff, binpath,"templates/topindex-body.html"),HTS_INDEX_BODY);
  toptemplate_bodycat=readfile_or(fconcat(catbuff, binpath,"templates/topindex-bodycat.html"),HTS_INDEX_BODYCAT);
  toptemplate_footer=readfile_or(fconcat(catbuff, binpath,"templates/topindex-footer.html"),HTS_INDEX_FOOTER);
  
  if (toptemplate_header && toptemplate_body && toptemplate_footer && toptemplate_bodycat) {
    
    strcpybuff(rpath,path);
    if (rpath[0]) {
      if (rpath[strlen(rpath)-1]=='/')
        rpath[strlen(rpath)-1]='\0';
    }
    
    fpo=fopen(fconcat(catbuff, rpath,"/index.html"),"wb");
    if (fpo) {
      find_handle h;
      verif_backblue(opt,concat(catbuff, rpath,"/"));    // générer gif
      // Header
      fprintf(fpo,toptemplate_header,
        "<!-- Mirror and index made by HTTrack Website Copier/"HTTRACK_VERSION" "HTTRACK_AFF_AUTHORS" -->"
        );
      
      /* Find valid project names */
      h = hts_findfirst(rpath);
      if (h) {
        struct topindex_chain * chain=NULL;
        struct topindex_chain * startchain=NULL;
        String iname = STRING_EMPTY;
        int chainSize = 0;
        do {
          if (hts_findisdir(h)) {
            StringCopy(iname,rpath);
            StringCat(iname,"/");
            StringCat(iname,hts_findgetname(h));
            StringCat(iname,"/index.html");
            if (fexist(StringBuff(iname))) {
              int level = 0;
              char* category = NULL;
              struct topindex_chain * oldchain=chain;
              
              /* Check for an existing category */
              StringCopy(iname,rpath);
              StringCat(iname,"/");
              StringCat(iname,hts_findgetname(h));
              StringCat(iname,"/hts-cache/winprofile.ini");
              if (fexist(StringBuff(iname))) {
                category = hts_getcategory(StringBuff(iname));
                if (category != NULL) {
                  if (*category == '\0') {
                    freet(category);
                    category = NULL;
                  }
                }
              }
              if (category == NULL) {
                category = strdupt("No categories");
                level = 1;
              }

              chain=calloc(sizeof(struct topindex_chain), 1);
              chainSize++;
              if (!startchain) {
                startchain=chain;
              }
              if (chain) {
                if (oldchain) {
                  oldchain->next=chain;
                }
                chain->next=NULL;
                strcpybuff(chain->name, hts_findgetname(h));
                chain->category = category;
                chain->level = level;
              }
            }
            
          }
        } while(hts_findnext(h));
        hts_findclose(h);
        StringFree(iname);
        
        /* Sort chain */
        {
          struct topindex_chain** sortedElts = (struct topindex_chain**) calloct(sizeof(topindex_chain*), chainSize);
          assertf(sortedElts != NULL);
          if (sortedElts != NULL) {
            int i;
            char* category = "";
            
            /* Build array */
            struct topindex_chain * chain = startchain;
            for(i = 0 ; i < chainSize ; i++) {
              assertf(chain != NULL);
              sortedElts[i] = chain;
              chain = chain->next;
            }
            qsort(sortedElts, chainSize, sizeof(topindex_chain*), sortTopIndexFnc);
            
            /* Build sorted index */
            for(i = 0 ; i < chainSize ; i++) {
              char BIGSTK hname[HTS_URLMAXSIZE*2];
              strcpybuff(hname,sortedElts[i]->name);
              escape_check_url(hname);

              /* Changed category */
              if (strcmp(category, sortedElts[i]->category) != 0) {
                category = sortedElts[i]->category;
                fprintf(fpo,toptemplate_bodycat, category);
              }
              fprintf(fpo,toptemplate_body,
                hname,
                sortedElts[i]->name
                );
            }
            
            /* Wipe elements */
            for(i = 0 ; i < chainSize ; i++) {
              freet(sortedElts[i]->category);
              freet(sortedElts[i]);
              sortedElts[i] = NULL;
            }
            freet(sortedElts);
            
            /* Return value */
            retval=1;
          }
        }
        
      }
      
      // Footer
      fprintf(fpo,toptemplate_footer,
        "<!-- Mirror and index made by HTTrack Website Copier/"HTTRACK_VERSION" "HTTRACK_AFF_AUTHORS" -->"
        );
      
      fclose(fpo);
      
    }
    
  }

  if (toptemplate_header)
    freet(toptemplate_header);
  if (toptemplate_body)
    freet(toptemplate_body);
  if (toptemplate_footer)
    freet(toptemplate_footer);
  if (toptemplate_body)
    freet(toptemplate_body);
  
  return retval;
}
示例#14
0
static void inthash_default_free_handler(void *value) {
  if (value)
    freet(value);
}
示例#15
0
文件: htshelp.c 项目: ahua/c
void help_wizard(httrackp* opt) {
  char* urls = (char*) malloct(HTS_URLMAXSIZE*2);
  char* mainpath = (char*) malloct(256);
  char* projname = (char*) malloct(256);
  char* stropt = (char*) malloct(2048);     // options
  char* stropt2 = (char*) malloct(2048);    // options longues
  char* strwild = (char*) malloct(2048);    // wildcards
  char* cmd = (char*) malloct(4096);
  char* str = (char*) malloct(256);
  char** argv = (char**) malloct(256 * sizeof(char*));
  //
  char* a;
  //
  if (urls == NULL || mainpath == NULL || projname == NULL || stropt == NULL 
    || stropt2 == NULL || strwild == NULL || cmd == NULL || str == NULL || argv == NULL) {
    fprintf(stderr, "* memory exhausted in %s, line %d\n", __FILE__, __LINE__);
    return;
  }
  urls[0] = mainpath[0] = projname[0] = stropt[0] = stropt2[0] = strwild[0] = cmd[0] = str[0] = '\0';
  //
  strcpybuff(stropt,"-");
  mainpath[0]=projname[0]=stropt2[0]=strwild[0]='\0';
  //
  
  printf("\n");
  printf("Welcome to HTTrack Website Copier (Offline Browser) "HTTRACK_VERSION"%s\n", hts_get_version_info(opt));
  printf("Copyright (C) Xavier Roche and other contributors\n");
#ifdef _WIN32
  printf("Note: You are running the commandline version,\n");
  printf("run 'WinHTTrack.exe' to get the GUI version.\n");
#endif
#ifdef HTTRACK_AFF_WARNING
  printf("NOTE: "HTTRACK_AFF_WARNING"\n");
#endif
#ifdef HTS_PLATFORM_NAME
#if USE_BEGINTHREAD
  printf("[compiled: "HTS_PLATFORM_NAME" - MT]\n");
#else
  printf("[compiled: "HTS_PLATFORM_NAME"]\n");
#endif
#endif
  printf("To see the option list, enter a blank line or try httrack --help\n");
  //
  // Project name
  while(strnotempty(projname)==0) {
    printf("\n");
    printf("Enter project name :");
    fflush(stdout);
    linput(stdin,projname,250);
    if (strnotempty(projname)==0)
      help("httrack",1);
  }
  //
  // Path
  if (strnotempty(hts_gethome()))
    printf("\nBase path (return=%s/websites/) :",hts_gethome());
  else
    printf("\nBase path (return=current directory) :");
  linput(stdin,str,250);
  if (!strnotempty(str)) {
    strcatbuff(str,hts_gethome());
    strcatbuff(str,"/websites/");
  }
  if (strnotempty(str))
  if ((str[strlen(str)-1]!='/') && (str[strlen(str)-1]!='\\'))
    strcatbuff(str,"/");
  strcatbuff(stropt2,"-O \""); strcatbuff(stropt2,str); strcatbuff(stropt2,projname); strcatbuff(stropt2,"\" ");
  // Créer si ce n'est fait un index.html 1er niveau
  make_empty_index(str);
  //
  printf("\n");
  printf("Enter URLs (separated by commas or blank spaces) :");
  fflush(stdout);
  linput(stdin,urls,250);
  if (strnotempty(urls)) {
    while( (a=strchr(urls,',')) )  *a=' ';
    while( (a=strchr(urls,'\t')) ) *a=' ';
    
    // Action
    printf("\nAction:\n");
    switch(help_query("Mirror Web Site(s)|Mirror Web Site(s) with Wizard|Just Get Files Indicated|Mirror ALL links in URLs (Multiple Mirror)|Test Links In URLs (Bookmark Test)|Update/Continue a Mirror",1)) {
    case 1: break; 
    case 2: strcatbuff(stropt,"W"); break;
    case 3: strcatbuff(stropt2,"--get "); break;
    case 4: strcatbuff(stropt2,"--mirrorlinks "); break;
    case 5: strcatbuff(stropt2,"--testlinks "); break;
    case 6: strcatbuff(stropt2,"--update "); break;
    case 0: return; break;
    }
      
    // Proxy
    printf("\nProxy (return=none) :");
    linput(stdin,str,250);
    if (strnotempty(str)) {
      while( (a=strchr(str,' ')) ) *a=':';    // port
      if (!strchr(jump_identification(str),':')) {
        char str2[256];
        printf("\nProxy port (return=8080) :");
        linput(stdin,str2,250);
        strcatbuff(str,":");
        if (strnotempty(str2)==0)
          strcatbuff(str,"8080");
        else
          strcatbuff(str,str2);
      }
      strcatbuff(stropt2,"-P "); strcatbuff(stropt2,str); strcatbuff(stropt2," ");
    }
    
    // Display
    strcatbuff(stropt2," -%v ");

    // Wildcards
    printf("\nYou can define wildcards, like: -*.gif +www.*.com/*.zip -*img_*.zip\n");
    printf("Wildcards (return=none) :");
    linput(stdin,strwild,250);
    
    // Options
    do {
      printf("\nYou can define additional options, such as recurse level (-r<number>), separed by blank spaces\n");
      printf("To see the option list, type help\n");
      printf("Additional options (return=none) :");
      linput(stdin,str,250);
      if (strfield2(str,"help")) {
        help("httrack",2);
      } else if (strnotempty(str)) {
        strcatbuff(stropt2,str);
        strcatbuff(stropt2," ");
      }
    } while(strfield2(str,"help"));
    
    {
      int argc=1;
      int g=0;
      int i=0;
      //
      printf("\n");
      if (strlen(stropt)==1)
        stropt[0]='\0';    // aucune
      sprintf(cmd,"%s %s %s %s",urls,stropt,stropt2,strwild);
      printf("---> Wizard command line: httrack %s\n\n",cmd);
      printf("Ready to launch the mirror? (Y/n) :");
      fflush(stdout);
      linput(stdin,str,250);
      if (strnotempty(str)) {
        if (!((str[0]=='y') || (str[0]=='Y')))
          return ;
      }
      printf("\n");

      // couper en morceaux
      argv[0]="winhttrack";
      argv[1]=cmd;
      argc++;    
      while(cmd[i])  {
        if(cmd[i]=='\"') g=!g;
        if(cmd[i]==' '){
          if(!g){
            cmd[i]='\0';
            argv[argc++]=cmd+i+1;
          }
        }  
        i++;
      }
      hts_main(argc,argv);
    }
  //} else {
  //  help("httrack",1);
  }

  /* Free buffers */
  freet(urls);
  freet(mainpath);
  freet(projname);
  freet(stropt);
  freet(stropt2);
  freet(strwild);
  freet(cmd);
  freet(str);
}
示例#16
0
文件: htsweb.c 项目: eatonmi/Crawler
static void back_launch_cmd( void* pP ) {
  char* cmd = (char*) pP;
  char** argv = (char**) malloct(1024 * sizeof(char*));
  int argc = 0;
  int i = 0;
  int g = 0;
	//
  httrackp *opt;

  /* copy commandline */
  if (commandReturnCmdl)
    free(commandReturnCmdl);
  commandReturnCmdl = strdup(cmd);

  /* split */
  argv[0]="webhttrack";
  argv[1]=cmd;
  argc++;    
  i = 0;
  while(cmd[i]) {
    if (cmd[i] == '\t' || cmd[i] == '\r' || cmd[i] == '\n') {
      cmd[i] = ' ';
    }
    i++;
  }
  i = 0;
  while(cmd[i])  {
    if(cmd[i]=='\"') g=!g;
    if(cmd[i]==' ') {
      if(!g){
        cmd[i]='\0';
        argv[argc++]=cmd+i+1;
      }
    }  
    i++;
  }

	/* init */
	hts_init();
  global_opt = opt = hts_create_opt();

  /* run */
  commandReturn = webhttrack_runmain(opt, argc, argv);
  if (commandReturn) {
    if (commandReturnMsg)
      free(commandReturnMsg);
    commandReturnMsg = strdup(hts_errmsg(opt));
  }

	/* free */
	global_opt = NULL;
	hts_free_opt(opt);
  hts_uninit();

  /* okay */
  commandRunning = 0;

  /* finished */
  commandEnd = 1;

  /* free */
  free(cmd);
  freet(argv);
  return ;
}
示例#17
0
/*
  Sort index!
*/
void index_finish(const char* indexpath,int mode) {
#if HTS_MAKE_KEYWORD_INDEX
	char catbuff[CATBUFF_SIZE];
  char** tab;
  char* blk;
  off_t size = fpsize(fp_tmpproject);
  if (size>0) {
    //FILE* fp=fopen(concat(indexpath,"index.txt"),"rb");
    if (fp_tmpproject) {
      tab=(char**)malloct(sizeof(char*) * (hts_primindex_size+2) );
      if (tab) {
        blk = malloct(size+4);
        if (blk) {
          fseek(fp_tmpproject,0,SEEK_SET);
          if ((INTsys)fread(blk,1,size,fp_tmpproject) == size) {
            char *a=blk,*b;
            int index=0;
            int i;
            FILE* fp;

            while( (b=strchr(a,'\n')) && (index < hts_primindex_size) ) {
              tab[index++]=a;
              *b='\0';
              a=b+1;
            }
            
            // Sort it!
            qsort(tab,index,sizeof(char*),mystrcmp);

            // Delete fp_tmpproject
            fclose(fp_tmpproject);
            fp_tmpproject=NULL;

            // Write new file
            if (mode == 1)      // TEXT
              fp=fopen(concat(catbuff,indexpath,"index.txt"),"wb");
            else                // HTML
              fp=fopen(concat(catbuff,indexpath,"sindex.html"),"wb");
            if (fp) {
              char current_word[KEYW_LEN + 32];
              char word[KEYW_LEN + 32];
              int hit;
              int total_hit=0;
              int total_line=0;
              int last_pos=0;
              char word0='\0';
              current_word[0]='\0';

              if (mode == 2) {         // HTML
                for(i=0;i<index;i++) {
                  if (word0 != tab[i][0]) {
                    word0 = tab[i][0];
                    fprintf(fp," <a href=\"#%c\">%c</a>\r\n",word0,word0);
                  }
                }
                word0='\0';
                fprintf(fp,"<br><br>\r\n");
                fprintf(fp,"<table width=\"100%%\" border=\"0\">\r\n<tr>\r\n<td>word</td>\r\n<td>location\r\n");
              }

              for(i=0;i<index;i++) {
                if (sscanf(tab[i],"%s %d",word,&hit) == 2) {
                  char*  a=strchr(tab[i],' ');
                  if (a) a=strchr(a+1,' ');
                  if (a++) {                            /* Yes, a++, not ++a :) */
                    hit=KEYW_SORT_MAXCOUNT-hit;
                    if (strcmp(word,current_word)) {    /* New word */
                      if (total_hit) {
                        if (mode == 1)      // TEXT
                          fprintf(fp,"\t=%d\r\n",total_hit);
                        //else                // HTML
                        //  fprintf(fp,"<br>(%d total hits)\r\n",total_hit);
                        if ( 
                              ( ((total_hit*1000 ) / hts_primindex_words) >= KEYW_USELESS1K   )
                            ||
                              ( ((total_line*1000) / index              ) >= KEYW_USELESS1KPG )
                          ) {
                          fseek(fp,last_pos,SEEK_SET);
                          if (mode == 1)      // TEXT
                            fprintf(fp,"\tignored (%d)\r\n",((total_hit*1000)/hts_primindex_words));
                          else
                            fprintf(fp,"(ignored) [%d hits]<br>\r\n",total_hit);
                        }
                        else {
                          if (mode == 1)      // TEXT
                            fprintf(fp,"\t(%d)\r\n",((total_hit*1000)/hts_primindex_words));
                          //else                // HTML
                          //  fprintf(fp,"(%d)\r\n",((total_hit*1000)/hts_primindex_words));
                        }
                      }
                      if (mode == 1)      // TEXT
                        fprintf(fp,"%s\r\n",word);
                      else {              // HTML
                        fprintf(fp,"</td></tr>\r\n");
                        if (word0 != word[0]) {
                          word0 = word[0];
                          fprintf(fp,"<th>%c</th>\r\n",word0);
                          fprintf(fp,"<a name=\"%c\"></a>\r\n",word0);
                        }
                        fprintf(fp,"<tr>\r\n<td>%s</td>\r\n<td>\r\n",word);
                      }
                      fflush(fp); last_pos=ftell(fp);
                      strcpybuff(current_word,word);
                      total_hit=total_line=0;
                    }
                    total_hit+=hit;
                    total_line++;
                    if (mode == 1)      // TEXT
                      fprintf(fp,"\t%d %s\r\n",hit,a);
                    else                // HTML
                      fprintf(fp,"<a href=\"%s\">%s</a> [%d hits]<br>\r\n",a,a,hit);
                  }
                }
              }
              if (mode == 2)         // HTML
                fprintf(fp,"</td></tr>\r\n</table>\r\n");
              fclose(fp);
            }
            
          }
          freet(blk);
        }
        freet(tab);
      }

    }
    //qsort
  }
  if (fp_tmpproject)
    fclose(fp_tmpproject);
  fp_tmpproject=NULL;
#endif
}
示例#18
0
文件: Turma1.c 项目: Jessycah/C
/**
* Função que liberta a memória, de baixo para cima.
*/
void freet(Turma t){
	if(t==NULL) return;
	freet(t->esq);
	freet(t->dir);
	free(t);
}