home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / sarg1221.zip / indexonly.c < prev    next >
C/C++ Source or Header  |  2002-06-13  |  591b  |  30 lines

  1. /*
  2.  * sarg - Squid user management log
  3.  * Mar/98 - Pedro L Orso - orso@onda.com.br
  4.  */
  5.  
  6. #include "include/conf.h"
  7.  
  8.  
  9. void index_only(const char *dirname, int debug)
  10. {
  11.  
  12.    DIR *dirp;
  13.    struct dirent *direntp;
  14.    char remove[MAXLEN];
  15.   
  16.  
  17.    dirp = opendir(dirname);
  18.    while ( (direntp = readdir( dirp )) != NULL ){
  19.       if(strcmp(direntp->d_name,".") == 0 || strcmp(direntp->d_name,"..") == 0 || strcmp(direntp->d_name, "index.html") == 0)
  20.          continue;
  21.        
  22.       sprintf(remove,"%s/%s",dirname,direntp->d_name);
  23.       unlink(remove);
  24.    }
  25.  
  26.    (void)closedir( dirp );
  27.  
  28.    return;
  29. }
  30.