]> git.ipfire.org Git - thirdparty/sarg.git/blobdiff - getconf.c
Rename configure.in as configure.ac
[thirdparty/sarg.git] / getconf.c
index f2fb8cc5c30d484fd1e63ecf97a3156934ad8d01..8454e5d549b82e6dd4ec50d4de02ee6bffda3579 100644 (file)
--- a/getconf.c
+++ b/getconf.c
@@ -1,10 +1,11 @@
 /*
- * AUTHOR: Pedro Lineu Orso                         pedro.orso@gmail.com
- *                                                            1998, 2008
  * SARG Squid Analysis Report Generator      http://sarg.sourceforge.net
+ *                                                            1998, 2015
  *
  * 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
 
 #include "include/conf.h"
 #include "include/defs.h"
+#include "include/filelist.h"
+
+#define SET_LIST(list) list,sizeof(list)/sizeof(list[0])
 
 extern numlist hours, weekdays;
+extern FileListObject AccessLog;
+extern int PerUserLimitsNumber;
+extern struct PerUserLimitStruct PerUserLimits[MAX_USER_LIMITS];
+extern enum PerUserFileCreationEnum PerUserFileCreation;
+extern char ImageDir[MAXLEN];
+
+struct param_list
+{
+       //! The name of the value of the parameter.
+       const char *name;
+       //! The bit to set if the value is found.
+       unsigned long int value;
+       //! The value is invalid if any bit of this mask is set in the parameter.
+       unsigned long int exclude;
+};
+
+struct sort_list
+{
+       //! The name of the value of the parameter.
+       const char *name;
+       //! The bit to set if the value is found.
+       unsigned long int value;
+};
+
+struct select_list
+{
+       //! The name of the value of the parameter.
+       const char *name;
+       //! The value to assign when the name is selected.
+       int value;
+};
+
+static struct param_list report_type_values[]=
+{
+       {"users_sites",REPORT_TYPE_USERS_SITES,0},
+       {"topusers",REPORT_TYPE_TOPUSERS,0},
+       {"topsites",REPORT_TYPE_TOPSITES,0},
+       {"sites_users",REPORT_TYPE_SITES_USERS,0},
+       {"date_time",REPORT_TYPE_DATE_TIME,0},
+       {"denied",REPORT_TYPE_DENIED,0},
+       {"auth_failures",REPORT_TYPE_AUTH_FAILURES,0},
+       {"site_user_time_date",REPORT_TYPE_SITE_USER_TIME_DATE,0},
+       {"downloads",REPORT_TYPE_DOWNLOADS,0},
+};
+
+static struct param_list data_field_values[]=
+{
+       {"user",DATA_FIELD_USER,0},
+       {"date",DATA_FIELD_DATE,0},
+       {"time",DATA_FIELD_TIME,0},
+       {"url",DATA_FIELD_URL,0},
+       {"connect",DATA_FIELD_CONNECT,0},
+       {"bytes",DATA_FIELD_BYTES,0},
+       {"in_cache",DATA_FIELD_IN_CACHE,0},
+       {"out_cache",DATA_FIELD_OUT_CACHE,0},
+       {"elapsed",DATA_FIELD_ELAPSED,0},
+};
+
+static struct param_list topuserfields_values[]=
+{
+       {"NUM",TOPUSERFIELDS_NUM,0},
+       {"DATE_TIME",TOPUSERFIELDS_DATE_TIME,0},
+       {"USERID",TOPUSERFIELDS_USERID,0},
+       {"USERIP",TOPUSERFIELDS_USERIP,0},
+       {"CONNECT",TOPUSERFIELDS_CONNECT,0},
+       {"BYTES",TOPUSERFIELDS_BYTES,0},
+       {"%BYTES",TOPUSERFIELDS_SETYB,0},
+       {"SETYB",TOPUSERFIELDS_SETYB,0},
+       {"IN-CACHE-OUT",TOPUSERFIELDS_IN_CACHE_OUT,0},
+       {"USED_TIME",TOPUSERFIELDS_USED_TIME,0},
+       {"MILISEC",TOPUSERFIELDS_MILISEC,0},
+       {"%TIME",TOPUSERFIELDS_PTIME,0},
+       {"TOTAL",TOPUSERFIELDS_TOTAL,0},
+       {"AVERAGE",TOPUSERFIELDS_AVERAGE,0},
+};
+
+static struct param_list userreportfields_values[]=
+{
+       {"CONNECT",USERREPORTFIELDS_CONNECT,0},
+       {"BYTES",USERREPORTFIELDS_BYTES,0},
+       {"%BYTES",USERREPORTFIELDS_SETYB,0},
+       {"SETYB",USERREPORTFIELDS_SETYB,0},
+       {"IN-CACHE-OUT",USERREPORTFIELDS_IN_CACHE_OUT,0},
+       {"USED_TIME",USERREPORTFIELDS_USED_TIME,0},
+       {"MILISEC",USERREPORTFIELDS_MILISEC,0},
+       {"%TIME",USERREPORTFIELDS_PTIME,0},
+       {"TOTAL",USERREPORTFIELDS_TOTAL,0},
+       {"AVERAGE",USERREPORTFIELDS_AVERAGE,0},
+};
+
+static struct param_list index_values[]=
+{
+       {"yes",INDEX_YES,~INDEX_YES},
+       {"no",INDEX_NO,~INDEX_NO},
+       {"only",INDEX_ONLY,~INDEX_ONLY},
+};
+
+static struct param_list index_tree_values[]=
+{
+       {"date",INDEX_TREE_DATE,~INDEX_TREE_DATE},
+       {"file",INDEX_TREE_FILE,~INDEX_TREE_FILE},
+};
+
+static struct param_list indexfields_values[]=
+{
+       {"DIRSIZE",INDEXFIELDS_DIRSIZE,0},
+};
 
-char wbuf[MAXLEN];
-char Msg[255];
+static struct param_list ntml_userformat_values[]=
+{
+       {"user",NTLMUSERFORMAT_USER,~NTLMUSERFORMAT_USER},
+       {"domainname+username",NTLMUSERFORMAT_DOMAINUSER,~NTLMUSERFORMAT_DOMAINUSER},
+};
 
-void parmtest(char *buf)
+static struct param_list recnouser_values[]=
 {
+       {"ip",RECORDWITHOUTUSER_IP,~RECORDWITHOUTUSER_IP},
+       {"ignore",RECORDWITHOUTUSER_IGNORE,~RECORDWITHOUTUSER_IGNORE},
+       {"everybody",RECORDWITHOUTUSER_EVERYBODY,~RECORDWITHOUTUSER_EVERYBODY},
+};
 
-      if(strstr(buf,"background_color") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in background_color parameter.\n");
-            exit(1);
-         }
-         strcpy(BgColor,buf);
-         fixnone(BgColor);
-         return;
-      }
-
-      if(strstr(buf,"text_color") != 0) {
-         if(strstr(buf,"logo_text_color") == 0) {
-            if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-               printf("SARG: Maybe you have a broken record or garbage in text_color parameter.\n");
-               exit(1);
-            }
-            strcpy(TxColor,buf);
-            fixnone(TxColor);
-            return;
-         }
-      }
-
-      if(strstr(buf,"text_bgcolor") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in text_bgcolor parameter.\n");
-            exit(1);
-         }
-         strcpy(TxBgColor,buf);
-         fixnone(TxBgColor);
-         return;
-      }
-
-      if(strstr(buf,"title_color") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in title_color parameter.\n");
-            exit(1);
-         }
-         strcpy(TiColor,buf);
-         fixnone(TiColor);
-         return;
-      }
-
-      if(strstr(buf,"logo_image") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in logo_image parameter.\n");
-            exit(1);
-         }
-         strcpy(LogoImage,buf);
-         fixnone(LogoImage);
-         return;
-      }
-
-      if(strstr(buf,"logo_text") != 0) {
-         if(strstr(buf,"logo_text_color") == 0) {
-            if (getword(wbuf,sizeof(wbuf),buf,'"')<0) {
-               printf("SARG: Maybe you have a broken record or garbage in logo_text parameter.\n");
-               exit(1);
-            }
-            if (getword(LogoText,sizeof(LogoText),buf,'"')<0) {
-               printf("SARG: Maybe you have a broken record or garbage in logo_text parameter.\n");
-               exit(1);
-            }
-            fixnone(LogoText);
-            return;
-         }
-      }
-
-      if(strstr(buf,"logo_text_color") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in logo_text_color parameter.\n");
-            exit(1);
-         }
-         strcpy(LogoTextColor,buf);
-         fixnone(LogoTextColor);
-         return;
-      }
-
-      if(strstr(buf,"background_image") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in background_image parameter.\n");
-            exit(1);
-         }
-         strcpy(BgImage,buf);
-         fixnone(BgImage);
-         return;
-      }
-
-      if(strstr(buf,"show_sarg_info") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in show_sarg_info parameter.\n");
-            exit(1);
-         }
-         strcpy(ShowSargInfo,buf);
-         fixnone(ShowSargInfo);
-         return;
-      }
-
-      if(strstr(buf,"show_sarg_logo") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in show_sarg_logo parameter.\n");
-            exit(1);
-         }
-         strcpy(ShowSargLogo,buf);
-         fixnone(ShowSargLogo);
-         return;
-      }
-
-      if(strstr(buf,"font_face") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in font_face parameter.\n");
-            exit(1);
-         }
-         strcpy(FontFace,buf);
-         fixnone(FontFace);
-         return;
-      }
-
-      if(strstr(buf,"header_color") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in header_color parameter.\n");
-            exit(1);
-         }
-         strcpy(HeaderColor,buf);
-         fixnone(HeaderColor);
-         return;
-      }
-
-      if(strstr(buf,"header_bgcolor") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in header_bgcolor parameter.\n");
-            exit(1);
-         }
-         strcpy(HeaderBgColor,buf);
-         fixnone(HeaderBgColor);
-         return;
-      }
-
-      if(strstr(buf,"font_size") != 0) {
-         if(strstr(buf,"header_font_size") == 0 && strstr(buf,"title_font_size") == 0) {
-            if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-               printf("SARG: Maybe you have a broken record or garbage in font_size parameter.\n");
-               exit(1);
-            }
-            strcpy(FontSize,buf);
-            fixnone(FontSize);
-            return;
-         }
-      }
-
-      if(strstr(buf,"header_font_size") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in header_font_size parameter.\n");
-            exit(1);
-         }
-         strncpy(HeaderFontSize,buf,sizeof(HeaderFontSize)-1);
-         HeaderFontSize[sizeof(HeaderFontSize)-1]=0;
-         fixnone(HeaderFontSize);
-         return;
-      }
-
-      if(strstr(buf,"title_font_size") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in title_font_size parameter.\n");
-            exit(1);
-         }
-         strcpy(TitleFontSize,buf);
-         fixnone(TitleFontSize);
-         return;
-      }
-
-      if(strstr(buf,"image_size") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0 || getword_multisep(Width,sizeof(Width),buf,' ')<0 || getword_multisep(Height,sizeof(Height),Height,0)<0) {
-            printf("SARG: Maybe you have a broken record or garbage in image_size parameter.\n");
-            exit(1);
-         }
-         fixnone(Width);
-         fixnone(Height);
-         return;
-      }
-
-      if(strstr(buf,"title") != 0) {
-         if (getword(wbuf,sizeof(wbuf),buf,'"')<0 || getword(Title,sizeof(Title),buf,'"')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in title parameter.\n");
-            exit(1);
-         }
-         fixnone(Title);
-         return;
-      }
-
-      if(strstr(buf,"resolve_ip") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in resolve_ip parameter.\n");
-            exit(1);
-         }
-         strcpy(Ip2Name,buf);
-         fixnone(Ip2Name);
-         return;
-      }
-
-      if(strstr(buf,"user_ip") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in user_ip parameter.\n");
-            exit(1);
-         }
-         strcpy(UserIp,buf);
-         fixnone(UserIp);
-         return;
-      }
-
-      if(strstr(buf,"max_elapsed") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in max_elapsed parameter.\n");
-            exit(1);
-         }
-         strcpy(MaxElapsed,buf);
-         fixnone(MaxElapsed);
-         return;
-      }
-
-      if(strstr(buf,"date_format") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in date_format parameter.\n");
-            exit(1);
-         }
-         strncpy(DateFormat,buf,1);
-         fixnone(DateFormat);
-         return;
-      }
-
-      if( strstr( buf, "hours" ) != 0 ) {
-         if( getnumlist( buf, &hours, 24, 24 ) ) {
-            fprintf( stderr, "Error: Invalid syntax in hours tag!\n" );
-            exit( 1 );
-         }
-       }
-
-      if( strstr( buf, "weekdays" ) != 0 ) {
-         if( getnumlist( buf, &weekdays, 7, 7 ) ) {
-            fprintf( stderr, "Error: Invalid syntax in weekdays tag!\n" );
-            exit( 1 );
-         }
-      }
-
-      if(strstr(buf,"topuser_sort_field") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0 || getword_multisep(TopuserSortField,sizeof(TopuserSortField),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in topuser_sort_field parameter.\n");
-            exit(1);
-         }
-         strcpy(TopuserSortOrder,buf);
-         fixnone(TopuserSortOrder);
-         return;
-      }
-
-      if(strstr(buf,"user_sort_field") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0 || getword_multisep(UserSortField,sizeof(UserSortField),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in user_sort_field parameter.\n");
-            exit(1);
-         }
-         strcpy(UserSortOrder,buf);
-         fixnone(UserSortOrder);
-         return;
-      }
-
-      if(strstr(buf,"access_log") != 0) {
-         if(strstr(buf,"realtime_access_log_lines") == 0) {
-            if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-               printf("SARG: Maybe you have a broken record or garbage in access_log parameter.\n");
-               exit(1);
-            }
-            strcpy(AccessLog,buf);
-            fixnone(AccessLog);
-            return;
-         }
-      }
-
-      if(strstr(buf,"useragent_log") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in useragent_log parameter.\n");
-            exit(1);
-         }
-         strcpy(UserAgentLog,buf);
-         fixnone(UserAgentLog);
-         return;
-      }
-
-      if(strstr(buf,"exclude_hosts") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in exclude_hosts parameter.\n");
-            exit(1);
-         }
-         strcpy(ExcludeHosts,buf);
-         fixnone(ExcludeHosts);
-         return;
-      }
-
-      if(strstr(buf,"exclude_codes") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in exclude_codes parameter.\n");
-            exit(1);
-         }
-         strcpy(ExcludeCodes,buf);
-         fixnone(ExcludeCodes);
-         return;
-      }
-
-      if(strstr(buf,"exclude_users") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in exclude_users parameter.\n");
-            exit(1);
-         }
-         strcpy(ExcludeUsers,buf);
-         fixnone(ExcludeUsers);
-         return;
-      }
-
-      if(strstr(buf,"password") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in password parameter.\n");
-            exit(1);
-         }
-         strcpy(PasswdFile,buf);
-         fixnone(PasswdFile);
-         return;
-      }
-
-      if(strstr(buf,"temporary_dir") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in temporary_dir parameter.\n");
-            exit(1);
-         }
-         strcpy(TempDir,buf);
-         fixnone(TempDir);
-         return;
-      }
-
-      if(strstr(buf,"report_type") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in report_type parameter.\n");
-            exit(1);
-         }
-         strcpy(ReportType,buf);
-         fixnone(ReportType);
-         return;
-      }
-
-      if(strstr(buf,"output_dir") != 0) {
-         if(strstr(buf,"output_dir_form") == 0) {
-            if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-               printf("SARG: Maybe you have a broken record or garbage in output_dir parameter.\n");
-               exit(1);
-            }
-            strcpy(OutputDir,buf);
-            fixnone(OutputDir);
-            return;
-         }
-      }
-
-      if(strstr(buf,"output_email") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in output_email parameter.\n");
-            exit(1);
-         }
-         strcpy(OutputEmail,buf);
-         fixnone(OutputEmail);
-         return;
-      }
-
-      if(strstr(buf,"per_user_limit") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0 || getword_multisep(PerUserLimitFile,sizeof(PerUserLimitFile),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in per_user_limit parameter.\n");
-            exit(1);
-         }
-         strcpy(PerUserLimit,buf);
-         fixnone(PerUserLimitFile);
-         fixnone(PerUserLimit);
-         return;
-      }
-
-
-      if(strstr(buf,"lastlog") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in lastlog parameter.\n");
-            exit(1);
-         }
-         strcpy(LastLog,buf);
-         fixnone(LastLog);
-         return;
-      }
-
-      if(strstr(buf,"remove_temp_files") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in remove_temp_files parameter.\n");
-            exit(1);
-         }
-         strcpy(RemoveTempFiles,buf);
-         fixnone(RemoveTempFiles);
-         return;
-      }
-
-      if(strstr(buf,"replace_index") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in replace_index parameter.\n");
-            exit(1);
-         }
-         strcpy(ReplaceIndex,buf);
-         fixnone(ReplaceIndex);
-         return;
-      }      
-
-      if(strstr(buf,"index_tree") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in index_tree parameter.\n");
-            exit(1);
-         }
-         strcpy(IndexTree,buf);
-         fixnone(IndexTree);
-         return;
-      }      
-
-      if(strstr(buf,"index") != 0) {
-         if(strstr(buf,"index_sort_order") == 0) {
-            if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-               printf("SARG: Maybe you have a broken record or garbage in index parameter.\n");
-               exit(1);
-            }
-            strcpy(Index,buf);
-            fixnone(Index);
-            return;
-         }
-      }
-
-      if(strstr(buf,"overwrite_report") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in overwrite_report parameter.\n");
-            exit(1);
-         }
-         strcpy(OverwriteReport,buf);
-         fixnone(OverwriteReport);
-         return;
-      }
-
-      if(strstr(buf,"records_without_userid") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in records_without_userid parameter.\n");
-            exit(1);
-         }
-         strcpy(RecordsWithoutUser,buf);
-         fixnone(RecordsWithoutUser);
-         return;
-      }
-
-      if(strstr(buf,"use_comma") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in use_comma parameter.\n");
-            exit(1);
-         }
-         strcpy(UseComma,buf);
-         fixnone(UseComma);
-         return;
-      }
-
-      if(strstr(buf,"mail_utility") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in mail_utility parameter.\n");
-            exit(1);
-         }
-         strcpy(MailUtility,buf);
-         fixnone(MailUtility);
-         return;
-      }
-
-      if(strstr(buf,"topsites_num") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in topsites_num parameter.\n");
-            exit(1);
-         }
-         strcpy(TopSitesNum,buf);
-         fixnone(TopSitesNum);
-         return;
-      }
-
-      if(strstr(buf,"topuser_num") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in topuser_num parameter.\n");
-            exit(1);
-         }
-         strcpy(TopUsersNum,buf);
-         fixnone(TopUsersNum);
-         return;
-      }
-
-      if(strstr(buf,"usertab") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in usertab parameter.\n");
-            exit(1);
-         }
-         strcpy(UserTabFile,buf);
-         fixnone(UserTabFile);
-         return;
-      }
-
-      if(strstr(buf,"index_sort_order") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in index_sort_order parameter.\n");
-            exit(1);
-         }
-         strcpy(IndexSortOrder,buf);
-         fixnone(IndexSortOrder);
-         return;
-      }
-
-      if(strstr(buf,"topsites_sort_order") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0 || getword_multisep(TopsitesSortField,sizeof(TopsitesSortField),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in topsites_sort_order parameter.\n");
-            exit(1);
-         }
-         strcpy(TopsitesSortType,buf);
-         fixnone(TopsitesSortField);
-         fixnone(TopsitesSortType);
-         return;
-      }
-
-      if(strstr(buf,"long_url") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in long_url parameter.\n");
-            exit(1);
-         }
-         strcpy(LongUrl,buf);
-         fixnone(LongUrl);
-         return;
-      }
-
-      if(strstr(buf,"language") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in language parameter.\n");
-            exit(1);
-         }
-         strcpy(language,buf);
-         fixnone(language);
-         return;
-      }
-
-      if(strstr(buf,"dansguardian_conf") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in dansguardian_conf parameter.\n");
-            exit(1);
-         }
-         strcpy(DansGuardianConf,buf);
-         fixnone(DansGuardianConf);
-         return;
-      }
-
-      if(strstr(buf,"squidguard_conf") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in squidguard_conf parameter.\n");
-            exit(1);
-         }
-         strcpy(SquidGuardConf,buf);
-         fixnone(SquidGuardConf);
-         return;
-      }
-
-      if(strstr(buf,"date_time_by") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in date_time_by parameter.\n");
-            exit(1);
-         }
-         strcpy(datetimeby,buf);
-         fixnone(datetimeby);
-         return;
-      }
-
-      if(strstr(buf,"charset") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in charset parameter.\n");
-            exit(1);
-         }
-         strcpy(CharSet,buf);
-         fixnone(CharSet);
-         ccharset(CharSet);
-         return;
-      }
-
-      if(strstr(buf,"user_invalid_char") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,'"')<0 || getword_multisep(UserInvalidChar,sizeof(UserInvalidChar),buf,'"')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in user_invalid_char parameter.\n");
-            exit(1);
-         }
-         fixnone(UserInvalidChar);
-         return;
-      }
-
-      if(strstr(buf,"include_users") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,'"')<0 || getword_multisep(wbuf,sizeof(wbuf),buf,'"')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in include_users parameter.\n");
-            exit(1);
-         }
-        sprintf(IncludeUsers,":%s:",wbuf);
-         fixnone(IncludeUsers);
-         return;
-      }
-
-      if(strstr(buf,"exclude_string") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,'"')<0 || getword_multisep(ExcludeString,sizeof(ExcludeString),buf,'"')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in exclude_string parameter.\n");
-            exit(1);
-         }
-         fixnone(ExcludeString);
-         return;
-      }
-
-      if(strstr(buf,"privacy") != 0) {
-         if(strstr(buf,"privacy_string") == 0 && \
-           strstr(buf,"privacy_string_color") == 0) {
-            if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-               printf("SARG: Maybe you have a broken record or garbage in privacy parameter.\n");
-               exit(1);
-            }
-            strcpy(Privacy,buf);
-            fixnone(Privacy);
-            return;
-        }
-      }
-
-      if(strstr(buf,"privacy_string") != 0) {
-        if(strstr(buf,"privacy_string_color") == 0) {
-            if (getword_multisep(wbuf,sizeof(wbuf),buf,'"')<0 || getword_multisep(PrivacyString,sizeof(PrivacyString),buf,'"')<0) {
-               printf("SARG: Maybe you have a broken record or garbage in privacy_string parameter.\n");
-               exit(1);
-            }
-            fixnone(PrivacyString);
-            return;
-        }
-      }
-
-      if(strstr(buf,"privacy_string_color") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in privacy_string_color parameter.\n");
-            exit(1);
-         }
-         strcpy(PrivacyStringColor,buf);
-         fixnone(PrivacyStringColor);
-         return;
-      }
-
-      if(strstr(buf,"show_successful_message") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in show_successful_message parameter.\n");
-            exit(1);
-         }
-         strcpy(SuccessfulMsg,buf);
-         fixnone(SuccessfulMsg);
-         return;
-      }
-
-      if(strstr(buf,"show_read_statistics") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in show_read_statistics parameter.\n");
-            exit(1);
-         }
-         strcpy(ShowReadStatistics,buf);
-         fixnone(ShowReadStatistics);
-         return;
-      }
-
-      if(strstr(buf,"topuser_fields") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in topuser_fields parameter.\n");
-            exit(1);
-         }
-         strcpy(TopUserFields,buf);
-         fixnone(TopUserFields);
-         return;
-      }
-
-      if(strstr(buf,"bytes_in_sites_users_report") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in bytes_in_sites_users_report parameter.\n");
-            exit(1);
-         }
-         strcpy(BytesInSitesUsersReport,buf);
-         fixnone(BytesInSitesUsersReport);
-         return;
-      }
-
-      if(strstr(buf,"user_report_fields") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in user_report_fields parameter.\n");
-            exit(1);
-         }
-         strcpy(UserReportFields,buf);
-         fixnone(UserReportFields);
-         return;
-      }
-
-      if(strstr(buf,"bytes_in_sites_users_report") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in site_user_time_date_type parameter.\n");
-            exit(1);
-         }
-         strcpy(BytesInSitesUsersReport,buf);
-         fixnone(BytesInSitesUsersReport);
-         return;
-      }
-
-      if(strstr(buf,"datafile ") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in datafile parameter.\n");
-            exit(1);
-         }
-         strcpy(DataFile,buf);
-         fixnone(DataFile);
-         return;
-      }
-
-      if(strstr(buf,"datafile_delimiter") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0 || getword(wbuf,sizeof(wbuf),buf,'"')<0 ||
-             getword(DataFileDelimiter,sizeof(DataFileDelimiter),buf,'"')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in datafile_delimiter parameter.\n");
-            exit(1);
-         }
-         fixnone(DataFileDelimiter);
-         return;
-      }
-
-      if(strstr(buf,"datafile_fields") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in datafile_fields parameter.\n");
-            exit(1);
-         }
-         strcpy(DataFileFields,buf);
-         fixnone(DataFileFields);
-         return;
-      }
-
-      if(strstr(buf,"datafile_url") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in datafile_url parameter.\n");
-            exit(1);
-         }
-         strcpy(DataFileUrl,buf);
-         fixnone(DataFileUrl);
-         return;
-      }
-
-      if(strstr(buf,"parsed_output_log") != 0) {
-        if(strstr(buf,"parsed_output_log_compress") == 0) {
-            if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-               printf("SARG: Maybe you have a broken record or garbage in parsed_output_log parameter.\n");
-               exit(1);
-            }
-            strcpy(ParsedOutputLog,buf);
-            fixnone(ParsedOutputLog);
-            return;
-         }
-      }
-
-      if(strstr(buf,"parsed_output_log_compress") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in parsed_output_log_compress parameter.\n");
-            exit(1);
-         }
-         strcpy(ParsedOutputLogCompress,buf);
-         fixnone(ParsedOutputLogCompress);
-         return;
-      }
-
-      if(strstr(buf,"displayed_values") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in displayed_values parameter.\n");
-            exit(1);
-         }
-         strcpy(DisplayedValues,buf);
-         fixnone(DisplayedValues);
-         return;
-      }
-
-      if(strstr(buf,"authfail_report_limit") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in authfail_report_limit parameter.\n");
-            exit(1);
-         }
-         AuthfailReportLimit=atoi(buf);
-         return;
-      }
-
-      if(strstr(buf,"denied_report_limit") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in denied_report_limit parameter.\n");
-            exit(1);
-         }
-         DeniedReportLimit=atoi(buf);
-         return;
-      }
-
-      if(strstr(buf,"siteusers_report_limit") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in siteusers_report_limit parameter.\n");
-            exit(1);
-         }
-         SiteUsersReportLimit=atoi(buf);
-         return;
-      }
-
-      if(strstr(buf,"dansguardian_report_limit") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in dansguardian_report_limit parameter.\n");
-            exit(1);
-         }
-         DansGuardianReportLimit=atoi(buf);
-         return;
-      }
-
-      if(strstr(buf,"squidguard_report_limit") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in squidguard_report_limit parameter.\n");
-            exit(1);
-         }
-         SquidGuardReportLimit=atoi(buf);
-         return;
-      }
-
-      if(strstr(buf,"user_report_limit") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in user_report_limit parameter.\n");
-            exit(1);
-         }
-         UserReportLimit=atoi(buf);
-         return;
-      }
-
-      if(strstr(buf,"download_report_limit") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in download_report_limit parameter.\n");
-            exit(1);
-         }
-         DownloadReportLimit=atoi(buf);
-         return;
-      }
-
-      if(strstr(buf,"www_document_root") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in www_document_root parameter.\n");
-            exit(1);
-         }
-         strcpy(wwwDocumentRoot,buf);
-         fixnone(wwwDocumentRoot);
-         return;
-      }
-
-      if(strstr(buf,"block_it") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in block_it parameter.\n");
-            exit(1);
-         }
-         strcpy(BlockIt,buf);
-         fixnone(BlockIt);
-         return;
-      }
-
-      if(strstr(buf,"external_css_file") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in external_css_file parameter.\n");
-            exit(1);
-         }
-         strcpy(ExternalCSSFile,buf);
-         fixnone(ExternalCSSFile);
-         return;
-      }
-
-      if(strstr(buf,"user_authentication") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in user_authentication parameter.\n");
-            exit(1);
-         }
-         strcpy(UserAuthentication,buf);
-         fixnone(UserAuthentication);
-         return;
-      }
-
-      if(strstr(buf,"AuthUserFile") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in AuthUserFile parameter.\n");
-            exit(1);
-         }
-         strcpy(AuthUserFile,buf);
-         fixnone(AuthUserFile);
-         return;
-      }
-
-      if(strstr(buf,"AuthName") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in AuthName parameter.\n");
-            exit(1);
-         }
-         strcpy(AuthName,buf);
-         fixnone(AuthName);
-         return;
-      }
-
-      if(strstr(buf,"AuthType") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in AuthType parameter.\n");
-            exit(1);
-         }
-         strcpy(AuthType,buf);
-         fixnone(AuthType);
-         return;
-      }
-
-      if(strstr(buf,"Require") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in Require parameter.\n");
-            exit(1);
-         }
-         strcpy(Require,buf);
-         fixnone(Require);
-         return;
-      }
-
-      if(strstr(buf,"download_suffix") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,'"')<0 || getword_multisep(DownloadSuffix,sizeof(DownloadSuffix),buf,'"')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in download_suffix parameter.\n");
-            exit(1);
-         }
-         fixnone(DownloadSuffix);
-         return;
-      }
-
-      if(strstr(buf,"graphs") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in graphs parameter.\n");
-            exit(1);
-         }
-         strcpy(Graphs,buf);
-         fixnone(Graphs);
-         return;
-      }
-
-      if(strstr(buf,"graph_days_bytes_bar_color") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in graph_days_bytes_bar_color parameter.\n");
-            exit(1);
-         }
-         strcpy(GraphDaysBytesBarColor,buf);
-         fixnone(GraphDaysBytesBarColor);
-         return;
-      }
-
-      if(strstr(buf,"squidguard_log_format") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in squidguard_log_format parameter.\n");
-            exit(1);
-         }
-         strcpy(SquidGuardLogFormat,buf);
-         fixnone(SquidGuardLogFormat);
-         return;
-      }
-
-      if(strstr(buf,"squidguard_ignore_date") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in squidguard_ignore_date parameter.\n");
-            exit(1);
-         }
-         strcpy(SquidguardIgnoreDate,buf);
-         fixnone(SquidguardIgnoreDate);
-         return;
-      }
-
-      if(strstr(buf,"dansguardian_ignore_date") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in dansguardian_ignore_date parameter.\n");
-            exit(1);
-         }
-         strcpy(DansguardianIgnoreDate,buf);
-         fixnone(DansguardianIgnoreDate);
-         return;
-      }
-
-      if(strstr(buf,"ulimit") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in ulimit parameter.\n");
-            exit(1);
-         }
-         strcpy(Ulimit,buf);
-         fixnone(Ulimit);
-         return;
-      }
-
-      if(strstr(buf,"ntlm_user_format") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in ntlm_user_format parameter.\n");
-            exit(1);
-         }
-         strcpy(NtlmUserFormat,buf);
-         fixnone(NtlmUserFormat);
-         return;
-      }
-
-      if(strstr(buf,"realtime_types") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in realtime_types parameter.\n");
-            exit(1);
-         }
-         strcpy(RealtimeTypes,buf);
-         fixnone(RealtimeTypes);
-         return;
-      }
-
-      if(strstr(buf,"realtime_unauthenticated_records") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in realtime_unauthenticated_records parameter.\n");
-            exit(1);
-         }
-         strcpy(RealtimeUnauthRec,buf);
-         fixnone(RealtimeUnauthRec);
-         return;
-      }
-
-      if(strstr(buf,"realtime_refresh_time") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in realtime_refresh_time parameter.\n");
-            exit(1);
-         }
-         realtime_refresh=atoi(buf);
-         return;
-      }
-
-      if(strstr(buf,"realtime_access_log_lines") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in realtime_access_log_lines parameter.\n");
-            exit(1);
-         }
-         realtime_access_log_lines=atoi(buf);
-         return;
-      }
-
-      if(strstr(buf,"squid24") != 0) {
-         squid24++;
-         return;
-      }
-
-      if(strstr(buf,"byte_cost") != 0) {
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in byte_cost parameter.\n");
-            exit(1);
-         }
-         cost=atol(buf);
-         if (getword_multisep(wbuf,sizeof(wbuf),buf,' ')<0) {
-            printf("SARG: Maybe you have a broken record or garbage in byte_cost parameter.\n");
-            exit(1);
-         }
-         nocost=my_atoll(buf);
-         return;
-      }
+static struct param_list datafileurl_values[]=
+{
+       {"ip",DATAFILEURL_IP,~DATAFILEURL_IP},
+       {"name",DATAFILEURL_NAME,~DATAFILEURL_NAME},
+};
+
+static struct param_list displayvalue_values[]=
+{
+       {"bytes",DISPLAY_BYTES,~DISPLAY_BYTES},
+       {"abbreviation",DISPLAY_ABBREV,~DISPLAY_ABBREV},
+};
+
+static struct param_list datetime_values[]=
+{
+       {"elap",DATETIME_ELAP,0},
+       {"bytes",DATETIME_BYTE,0},
+};
+
+static struct param_list realtime_unauth_values[]=
+{
+       {"show",REALTIME_UNAUTH_REC_SHOW,~REALTIME_UNAUTH_REC_SHOW},
+       {"ignore",REALTIME_UNAUTH_REC_IGNORE,~REALTIME_UNAUTH_REC_IGNORE},
+};
+
+struct sort_list topuser_sort[]=
+{
+       {"BYTES",TOPUSER_SORT_BYTES},
+       {"USER",TOPUSER_SORT_USER},
+       {"CONNECT",TOPUSER_SORT_CONNECT},
+       {"TIME",TOPUSER_SORT_TIME},
+};
+
+struct sort_list topsite_sort[]=
+{
+       {"BYTES",TOPSITE_SORT_BYTES},
+       {"CONNECT",TOPSITE_SORT_CONNECT},
+       {"TIME",TOPSITE_SORT_TIME},
+       {"USER",TOPSITE_SORT_USER},
+};
+
+struct sort_list user_sort[]=
+{
+       {"BYTES",USER_SORT_BYTES},
+       {"SITE",USER_SORT_SITE},
+       {"CONNECT",USER_SORT_CONNECT},
+       {"TIME",USER_SORT_TIME},
+};
+
+static struct select_list per_user_limit_create_file[]=
+{
+       {"always",PUFC_Always}, //always create an empty file
+       {"as_required",PUFC_AsRequired}, //create the file if necessary (no empty file is created)
+};
+
+static int is_param(const char *param,const char *buf)
+{
+       int plen;
+
+       plen=strlen(param);
+       if (strncmp(buf,param,plen) != 0) return(0);
+       buf+=plen;
+       if ((unsigned char)*buf>' ') return(0);
+       return(1);
 }
 
-void getconf(void)
+static int getparam_string(const char *param,char *buf,char *value,int value_size)
+{
+       int plen;
+
+       plen=strlen(param);
+       if (strncmp(buf,param,plen) != 0) return(0);
+       buf+=plen;
+       if ((unsigned char)*buf>' ') return(0);
+       while (*buf && (unsigned char)*buf<=' ') buf++;
+
+       if (strlen(buf)>=value_size) {
+               debuga(__FILE__,__LINE__,_("The string value of parameter \"%s\" is too long\n"),param);
+               exit(EXIT_FAILURE);
+       }
+       strcpy(value,buf);
+       fixnone(value);
+       return(1);
+}
+
+/*!
+ * Get a pointer to the beginning of the string value defined by the
+ * parameter. The returned value is NULL if the buffer doesn't contain
+ * the parameter.
+ *
+ * \param param The parameter to look for.
+ * \param buf The buffer containing the line read from the configuration
+ * file.
+ *
+ * \return A pointer to the beginning of the parameter value or NULL if
+ * the line is not for the requtested parameter.
+ */
+static char *getparam_stringptr(const char *param,char *buf)
+{
+       int plen;
+
+       plen=strlen(param);
+       if (strncmp(buf,param,plen) != 0) return(NULL);
+       buf+=plen;
+       if ((unsigned char)*buf>' ') return(NULL);
+       while (*buf && (unsigned char)*buf<=' ') buf++;
+
+       return(buf);
+}
+
+static int getparam_quoted(const char *param,char *buf,char *value,int value_size)
+{
+       int plen;
+       int i;
+
+       plen=strlen(param);
+       if (strncmp(buf,param,plen) != 0) return(0);
+       buf+=plen;
+       if ((unsigned char)*buf>' ') return(0);
+       while (*buf && (unsigned char)*buf<=' ') buf++;
+
+       if (*buf != '\"') {
+               debuga(__FILE__,__LINE__,_("Missing double quote after parameter \"%s\"\n"),param);
+               exit(EXIT_FAILURE);
+       }
+       buf++;
+
+       value_size--;
+       for (i=0 ; i<value_size && *buf && *buf!='\"' ; i++) {
+               value[i]=*buf++;
+       }
+       value[i]='\0';
+
+       if (*buf != '\"') {
+               debuga(__FILE__,__LINE__,_("Missing double quote after parameter \"%s\" or value is more than %d bytes long\n"),param,value_size);
+               exit(EXIT_FAILURE);
+       }
+       fixnone(value);
+       return(1);
+}
+
+static int getparam_2words(const char *param,char *buf,char *word1,int word1_size,char *word2,int word2_size)
+{
+       int plen;
+       int i;
+
+       plen=strlen(param);
+       if (strncmp(buf,param,plen) != 0) return(0);
+       buf+=plen;
+       if ((unsigned char)*buf>' ') return(0);
+       while (*buf && (unsigned char)*buf<=' ') buf++;
+
+       for (i=0 ; i<word1_size && *buf && (unsigned char)*buf>' ' ; i++)
+               word1[i]=*buf++;
+       if (i>=word1_size) {
+               debuga(__FILE__,__LINE__,_("The first word of parameter \"%s\" is more than %d bytes long\n"),param,word1_size-1);
+               exit(EXIT_FAILURE);
+       }
+       if (*buf!=' ') {
+               debuga(__FILE__,__LINE__,_("Missing second word for parameter \"%s\"\n"),param);
+               exit(EXIT_FAILURE);
+       }
+       word1[i]=0;
+
+       while (*buf && (unsigned char)*buf<=' ') buf++;
+
+       for (i=0 ; i<word2_size && *buf && (unsigned char)*buf>' ' ; i++)
+               word2[i]=*buf++;
+       if (i>=word2_size) {
+               debuga(__FILE__,__LINE__,_("The second word of parameter \"%s\" is more than %d bytes long\n"),param,word2_size-1);
+               exit(EXIT_FAILURE);
+       }
+       word2[i]=0;
+
+       fixnone(word1);
+       fixnone(word2);
+       return(1);
+}
+
+static int getparam_int(const char *param,char *buf,int *value)
+{
+       int plen;
+       int next;
+
+       plen=strlen(param);
+       if (strncmp(buf,param,plen) != 0) return(0);
+       buf+=plen;
+       if ((unsigned char)*buf>' ') return(0);
+       while (*buf && (unsigned char)*buf<=' ') buf++;
+
+       next=0;
+       if (sscanf(buf,"%d%n",value,&next) != 1 || (unsigned char)buf[next] > ' ') {
+               debuga(__FILE__,__LINE__,_("The integer value of parameter \"%s\" is invalid\n"),param);
+               exit(EXIT_FAILURE);
+       }
+       return(1);
+}
+
+static int getparam_bool(const char *param,char *buf,bool *value)
+{
+       int plen;
+       int i;
+       const char *bool_str="yes,true,on,1";
+
+       plen=strlen(param);
+       if (strncmp(buf,param,plen) != 0) return(0);
+       buf+=plen;
+       if ((unsigned char)*buf>' ') return(0);
+       while (*buf && (unsigned char)*buf<=' ') buf++;
+
+       *value=false;
+       for ( ; *bool_str ; bool_str+=i) {
+               for (i=0 ; bool_str[i] && bool_str[i]!=',' ; i++);
+               if (strncasecmp(bool_str,buf,i)==0) {
+                       *value=true;
+                       break;
+               }
+               if (bool_str[i]==',') i++;
+       }
+       return(1);
+}
+
+static int getparam_list(const char *param,struct param_list *options,int noptions,char *buf,unsigned long int *value)
+{
+       int plen;
+       char *str;
+       int i;
+
+       plen=strlen(param);
+       if (strncmp(buf,param,plen) != 0) return(0);
+       buf+=plen;
+       if ((unsigned char)*buf>' ') return(0);
+       while (*buf && (unsigned char)*buf<=' ') buf++;
+
+       *value=0UL;
+       while (*buf) {
+               str=buf;
+               while (*str && (unsigned char)*str>' ' && *str!=';') str++;
+               if (*str) {
+                       *str++='\0';
+                       while (*str && ((unsigned char)*str<=' ' || *str==';')) str++;
+               }
+               for (i=0 ; i<noptions && strcasecmp(buf,options[i].name) ; i++);
+               if (i>=noptions) {
+                       debuga(__FILE__,__LINE__,_("Unknown value \"%s\" for parameter \"%s\"\n"),buf,param);
+                       exit(EXIT_FAILURE);
+               }
+               if ((*value & options[i].exclude)!=0) {
+                       debuga(__FILE__,__LINE__,_("Value \"%s\" conflicts with other selected values for parameter \"%s\"\n"),buf,param);
+                       exit(EXIT_FAILURE);
+               }
+               *value|=options[i].value;
+               buf=str;
+       }
+       return(1);
+}
+
+static int getparam_sort(const char *param,struct sort_list *options,int noptions,char *buf,unsigned long int *value)
+{
+       int plen;
+       char *str, *order;
+       int i;
+
+       plen=strlen(param);
+       if (strncmp(buf,param,plen) != 0) return(0);
+       buf+=plen;
+       if ((unsigned char)*buf>' ') return(0);
+       while (*buf && (unsigned char)*buf<=' ') buf++;
+
+       str=buf;
+       order=NULL;
+       while (*str && (unsigned char)*str>' ') str++;
+       if (*str) {
+               *str++='\0';
+               while (*str && (unsigned char)*str<=' ') str++;
+               order=str;
+       }
+       for (i=0 ; i<noptions && strcasecmp(buf,options[i].name) ; i++);
+       if (i>=noptions) {
+               debuga(__FILE__,__LINE__,_("Unknown sort criterion \"%s\" for parameter \"%s\"\n"),buf,param);
+               exit(EXIT_FAILURE);
+       }
+       *value=options[i].value;
+
+       if (order) {
+               str=order;
+               while (*str && (unsigned char)*str>' ') str++;
+               if (*str) {
+                       *str++='\0';
+                       while (*str && (unsigned char)*str<=' ') str++;
+               }
+               if (strcasecmp(order,"reverse")==0 || strcasecmp(order,"D")==0) {
+                       *value|=SORT_REVERSE;
+               } else if (strcasecmp(order,"normal")!=0 && strcasecmp(order,"A")!=0) {
+                       debuga(__FILE__,__LINE__,_("Unknown sort order \"%s\" for parameter \"%s\"\n"),order,param);
+                       exit(EXIT_FAILURE);
+               }
+       }
+
+       buf=str;
+       return(1);
+}
+
+static int getparam_select(const char *param,struct select_list *options,int noptions,char *buf,int *value)
+{
+       int plen;
+       char *str;
+       int i;
+
+       plen=strlen(param);
+       if (strncmp(buf,param,plen) != 0) return(0);
+       buf+=plen;
+       if ((unsigned char)*buf>' ') return(0);
+       while (*buf && (unsigned char)*buf<=' ') buf++;
+
+       str=buf;
+       while (*buf && (unsigned char)*buf>' ' && *buf!=';') buf++;
+       *buf='\0';
+       for (i=0 ; i<noptions && strcasecmp(str,options[i].name) ; i++);
+       if (i>=noptions) {
+               debuga(__FILE__,__LINE__,_("Unknown value \"%s\" for parameter \"%s\"\n"),str,param);
+               exit(EXIT_FAILURE);
+       }
+       *value=options[i].value;
+       return(1);
+}
+
+static int getparam_userlimit(const char *param,char *buf)
+{
+       int plen;
+       char *file_begin,*file_end;
+       int limit;
+       int digit;
+       char *str;
+       int i;
+       enum PerUserOutputEnum output;
+       const struct
+       {
+               const char *name;
+               enum PerUserOutputEnum value;
+       } output_types[]=
+       {
+               {"id",PUOE_UserId},
+               {"ip",PUOE_UserIp},
+       };
+
+       plen=strlen(param);
+       if (strncmp(buf,param,plen) != 0) return(0);
+       buf+=plen;
+       if ((unsigned char)*buf>' ') return(0);
+       while (*buf && (unsigned char)*buf<=' ') buf++;
+
+       /*
+       options are made of a file name, an integer limit and an optional
+       integer flag. The file name may contain spaces. We keep searching
+       until a valid number is found after a space.
+       */
+       file_begin=buf;
+       do {
+               while (*buf && (unsigned char)*buf>' ') buf++;
+               if (*buf!=' ') {
+                       debuga(__FILE__,__LINE__,_("Missing limit in per_user_limit\n"));
+                       exit(EXIT_FAILURE);
+               }
+               file_end=buf;
+               while (*buf && (unsigned char)*buf<=' ') buf++;
+               limit=0;
+               while (*buf && isdigit(*buf)) {
+                       digit=*buf-'0';
+                       if (limit>=(INT_MAX-digit)/10) break;
+                       limit=limit*10+digit;
+                       buf++;
+               }
+       } while (*buf && *buf!=' ');
+
+       output=PUOE_UserId;
+       if (*buf==' ') {
+               while (*buf && (unsigned char)*buf<=' ') buf++;
+               str=buf;
+               while (*buf && (unsigned char)*buf>' ') buf++;
+               *buf='\0';
+               for (i=sizeof(output_types)/sizeof(output_types[0])-1 ; i>=0 ; i--)
+                       if (strcasecmp(output_types[i].name,str)==0) {
+                               output=output_types[i].value;
+                               break;
+                       }
+               if (i<0) {
+                       debuga(__FILE__,__LINE__,_("Invalid output type in per_user_limit\n"));
+                       exit(EXIT_FAILURE);
+               }
+       }
+
+       if (PerUserLimitsNumber>=MAX_USER_LIMITS) {
+               debuga(__FILE__,__LINE__,_("Too many per_user_limit\n"));
+               exit(EXIT_FAILURE);
+       }
+       *file_end='\0';
+       safe_strcpy(PerUserLimits[PerUserLimitsNumber].File,file_begin,sizeof(PerUserLimits[PerUserLimitsNumber].File));
+       PerUserLimits[PerUserLimitsNumber].Limit=limit;
+       PerUserLimits[PerUserLimitsNumber].Output=output;
+       PerUserLimitsNumber++;
+
+       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];
+       struct getwordstruct gwarea;
+       int iVal;
+
+       while (*buf && (unsigned char)*buf<=' ') buf++;
+
+       if(*buf == '#' || *buf == '\0')
+               return;
+
+       if(debugz>=LogLevel_Process)
+               printf(_("SARG: TAG: %s\n"),buf);
+
+       if (getparam_string("background_color",buf,BgColor,sizeof(BgColor))>0) return;
+
+       if (getparam_string("text_color",buf,TxColor,sizeof(TxColor))>0) return;
+
+       if (getparam_string("text_bgcolor",buf,TxBgColor,sizeof(TxBgColor))>0) return;
+
+       if (getparam_string("title_color",buf,TiColor,sizeof(TiColor))>0) return;
+
+       if (getparam_string("logo_image",buf,LogoImage,sizeof(LogoImage))>0) return;
+
+       if (getparam_quoted("logo_text",buf,LogoText,sizeof(LogoText))>0) return;
+
+       if (getparam_string("logo_text_color",buf,LogoTextColor,sizeof(LogoTextColor))>0) return;
+
+       if (getparam_string("background_image",buf,BgImage,sizeof(BgImage))>0) return;
+
+       if (getparam_bool("show_sarg_info",buf,&ShowSargInfo)>0) return;
+
+       if (getparam_bool("show_sarg_logo",buf,&ShowSargLogo)>0) return;
+
+       if (getparam_string("font_face",buf,FontFace,sizeof(FontFace))>0) return;
+
+       if (getparam_string("header_color",buf,HeaderColor,sizeof(HeaderColor))>0) return;
+
+       if (getparam_string("header_bgcolor",buf,HeaderBgColor,sizeof(HeaderBgColor))>0) return;
+
+       if (getparam_string("font_size",buf,FontSize,sizeof(FontSize))>0) return;
+
+       if (getparam_string("header_font_size",buf,HeaderFontSize,sizeof(HeaderFontSize))>0) return;
+
+       if (getparam_string("title_font_size",buf,TitleFontSize,sizeof(TitleFontSize))>0) return;
+
+       if (getparam_2words("image_size",buf,Width,sizeof(Width),Height,sizeof(Height))>0) return;
+
+       if (getparam_quoted("title",buf,Title,sizeof(Title))>0) return;
+
+       if (strncasecmp(buf,"resolve_ip",10)==0) {
+               if (ip2name_config(buf+10)>0) return;
+       }
+
+       if (getparam_bool("user_ip",buf,&UserIp)>0) return;
+
+       if (getparam_string("max_elapsed",buf,MaxElapsed,sizeof(MaxElapsed))>0) return;
+
+       if (is_param("date_format",buf)) {
+               getword_start(&gwarea,buf);
+               if (getword_multisep(wbuf,sizeof(wbuf),&gwarea,' ')<0) {
+                       debuga(__FILE__,__LINE__,_("Invalid record in \"date_format\" parameter\n"));
+                       exit(EXIT_FAILURE);
+               }
+               DateFormat=gwarea.current[0];
+               return;
+       }
+
+       if (is_param("hours",buf)) {
+               if( getnumlist( buf, &hours, 24, 24 ) ) {
+                       debuga(__FILE__,__LINE__,_("Error: Invalid syntax in hours tag!\n"));
+                       exit( 1 );
+               }
+               return;
+       }
+
+       if (is_param("weekdays",buf)) {
+               if( getnumlist( buf, &weekdays, 7, 7 ) ) {
+                       debuga(__FILE__,__LINE__,_("Error: Invalid syntax in weekdays tag!\n"));
+                       exit( 1 );
+               }
+               return;
+       }
+
+       if (getparam_sort("topuser_sort_field",SET_LIST(topuser_sort),buf,&TopuserSort)>0) return;
 
