]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Merge the tiny charset name convertor function
authorFrederic Marchal <fmarchal@users.sourceforge.net>
Wed, 8 Oct 2014 18:52:12 +0000 (20:52 +0200)
committerFrederic Marchal <fmarchal@users.sourceforge.net>
Wed, 8 Oct 2014 18:52:12 +0000 (20:52 +0200)
There is no need to have a distinct source file for that tiny global
function when it can be stored in getconf.c and be static.

CMakeLists.txt
Makefile.in
charset.c [deleted file]
getconf.c
include/defs.h

index a5a115161ccf161f1fe7411bae239db6bc2594c6..4012d6b1e02a73c546adb7b25a0dccd09665b2b8 100755 (executable)
@@ -49,7 +49,7 @@ SET(SRC util.c log.c report.c topuser.c email.c sort.c html.c
        index.c getconf.c usage.c decomp.c ip2name.c ip2name_dns.c
        useragent.c exclude.c convlog.c totday.c repday.c datafile.c
        indexonly.c splitlog.c lastlog.c topsites.c siteuser.c css.c
-       smartfilter.c denied.c authfail.c charset.c dichotomic.c
+       smartfilter.c denied.c authfail.c dichotomic.c
        redirector.c auth.c download.c grepday.c ip2name_exec.c
        dansguardian_log.c dansguardian_report.c realtime.c btree_cache.c
        usertab.c userinfo.c longline.c url.c fnmatch.c stringbuffer.c
index 2eb6b5be707c683adaf285ed17b2af709c1b972f..bbc6b3734098490cc00720b7645ac4ced27153e7 100644 (file)
@@ -38,7 +38,7 @@ SRCS = util.c log.c report.c topuser.c email.c sort.c html.c \
    index.c getconf.c usage.c decomp.c ip2name.c ip2name_dns.c \
    useragent.c exclude.c convlog.c totday.c repday.c datafile.c\
    indexonly.c splitlog.c lastlog.c topsites.c siteuser.c css.c \
-   smartfilter.c denied.c authfail.c charset.c dichotomic.c \
+   smartfilter.c denied.c authfail.c dichotomic.c \
    redirector.c auth.c download.c grepday.c ip2name_exec.c \
    dansguardian_log.c dansguardian_report.c realtime.c btree_cache.c \
    usertab.c userinfo.c longline.c url.c fnmatch.c stringbuffer.c \
diff --git a/charset.c b/charset.c
deleted file mode 100644 (file)
index 8366dfa..0000000
--- a/charset.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * SARG Squid Analysis Report Generator      http://sarg.sourceforge.net
- *                                                            1998, 2013
- *
- * SARG donations:
- *      please look at http://sarg.sourceforge.net/donations.php
- * Support:
- *     http://sourceforge.net/projects/sarg/forums/forum/363374
- * ---------------------------------------------------------------------
- *
- *  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, USA.
- *
- */
-
-#include "include/conf.h"
-#include "include/defs.h"
-
-void ccharset(char *CharSet)
-{
-       if(strcmp(CharSet,"Latin2") == 0) strcpy(CharSet,"ISO-8859-2");
-       else if(strcmp(CharSet,"Latin3") == 0) strcpy(CharSet,"ISO-8859-3");
-       else if(strcmp(CharSet,"Latin4") == 0) strcpy(CharSet,"ISO-8859-4");
-       else if(strcmp(CharSet,"Cyrillic") == 0) strcpy(CharSet,"ISO-8859-5");
-       else if(strcmp(CharSet,"Arabic") == 0) strcpy(CharSet,"ISO-8859-6");
-       else if(strcmp(CharSet,"Greek") == 0) strcpy(CharSet,"ISO-8859-7");
-       else if(strcmp(CharSet,"Hebrew") == 0) strcpy(CharSet,"ISO-8859-8");
-       else if(strcmp(CharSet,"Latin5") == 0) strcpy(CharSet,"ISO-8859-9");
-       else if(strcmp(CharSet,"Latin6") == 0) strcpy(CharSet,"ISO-8859-10");
-       else if(strcmp(CharSet,"Windows-1251") == 0) strcpy(CharSet,"Windows-1251");
-       else if(strcmp(CharSet,"Japan") == 0) strcpy(CharSet,"EUC-JP");
-       else if(strcmp(CharSet,"Koi8-r") == 0) strcpy(CharSet,"KOI8-R");
-       else if(strcmp(CharSet,"UTF-8") == 0) strcpy(CharSet,"UTF-8");
-       return;
-}
index c231f6399a150a4c56df270b0e8f5dce5931d097..8f35ae5a79aa03f35c72f9de064155bb7ba97080 100644 (file)
--- a/getconf.c
+++ b/getconf.c
@@ -554,6 +554,25 @@ static int getparam_userlimit(const char *param,char *buf)
        return(1);
 }
 
+static void ccharset(char *CharSet)
+{
+       if (strcmp(CharSet,"Latin2") == 0) strcpy(CharSet,"ISO-8859-2");
+       else if (strcmp(CharSet,"Latin3") == 0) strcpy(CharSet,"ISO-8859-3");
+       else if (strcmp(CharSet,"Latin4") == 0) strcpy(CharSet,"ISO-8859-4");
+       else if (strcmp(CharSet,"Cyrillic") == 0) strcpy(CharSet,"ISO-8859-5");
+       else if (strcmp(CharSet,"Arabic") == 0) strcpy(CharSet,"ISO-8859-6");
+       else if (strcmp(CharSet,"Greek") == 0) strcpy(CharSet,"ISO-8859-7");
+       else if (strcmp(CharSet,"Hebrew") == 0) strcpy(CharSet,"ISO-8859-8");
+       else if (strcmp(CharSet,"Latin5") == 0) strcpy(CharSet,"ISO-8859-9");
+       else if (strcmp(CharSet,"Latin6") == 0) strcpy(CharSet,"ISO-8859-10");
+       else if (strcmp(CharSet,"Japan") == 0) strcpy(CharSet,"EUC-JP");
+       else if (strcmp(CharSet,"Koi8-r") == 0) strcpy(CharSet,"KOI8-R");
+       /*
+        * Any other encoding name is left unchanged.
+        */
+       return;
+}
+
 static void parmtest(char *buf)
 {
        char wbuf[2048];
index 4fd91d7d81578b12c5982c7d8a291ab5b749b436..aa4b4dd37e0fdfa40442cadf68f794dc3e0449e2 100755 (executable)
@@ -160,9 +160,6 @@ bool is_authfail(void);
 void authfail_report(void);
 void authfail_cleanup(void);
 
-// charset.c
-void ccharset(char *CharSet);
-
 // convlog.c
 void convlog(const char* arq, char df, int dfrom, int duntil);