]> git.ipfire.org Git - thirdparty/sarg.git/blame - indexonly.c
Use the function name in a message to reduce the number of messages.
[thirdparty/sarg.git] / indexonly.c
CommitLineData
25697a35 1/*
94ff9470 2 * SARG Squid Analysis Report Generator http://sarg.sourceforge.net
67302a9e 3 * 1998, 2013
25697a35
GS
4 *
5 * SARG donations:
6 * please look at http://sarg.sourceforge.net/donations.php
1164c474
FM
7 * Support:
8 * http://sourceforge.net/projects/sarg/forums/forum/363374
25697a35
GS
9 * ---------------------------------------------------------------------
10 *
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.
15 *
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.
20 *
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.
24 *
25 */
26
27#include "include/conf.h"
5f3cfd1d 28#include "include/defs.h"
25697a35
GS
29
30
32e71fa4 31void index_only(const char *dirname,int debug)
25697a35 32{
9bd92830
FM
33 DIR *dirp;
34 struct dirent *direntp;
35 char remove[MAXLEN];
e21b6c02 36
9bd92830
FM
37 if ((dirp = opendir(dirname)) == NULL) {
38 debuga(_("Failed to open directory %s - %s\n"),dirname,strerror(errno));
39 exit(EXIT_FAILURE);
40 }
41 while ( (direntp = readdir( dirp )) != NULL ){
56b97279 42 if(strcmp(direntp->d_name,".") == 0 || strcmp(direntp->d_name,"..") == 0 || strcmp(direntp->d_name, INDEX_HTML_FILE) == 0)
9bd92830 43 continue;
e21b6c02 44
9bd92830
FM
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);
47 continue;
48 }
49 if (unlink(remove) == -1) {
7c4264ec 50 debuga(_("Cannot delete \"%s\": %s\n"),remove,strerror(errno));
9bd92830
FM
51 }
52 }
25697a35 53
9bd92830 54 (void)closedir( dirp );
25697a35 55
9bd92830 56 return;
25697a35 57}