From: Frédéric Marchal Date: Sun, 26 Aug 2012 17:35:01 +0000 (+0200) Subject: Remove trailing spaces in every source file X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bd43d81faa4dbf3000558431dc94b1d69dc6e636;p=thirdparty%2Fsarg.git Remove trailing spaces in every source file --- diff --git a/authfail.c b/authfail.c index 5250796..26fc449 100644 --- a/authfail.c +++ b/authfail.c @@ -50,7 +50,7 @@ void authfail_open(void) if (debugz) debugaz(_("Authentication failure report not produced because privacy option is active\n")); return; } - + snprintf(authfail_unsort,sizeof(authfail_unsort),"%s/authfail.int_unsort",tmp); if ((fp_authfail=MY_FOPEN(authfail_unsort,"w"))==NULL) { debuga(_("(log) Cannot open file: %s - %s\n"),authfail_unsort,strerror(errno)); @@ -67,7 +67,7 @@ Write one entry in the unsorted authentication file file provided that it is req void authfail_write(const struct ReadLogStruct *log_entry) { char date[80]; - + if (fp_authfail && (strstr(log_entry->HttpCode,"DENIED/401") != 0 || strstr(log_entry->HttpCode,"DENIED/407") != 0)) { strftime(date,sizeof(date),"%d/%m/%Y\t%H:%M:%S",&log_entry->EntryTime); fprintf(fp_authfail, "%s\t%s\t%s\t%s\n",date,log_entry->User,log_entry->Ip,log_entry->Url); diff --git a/css.c b/css.c index ecfe09d..34793fb 100644 --- a/css.c +++ b/css.c @@ -67,7 +67,7 @@ void css_content(FILE *fp_css) fprintf(fp_css,".link a:link,a:visited {font-family:%s;font-size:%s;color:#0000FF;text-decoration:none;}\n", FontFace, FontSize); fprintf(fp_css,"a > img {border:none;}\n"); - + fputs(".warn {margin:0.5em;}\n",fp_css); fprintf(fp_css,".warn > span {padding:0.5em;border:2px solid black;background-color:orange;font-family:%s;font-size:%s;}\n",FontFace,FontSize); diff --git a/denied.c b/denied.c index 67fd177..08a0913 100644 --- a/denied.c +++ b/denied.c @@ -50,7 +50,7 @@ void denied_open(void) if (debugz) debugaz(_("Denied report not produced because privacy option is active\n")); return; } - + snprintf(denied_unsort,sizeof(denied_unsort),"%s/denied.int_unsort",tmp); if ((fp_denied=MY_FOPEN(denied_unsort,"w"))==NULL) { debuga(_("(log) Cannot open file: %s - %s\n"),denied_unsort,strerror(errno)); @@ -67,7 +67,7 @@ Write one entry in the unsorted denied file provided that it is required. void denied_write(const struct ReadLogStruct *log_entry) { char date[80]; - + if (fp_denied && strstr(log_entry->HttpCode,"DENIED/403") != 0) { strftime(date,sizeof(date),"%d/%m/%Y\t%H:%M:%S",&log_entry->EntryTime); fprintf(fp_denied, "%s\t%s\t%s\t%s\n",date,log_entry->User,log_entry->Ip,log_entry->Url); diff --git a/dichotomic.c b/dichotomic.c index b58f0ca..0d3fee7 100644 --- a/dichotomic.c +++ b/dichotomic.c @@ -61,7 +61,7 @@ to Dichotomic_Destroy(). DichotomicObject Dichotomic_Create(void) { DichotomicObject Obj; - + Obj=malloc(sizeof(*Obj)); if (!Obj) { @@ -83,7 +83,7 @@ void Dichotomic_Destroy(DichotomicObject *ObjPtr) { DichotomicObject Obj; int i; - + if (!ObjPtr || !*ObjPtr) return; Obj=*ObjPtr; *ObjPtr=NULL; @@ -104,7 +104,7 @@ static int Dichotomic_FindKeyPos(DichotomicObject Obj,const char *key,bool *Foun int down,up; int middle=0; int cmp=0; - + down=0; up=Obj->NItems-1; while (up>=down) @@ -141,7 +141,7 @@ bool Dichotomic_Insert(DichotomicObject Obj,const char *key, const char *value) int Position; bool Found; int i; - + if (!Obj) return(false); if (Obj->Items) { @@ -150,7 +150,7 @@ bool Dichotomic_Insert(DichotomicObject Obj,const char *key, const char *value) } else Position=0; - + if (Obj->NItems>=Obj->NAllocated) { struct DichotomicItemStruct *Items; @@ -163,7 +163,7 @@ bool Dichotomic_Insert(DichotomicObject Obj,const char *key, const char *value) } Obj->Items=Items; } - + for (i=Obj->NItems ; i>Position ; i--) { Obj->Items[i].Key=Obj->Items[i-1].Key; @@ -177,7 +177,7 @@ bool Dichotomic_Insert(DichotomicObject Obj,const char *key, const char *value) exit(EXIT_FAILURE); } Obj->NItems++; - + return(true); } @@ -193,7 +193,7 @@ const char *Dichotomic_Search(DichotomicObject Obj,const char *key) { int Position; bool Found; - + if (!Obj) return(NULL); if (Obj->NItems==0 || !Obj->Items) return(NULL); Position=Dichotomic_FindKeyPos(Obj,key,&Found); diff --git a/download.c b/download.c index d914782..0da4e5c 100644 --- a/download.c +++ b/download.c @@ -58,7 +58,7 @@ static void download_sort(const char *report_in) int clen; char csort[MAXLEN]; int cstatus; - + clen=snprintf(csort,sizeof(csort),"sort -T \"%s\" -t \"\t\" -k 3,3 -k 1,1 -k 2,2 -k 5,5 -o \"%s\" \"%s/download.int_unsort\"", tmp, report_in, tmp); if (clen>=sizeof(csort)) { diff --git a/ip2name.c b/ip2name.c index 3f6b3e5..e06179b 100644 --- a/ip2name.c +++ b/ip2name.c @@ -62,9 +62,9 @@ static void ip2name_chainmodule(struct Ip2NameProcess *Module) { struct Ip2NameProcess *Chain; struct Ip2NameProcess *Last; - + if (debug) debuga(_("Chaining IP resolving module \"%s\"\n"),Module->Name); - + Last=NULL; for (Chain=FirstModule ; Chain ; Chain=Chain->Next) { if (Chain==Module) { @@ -73,7 +73,7 @@ static void ip2name_chainmodule(struct Ip2NameProcess *Module) } Last=Chain; } - + if (Last) Last->Next=Module; else { @@ -92,7 +92,7 @@ static void ip2name_buildmoduleslist(const char *list) const char *candidate; int length; int ModuleIdx; - + while (*list) { candidate=list; while (*candidate && (unsigned char)*candidate<=' ') candidate++; @@ -123,7 +123,7 @@ static void ip2name_configmodule(const char *module) { int length; unsigned int ModuleIdx; - + for (length=0 ; module[length] && (unsigned char)module[length]>' ' ; length++); for (ModuleIdx=0 ; ModuleIdxNext) { @@ -219,7 +219,7 @@ void ip2name(char *ip,int ip_len) enum ip2name_retcode Status; const char *Name; char OrigIp[80]; - + if (!KnownIp) { KnownIp=Dichotomic_Create(); if (!KnownIp) { @@ -227,13 +227,13 @@ void ip2name(char *ip,int ip_len) exit(EXIT_FAILURE); } } - + Name=Dichotomic_Search(KnownIp,ip); if (Name) { safe_strcpy(ip,Name,ip_len); return; } - + safe_strcpy(OrigIp,ip,sizeof(OrigIp)); for (Module=FirstModule ; Module ; Module=Module->Next) { if (Module->Resolve) { diff --git a/ip2name_exec.c b/ip2name_exec.c index 30b237a..b9fcbdd 100644 --- a/ip2name_exec.c +++ b/ip2name_exec.c @@ -55,7 +55,7 @@ file. static void ip2name_execconfig(const char *name,const char *param) { int len; - + len=strlen(param); if (len>=sizeof(ExecCmd)) { debuga(_("Command to execute to resolve the IP addresses is too long (maximum is %d bytes)\n"),(int)sizeof(ExecCmd)); @@ -81,12 +81,12 @@ static enum ip2name_retcode ip2name_exec(char *ip,int ip_len) FILE *cmd_in; char buffer[512]; size_t nread; - + if (ExecCmd[0]=='\0') { debuga(_("No command to run to resolve an IP address. Please configure it in sarg.conf\n")); exit(EXIT_FAILURE); } - + j=0; len=strlen(ip); for (i=0 ; iElapsedTime=0L; @@ -90,22 +90,22 @@ static enum ReadLogReturnCodeEnum Squid_ReadEntry(char *Line,struct ReadLogStruc Entry->DataSize=0LL; while (isdigit(*Line)) Entry->DataSize=Entry->DataSize*10+(*Line++-'0'); if (*Line!=' ' || Begin==Line) return(RLRC_Unknown); - + // skip the HTTP function Begin=++Line; while (*Line && *Line!=' ') Line++; if (*Line!=' '|| Line==Begin) return(RLRC_Unknown); - + // the url Entry->Url=++Line; for (UrlLen=0 ; *Line && *Line!=' ' ; UrlLen++) Line++; if (*Line!=' ' || UrlLen==0) return(RLRC_Unknown); - + // the ID of the user or - if the user is unidentified Entry->User=++Line; for (UserLen=0 ; *Line && *Line!=' ' ; UserLen++) Line++; if (*Line!=' ' || UserLen==0) return(RLRC_Unknown); - + // now, the format is known with a good confidence. If the time doesn't decode, it is an error. tt=localtime(&log_time); if (tt==NULL) { @@ -113,13 +113,13 @@ static enum ReadLogReturnCodeEnum Squid_ReadEntry(char *Line,struct ReadLogStruc return(RLRC_InternalError); } memcpy(&Entry->EntryTime,tt,sizeof(struct tm)); - + // it is safe to alter the line buffer now that we are returning a valid entry Entry->Ip[IpLen]='\0'; Entry->HttpCode[HttpCodeLen]='\0'; Entry->Url[UrlLen]='\0'; Entry->User[UserLen]='\0'; - + return(RLRC_NoError); } diff --git a/realtime.c b/realtime.c index 43f8110..373f61e 100755 --- a/realtime.c +++ b/realtime.c @@ -268,7 +268,7 @@ static void datashow(const char *tmp) strftime(tbuf, sizeof(tbuf), "%Y-%m-%d %H:%M", t); else if (df=='e') strftime(tbuf, sizeof(tbuf), "%d-%m-%Y %H:%M", t); - + printf("%s%s%s%s%s\n",tbuf,ip,name,typ,url,url); strcpy(ouser,user); diff --git a/redirector.c b/redirector.c index 14643b1..d52c05d 100644 --- a/redirector.c +++ b/redirector.c @@ -562,14 +562,14 @@ void redirector_report(void) show_ignored_redirector(fp_ou,count-SquidGuardReportLimit); fputs("\n",fp_ou); - + if (RedirectorErrors>0) { fputs("
",fp_ou); fprintf(fp_ou,ngettext("%d error found in the log file. Some entries may be missing.","%d errors found in the log file. Some entries may be missing.",RedirectorErrors),RedirectorErrors); fputs("
\n",fp_ou); } - + fputs("\n",fp_ou); if (write_html_trailer(fp_ou)<0) debuga(_("Write error in file %s\n"),report); diff --git a/report.c b/report.c index 0ff997b..67bc5f9 100644 --- a/report.c +++ b/report.c @@ -110,7 +110,7 @@ void gerarel(void) daystat=NULL; else daystat=day_prepare(); - + uscan=userinfo_startscan(); if (uscan == NULL) { debuga(_("Cannot enumerate the user list\n")); @@ -371,7 +371,7 @@ void gerarel(void) siteuser(); else if (debugz) debugaz(_("Sites & users report not requested in report_type\n")); - + if ((ReportType & REPORT_TYPE_DENIED) != 0) gen_denied_report(); else if (debugz) diff --git a/siteuser.c b/siteuser.c index 2780431..58d195f 100644 --- a/siteuser.c +++ b/siteuser.c @@ -141,7 +141,7 @@ void siteuser(void) } } strcpy(ourl,item.url); - + if(BlockIt[0]!='\0' && ourl[0]!=ALIAS_PREFIX) { fprintf(fp_ou,"
Next) { @@ -264,7 +264,7 @@ static int Alias_StoreName(const char *name,const char *next) } new_alias->Alias=tmp; } - + new_alias->Next=NULL; if (prev_alias) prev_alias->Next=new_alias; @@ -344,7 +344,7 @@ static int Alias_StoreIpv4(unsigned char *ipv4,int nbits,const char *next) sprintf(tmp,"%c%d.%d.%d.%d/%d",ALIAS_PREFIX,ipv4[0],ipv4[1],ipv4[2],ipv4[3],nbits); new_alias->Alias=tmp; } - + if (prev_alias) { new_alias->Next=prev_alias->Next; prev_alias->Next=new_alias; @@ -426,7 +426,7 @@ static int Alias_StoreIpv6(unsigned short *ipv6,int nbits,const char *next) sprintf(tmp,"%c%x:%x:%x:%x:%x:%x:%x:%x/%d",ALIAS_PREFIX,ipv6[0],ipv6[1],ipv6[2],ipv6[3],ipv6[4],ipv6[5],ipv6[6],ipv6[7],nbits); new_alias->Alias=tmp; } - + if (prev_alias) { new_alias->Next=prev_alias->Next; prev_alias->Next=new_alias; @@ -458,7 +458,7 @@ static int Alias_StoreRegexp(char *buf) int len; char *tmp; int i; - + // find the pattern Delimiter=*buf++; for (End=buf ; *End && *End!=Delimiter ; End++) { @@ -475,12 +475,12 @@ static int Alias_StoreRegexp(char *buf) return(-1); } *End++='\0'; - + // find the alias for (Replace=End ; *Replace==' ' || *Replace=='\t' ; Replace++); for (End=Replace ; *End && (unsigned char)*End>' ' ; End++); *End='\0'; - + // store it new_alias=malloc(sizeof(*new_alias)); if (!new_alias) { @@ -505,7 +505,7 @@ static int Alias_StoreRegexp(char *buf) memcpy(tmp+1,Replace,len); tmp[len+1]='\0'; new_alias->Alias=tmp; - + new_alias->SubPartern=false; for (i=1 ; tmp[i] ; i++) // both the sed \1 and the perl $1 replacement operators are accepted @@ -513,13 +513,13 @@ static int Alias_StoreRegexp(char *buf) new_alias->SubPartern=true; break; } - + // chain it prev_alias=&FirstAliasRe; for (alias=FirstAliasRe ; alias ; alias=alias->Next) prev_alias=&alias->Next; *prev_alias=new_alias; - + return(1); } #endif @@ -541,7 +541,7 @@ static int Alias_Store(char *buf) int nbits; const char *next; int Error; - + if (strncasecmp(buf,"re:",3)==0) { #ifdef USE_PCRE if (Alias_StoreRegexp(buf+3)<0) @@ -585,7 +585,7 @@ void read_hostalias(const char *Filename) debuga(_("Cannot read host name alias file \"%s\" - %s\n"),Filename,strerror(errno)); exit(EXIT_FAILURE); } - + if ((line=longline_create())==NULL) { debuga(_("Not enough memory to read the host name aliases\n")); exit(EXIT_FAILURE); @@ -597,10 +597,10 @@ void read_hostalias(const char *Filename) exit(EXIT_FAILURE); } } - + longline_destroy(&line); fclose(fi); - + if (debug) { struct hostalias_name *alias1; struct hostalias_ipv4 *alias4; @@ -633,7 +633,7 @@ void free_hostalias(void) { struct hostalias_name *alias1; struct hostalias_name *next1; - + for (alias1=FirstAliasName ; alias1 ; alias1=next1) { next1=alias1->Next; if (alias1->HostName_Prefix) free((void *)alias1->HostName_Prefix); @@ -646,7 +646,7 @@ void free_hostalias(void) { struct hostalias_ipv4 *alias4; struct hostalias_ipv4 *next4; - + for (alias4=FirstAliasIpv4 ; alias4 ; alias4=next4) { next4=alias4->Next; free((void *)alias4->Alias); @@ -657,7 +657,7 @@ void free_hostalias(void) { struct hostalias_ipv6 *alias6; struct hostalias_ipv6 *next6; - + for (alias6=FirstAliasIpv6 ; alias6 ; alias6=next6) { next6=alias6->Next; free((void *)alias6->Alias); @@ -669,7 +669,7 @@ void free_hostalias(void) { struct hostalias_regex *alias; struct hostalias_regex *next; - + for (alias=FirstAliasRe ; alias ; alias=next) { next=alias->Next; pcre_free(alias->Re); @@ -728,7 +728,7 @@ static const char *alias_url_ipv4(const char *url,unsigned char *ipv4) int len; for (alias=FirstAliasIpv4 ; alias ; alias=alias->Next) { - len=alias->NBits; + len=alias->NBits; if ((len<8 || memcmp(ipv4,alias->Ip,len/8)==0) && ((len%8)==0 || (ipv4[len/8] ^ alias->Ip[len/8]) & (0xFFU<<(8-len%8)))==0) { return(alias->Alias); } @@ -837,7 +837,7 @@ Find the beginning of the URL beyond the scheme:// const char *skip_scheme(const char *url) { const char *str; - + /* Skip any scheme:// at the beginning of the URL (see rfc2396 section 3.1). The underscore is not part of the standard but is found in the squid logs as cache_object://. diff --git a/util.c b/util.c index 70cba41..5e5b885 100644 --- a/util.c +++ b/util.c @@ -1964,7 +1964,7 @@ void emptytmpdir(const char *dir) dirp=opendir(dir); if (!dirp) return; - + // make sure the temporary directory contains only our files while ((direntp = readdir(dirp)) != NULL) { if (direntp->d_name[0] == '.' && (direntp->d_name[1] == '\0' || @@ -1983,12 +1983,12 @@ void emptytmpdir(const char *dir) "directory or manually delete the content of \"%s\"\n"),direntp->d_name,dir,dir); exit(EXIT_FAILURE); } - + if (snprintf(dname,sizeof(dname),"%s/%s",dir,direntp->d_name)>=sizeof(dname)) { debuga(_("directory name to delete too long: %s/%s\n"),dir,direntp->d_name); exit(EXIT_FAILURE); } - + #ifdef HAVE_LSTAT err=lstat(dname,&st); #else @@ -2025,7 +2025,7 @@ void emptytmpdir(const char *dir) "directory or manually delete the content of \"%s\"\n"),direntp->d_name,dir,dir); exit(EXIT_FAILURE); } - + if (snprintf(dname,sizeof(dname),"%s/%s",dir,direntp->d_name)>=sizeof(dname)) { debuga(_("directory name to delete too long: %s/%s\n"),dir,direntp->d_name); exit(EXIT_FAILURE); @@ -2086,7 +2086,7 @@ int extract_address_mask(const char *buf,const char **text,unsigned char *ipv4,u // skip leading spaces and tabs while (*buf && (*buf==' ' || *buf=='\t')) buf++; - + // find out the nature of the pattern ip_size=0x60 | 0x04; if (*buf=='[') {