]>
git.ipfire.org Git - thirdparty/sarg.git/blob - indexonly.c
2 * SARG Squid Analysis Report Generator http://sarg.sourceforge.net
6 * please look at http://sarg.sourceforge.net/donations.php
8 * http://sourceforge.net/projects/sarg/forums/forum/363374
9 * ---------------------------------------------------------------------
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
27 #include "include/conf.h"
28 #include "include/defs.h"
31 void index_only(const char *dirname
,int debug
)
34 struct dirent
*direntp
;
37 if ((dirp
= opendir(dirname
)) == NULL
) {
38 debuga(_("Failed to open directory %s - %s\n"),dirname
,strerror(errno
));
41 while ( (direntp
= readdir( dirp
)) != NULL
){
42 if(strcmp(direntp
->d_name
,".") == 0 || strcmp(direntp
->d_name
,"..") == 0 || strcmp(direntp
->d_name
, "index.html") == 0)
45 if (snprintf(remove
,sizeof(remove
),"%s/%s",dirname
,direntp
->d_name
)>=sizeof(remove
)) {
46 debuga(_("Name of the file to remove is too long: %s/%s\n"),dirname
,direntp
->d_name
);
49 if (unlink(remove
) == -1) {
50 debuga(_("Cannot delete \"%s\": %s\n"),remove
,strerror(errno
));
54 (void)closedir( dirp
);