-   FILE *fp_in;
-   char buf[MAXLEN];
+       if (getparam_sort("user_sort_field",SET_LIST(user_sort),buf,&UserSort)>0) return;
 
-   if(debug) {
-      sprintf(Msg,"Loading configuration from: %s",ConfigFile);
-      debuga(Msg);
-   }
+       if (is_param("access_log",buf)>0) {
+               if (AccessLogFromCmdLine==0) {
+                       char *FileName=getparam_stringptr("access_log",buf);
+                       if (!AccessLog)
+                               AccessLog=FileList_Create();
+                       if (!FileList_AddFile(AccessLog,FileName)) {
+                               debuga(__FILE__,__LINE__,_("Not enough memory to store the input log file names\n"));
+                               exit(EXIT_FAILURE);
+                       }
+               }
+               return;
+       }
 
-   if ((fp_in = fopen(ConfigFile, "r")) == NULL) {
-      fprintf(stderr, "SARG: (getconf) Cannot open file: %s\n",ConfigFile);
-      exit(1);
-   }
+       if (is_param("redirector_log",buf)>0) {
+               if (RedirectorLogFromCmdLine==0) {
+                       if (NRedirectorLogs>=MAX_REDIRECTOR_LOGS) {
+                               debuga(__FILE__,__LINE__,_("Too many redirector log files in configuration file\n"));
+                               exit(EXIT_FAILURE);
+                       }
+                       getparam_string("redirector_log",buf,RedirectorLogs[NRedirectorLogs],MAX_REDIRECTOR_FILELEN);
+                       NRedirectorLogs++;
+               }
+               return;
+       }
+
+       if (getparam_string("useragent_log",buf,UserAgentLog,sizeof(UserAgentLog))>0) return;
+
+       if (getparam_string("exclude_hosts",buf,ExcludeHosts,sizeof(ExcludeHosts))>0) return;
+
+       if (getparam_string("exclude_codes",buf,ExcludeCodes,sizeof(ExcludeCodes))>0) return;
+
+       if (getparam_string("exclude_users",buf,ExcludeUsers,sizeof(ExcludeUsers))>0) return;
+
+       if (getparam_string("password",buf,PasswdFile,sizeof(PasswdFile))>0) return;
+
+       if (getparam_string("temporary_dir",buf,TempDir,sizeof(TempDir))>0) return;
+
+       if (getparam_list("report_type",SET_LIST(report_type_values),buf,&ReportType)>0) return;
+
+       if (getparam_string("output_dir",buf,OutputDir,sizeof(OutputDir))>0) return;
+
+       if (getparam_bool("anonymous_output_files",buf,&AnonymousOutputFiles)>0) return;
+
+       if (getparam_string("output_email",buf,OutputEmail,sizeof(OutputEmail))>0) return;
+
+       if (getparam_userlimit("per_user_limit",buf)>0) return;
+
+       if (getparam_select("per_user_limit_file_create",SET_LIST(per_user_limit_create_file),buf,&iVal)>0) {
+               PerUserFileCreation=(enum PerUserFileCreationEnum)iVal;
+               return;
+       }
+
+       if (getparam_int("lastlog",buf,&LastLog)>0) return;
+
+       if (getparam_bool("remove_temp_files",buf,&RemoveTempFiles)>0) return;
+
+       if (getparam_string("replace_index",buf,ReplaceIndex,sizeof(ReplaceIndex))>0) return;
+
+       if (getparam_list("index_tree",SET_LIST(index_tree_values),buf,&IndexTree)>0) return;
+
+       if (getparam_list("index",SET_LIST(index_values),buf,&Index)>0) return;
+
+       if (getparam_list("index_fields",SET_LIST(indexfields_values),buf,&IndexFields)>0) return;
+
+       if (getparam_bool("overwrite_report",buf,&OverwriteReport)>0) return;
+
+       if (getparam_list("records_without_userid",SET_LIST(recnouser_values),buf,&RecordsWithoutUser)>0) return;
+
+       if (getparam_bool("use_comma",buf,&UseComma)>0) return;
+
+       if (getparam_string("mail_utility",buf,MailUtility,sizeof(MailUtility))>0) return;
+
+       if (getparam_int("topsites_num",buf,&TopSitesNum)>0) return;
+
+       if (getparam_int("topuser_num",buf,&TopUsersNum)>0) return;
+
+       if (getparam_string("usertab",buf,UserTabFile,sizeof(UserTabFile))>0) return;
+
+       if (getparam_string("index_sort_order",buf,IndexSortOrder,sizeof(IndexSortOrder))>0) return;
+
+       if (getparam_sort("topsites_sort_order",SET_LIST(topsite_sort),buf,&TopsitesSort)>0) return;
+
+       if (getparam_bool("long_url",buf,&LongUrl)>0) return;
+
+       if (getparam_string("dansguardian_conf",buf,DansGuardianConf,sizeof(DansGuardianConf))>0) return;
+
+       if (getparam_string("squidguard_conf",buf,SquidGuardConf,sizeof(SquidGuardConf))>0) return;
+
+       if (getparam_list("date_time_by",SET_LIST(datetime_values),buf,&datetimeby)>0) return;
+
+       if (getparam_string("charset",buf,CharSet,sizeof(CharSet))>0) {
+               ccharset(CharSet);
+               return;
+       }
+
+       if (getparam_quoted("user_invalid_char",buf,UserInvalidChar,sizeof(UserInvalidChar))>0) return;
+
+       if (getparam_quoted("include_users",buf,IncludeUsers+1,sizeof(IncludeUsers)-2)>0) {
+               IncludeUsers[0]=':';
+               strcat(IncludeUsers,":");
+               return;
+       }
+
+       if (getparam_quoted("exclude_string",buf,ExcludeString,sizeof(ExcludeString))>0) return;
+
+       if (getparam_bool("privacy",buf,&Privacy)>0) return;
+
+       if (getparam_quoted("privacy_string",buf,PrivacyString,sizeof(PrivacyString))>0) return;
+
+       if (getparam_string("privacy_string_color",buf,PrivacyStringColor,sizeof(PrivacyStringColor))>0) return;
+
+       if (getparam_bool("show_successful_message",buf,&SuccessfulMsg)>0) return;
+
+       if (getparam_bool("show_read_statistics",buf,&ShowReadStatistics)>0) return;
+
+       if (getparam_bool("show_read_percent",buf,&ShowReadPercent)>0) return;
+
+       if (getparam_list("topuser_fields",SET_LIST(topuserfields_values),buf,&TopUserFields)>0) return;
+
+       if (getparam_bool("bytes_in_sites_users_report",buf,&BytesInSitesUsersReport)>0) return;
+
+       if (getparam_list("user_report_fields",SET_LIST(userreportfields_values),buf,&UserReportFields)>0) return;
+
+       if (getparam_string("datafile",buf,DataFile,sizeof(DataFile))>0) return;
+
+       if (getparam_quoted("datafile_delimiter",buf,DataFileDelimiter,sizeof(DataFileDelimiter))>0) return;
+
+       if (getparam_list("datafile_fields",SET_LIST(data_field_values),buf,&DataFileFields)>0) return;
+
+       if (getparam_list("datafile_url",SET_LIST(datafileurl_values),buf,&DataFileUrl)>0) return;
+
+       if (getparam_string("parsed_output_log",buf,ParsedOutputLog,sizeof(ParsedOutputLog))>0) return;
+
+       if (getparam_string("parsed_output_log_compress",buf,ParsedOutputLogCompress,sizeof(ParsedOutputLogCompress))>0) return;
+
+       if (getparam_list("displayed_values",SET_LIST(displayvalue_values),buf,&DisplayedValues)>0) return;
+
+       if (getparam_int("authfail_report_limit",buf,&AuthfailReportLimit)>0) return;
+
+       if (getparam_int("denied_report_limit",buf,&DeniedReportLimit)>0) return;
+
+       if (getparam_int("siteusers_report_limit",buf,&SiteUsersReportLimit)>0) return;
+
+       if (getparam_int("dansguardian_report_limit",buf,&DansGuardianReportLimit)>0) return;
+
+       if (getparam_int("squidguard_report_limit",buf,&SquidGuardReportLimit)>0) return;
+
+       if (getparam_int("user_report_limit",buf,&UserReportLimit)>0) return;
+
+       if (getparam_int("download_report_limit",buf,&DownloadReportLimit)>0) return;
+
+       if (getparam_string("www_document_root",buf,wwwDocumentRoot,sizeof(wwwDocumentRoot))>0) return;
+
+       if (getparam_string("block_it",buf,BlockIt,sizeof(BlockIt))>0) return;
+
+       if (getparam_string("external_css_file",buf,ExternalCSSFile,sizeof(ExternalCSSFile))>0) return;
+
+       if (getparam_bool("user_authentication",buf,&UserAuthentication)>0) return;
+
+       if (getparam_string("AuthUserTemplateFile",buf,wbuf,sizeof(wbuf))>0) {
+               char dir[MAXLEN];
+
+               if (is_absolute(wbuf)) {
+                       if (strlen(wbuf)>=sizeof(AuthUserTemplateFile)) {
+                               debuga(__FILE__,__LINE__,_("Template file name is too long in parameter \"AuthUserTemplateFile\"\n"));
+                               exit(EXIT_FAILURE);
+                       }
+                       safe_strcpy(AuthUserTemplateFile,wbuf,sizeof(AuthUserTemplateFile));
+               } else {
+                       safe_strcpy(dir,ConfigFile,sizeof(dir));
+                       if (snprintf(AuthUserTemplateFile,sizeof(AuthUserTemplateFile),"%s/%s",dirname(dir),wbuf)>=sizeof(AuthUserTemplateFile)) {
+                               debuga(__FILE__,__LINE__,_("Template file name is too long in parameter \"AuthUserTemplateFile\"\n"));
+                               exit(EXIT_FAILURE);
+                       }
+               }
+               return;
+       }
+
+       if (is_param("download_suffix",buf)) {
+               char warea[MAXLEN];
+
+               getparam_quoted("download_suffix",buf,warea,sizeof(warea));
+               set_download_suffix(warea);
+               return;
+       }
+
+       if (getparam_bool("graphs",buf,&Graphs)>0) {
+#ifndef HAVE_GD
+               if (Graphs)
+                       debugaz(__FILE__,__LINE__,_("No graphs available as sarg was not compiled with libgd. Set \"graphs\" to \"no\" in %s to disable this warning\n"),
+                               ConfigFile);
+#endif
+               return;
+       }
+
+       if (getparam_string("graph_days_bytes_bar_color",buf,GraphDaysBytesBarColor,sizeof(GraphDaysBytesBarColor))>0) return;
+
+       if (getparam_string("redirector_log_format",buf,RedirectorLogFormat,sizeof(RedirectorLogFormat))>0) return;
+       if (getparam_string("squidguard_log_format",buf,RedirectorLogFormat,sizeof(RedirectorLogFormat))>0) {
+               debuga(__FILE__,__LINE__,_("squidguard_log_format is deprecated and has been replaced by redirector_log_format. Please update your configuration file.\n"));
+               return;
+       }
+
+       if (getparam_bool("redirector_filter_out_date",buf,&RedirectorFilterOutDate)>0) return;
+       if (getparam_bool("redirector_ignore_date",buf,&RedirectorFilterOutDate)>0) {
+               /*
+               Due to an old bug in sarg before version 2.3, the option was having the opposite action than implied by the name.
+               */
+               debuga(__FILE__,__LINE__,_("redirector_ignore_date is deprecated and has been replaced by redirector_filter_out_date that does the action implied by its name as opposed to redirector_ignore_date. Please update your configuration file.\n"));
+               RedirectorFilterOutDate=!RedirectorFilterOutDate;
+               return;
+       }
+       if (getparam_bool("squidguard_ignore_date",buf,&RedirectorFilterOutDate)>0) {
+               debuga(__FILE__,__LINE__,_("squidguard_ignore_date is deprecated and has been replaced by redirector_filter_out_date that does the action implied by its name as opposed to squidguard_ignore_date. Please update your configuration file.\n"));
+               RedirectorFilterOutDate=!RedirectorFilterOutDate;
+               return;
+       }
+
+       if (getparam_bool("dansguardian_filter_out_date",buf,&DansguardianFilterOutDate)>0) return;
+       if (getparam_bool("dansguardian_ignore_date",buf,&DansguardianFilterOutDate)>0) {
+               debuga(__FILE__,__LINE__,_("dansguardian_ignore_date is deprecated and has been replaced by dansguardian_filter_out_date that does the action implied by its name as opposed to dansguardian_ignore_date. Please update your configuration file.\n"));
+               DansguardianFilterOutDate=!DansguardianFilterOutDate;
+               return;
+       }
+
+       if (getparam_string("ulimit",buf,Ulimit,sizeof(Ulimit))>0) return;
+
+       if (getparam_list("ntlm_user_format",SET_LIST(ntml_userformat_values),buf,&NtlmUserFormat)>0) return;
+
+       if (getparam_string("realtime_types",buf,RealtimeTypes,sizeof(RealtimeTypes))>0) return;
+
+       if (getparam_list("realtime_unauthenticated_records",SET_LIST(realtime_unauth_values),buf,&RealtimeUnauthRec)>0) return;
+
+       if (getparam_int("realtime_refresh_time",buf,&realtime_refresh)>0) return;
+
+       if (getparam_int("realtime_access_log_lines",buf,&realtime_access_log_lines)>0) return;
+
+       if (getparam_string("LDAPHost",buf,LDAPHost,sizeof(LDAPHost))>0) return;
+
+       if (getparam_int("LDAPPort",buf,&LDAPPort)>0) return;
+
+       if (getparam_int("LDAPProtocolVersion",buf,&LDAPProtocolVersion)>0) return;
+
+       if (getparam_string("LDAPBindDN",buf,LDAPBindDN,sizeof(LDAPBindDN))>0) return;
+
+       if (getparam_string("LDAPBindPW",buf,LDAPBindPW,sizeof(LDAPBindPW))>0) return;
+
+       if (getparam_string("LDAPBaseSearch",buf,LDAPBaseSearch,sizeof(LDAPBaseSearch))>0) return;
+
+       if (getparam_string("LDAPFilterSearch",buf,LDAPFilterSearch,sizeof(LDAPFilterSearch))>0) return;
+
+       if (getparam_string("LDAPTargetAttr",buf,LDAPTargetAttr,sizeof(LDAPTargetAttr))>0) return;
+
+       if (getparam_string("LDAPNativeCharset",buf,LDAPNativeCharset,sizeof(LDAPNativeCharset))>0) return;
+
+       if (getparam_string("graph_font",buf,GraphFont,sizeof(GraphFont))>0) return;
+
+       if (getparam_string("sorttable",buf,SortTableJs,sizeof(SortTableJs))>0) return;
+
+       if (getparam_string("hostalias",buf,HostAliasFile,sizeof(HostAliasFile))>0) return;
+
+       if (getparam_string("useralias",buf,UserAliasFile,sizeof(UserAliasFile))>0) return;
+
+       if (getparam_bool("keep_temp_log",buf,&KeepTempLog)>0) return;
+
+       if (getparam_int("max_successive_log_errors",buf,&NumLogSuccessiveErrors)>0) return;
+
+       if (getparam_int("max_total_log_errors",buf,&NumLogTotalErrors)>0) return;
+
+       if(strstr(buf,"squid24") != 0) {
+               squid24=true;
+               return;
+       }
+
+       if(strstr(buf,"byte_cost") != 0) {
+               getword_start(&gwarea,buf);
+               if (getword_multisep(wbuf,sizeof(wbuf),&gwarea,' ')<0) {
+                       debuga(__FILE__,__LINE__,_("The \"byte_cost\" parameter of the configuration file is invalid\n"));
+                       exit(EXIT_FAILURE);
+               }
+               cost=atol(gwarea.current);
+               if (getword_multisep(wbuf,sizeof(wbuf),&gwarea,' ')<0) {
+                       debuga(__FILE__,__LINE__,_("The \"byte_cost\" parameter of the configuration file is invalid\n"));
+                       exit(EXIT_FAILURE);
+               }
+               nocost=my_atoll(gwarea.current);
+               return;
+       }
+
+       if (getparam_string("image_dir",buf,ImageDir,sizeof(ImageDir))>0) return;
+
+       printf(_("SARG: Unknown option %s\n"),buf);
+}
+
+void getconf(void)
+{
+       FILE *fp_in;
+       char buf[MAXLEN];
 
-   while (fgets(buf, MAXLEN, fp_in) != NULL) {
-      if(strstr(buf,"\n") != 0)
-         buf[strlen(buf)-1]='\0';
+       if(debug)
+               debuga(__FILE__,__LINE__,_("Loading configuration from \"%s\"\n"),ConfigFile);
 
-      if(debugm)
-         printf("SYSCONFDIR %s",buf);
+       if ((fp_in = fopen(ConfigFile, "r")) == NULL) {
+               debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),ConfigFile,strerror(errno));
+               exit(EXIT_FAILURE);
+       }
 
-      if(strncmp(buf,"#",1) == 0 || strlen(buf) < 1)
-         continue;
+       while (fgets(buf, sizeof(buf), fp_in) != NULL) {
+               fixendofline(buf);
 
-      if(debugz)
-         printf("SARG: TAG: %s\n",buf);
+               if (debugz>=LogLevel_Data)
+                       printf("SYSCONFDIR %s\n",buf);
 
-      parmtest(buf);
+               parmtest(buf);
 
-   }
+       }
 
-   fclose(fp_in);
-   language_load(language);
-   return;
+       if (fclose(fp_in)==EOF) {
+               debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),ConfigFile,strerror(errno));
+               exit(EXIT_FAILURE);
+       }
+       return;
 }