return;
}
- if (getparam_string("lastlog",buf,LastLog,sizeof(LastLog))>0) return;
+ if (getparam_int("lastlog",buf,&LastLog)>0) return;
if (getparam_bool("remove_temp_files",buf,&RemoveTempFiles)>0) return;
int cstatus;
struct getwordstruct gwarea;
- if(strcmp(LastLog,"0") == 0)
+ if(LastLog <= 0)
return;
sprintf(temp,"%slastlog1",outdir);
unlink(temp);
- if(ftot<=atoi(LastLog)) {
+ if(ftot<=LastLog) {
sprintf(temp,"%slastlog",outdir);
if(access(temp, R_OK) == 0)
unlink(temp);
return;
}
- ftot-=atoi(LastLog);
+ ftot-=LastLog;
sprintf(temp,"%slastlog",outdir);
if((fp_in=fopen(temp,"r"))==NULL) {
char buf[MAXLEN];
char wdir[MAXLEN];
char warea[MAXLEN];
+ char sep;
long long int med=0;
long long int wtuser=0;
long long int twork=0;
struct getwordstruct gwarea;
+ twork=0;
+ tbytes[0]='\0';
+ media[0]='\0';
+
sprintf(wdir,"%s%s/sarg-general",dirname,name);
if ((fp_in = fopen(wdir, "r")) == 0) {
sprintf(wdir,"%s%s/general",dirname,name);
if ((fp_in = fopen(wdir, "r")) == 0) {
- tbytes[0]='\0';
- media[0]='\0';
return;
}
}
while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
+ if (strncmp(buf,"TOTAL\t",6) == 0)
+ sep='\t'; //new file
+ else if (strncmp(buf,"TOTAL ",6) == 0)
+ sep=' '; //old file
+ else
+ continue;
getword_start(&gwarea,buf);
- if (getword(warea,sizeof(warea),&gwarea,'\t')<0) {
+ if (getword(warea,sizeof(warea),&gwarea,sep)<0) {
printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",wdir);
exit(1);
}
if(strcmp(warea,"TOTAL") != 0)
continue;
- if (getword_skip(MAXLEN,&gwarea,'\t')<0) {
+ if (getword_skip(MAXLEN,&gwarea,sep)<0) {
printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",wdir);
exit(1);
}
- if (getword_atoll(&twork,&gwarea,'\t')<0) {
+ if (getword_atoll(&twork,&gwarea,sep)<0) {
printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",wdir);
exit(1);
}
fclose(fp_in);
wtuser=my_atoll(tuser);
- if(wtuser == 0) {
+ if(wtuser <= 0) {
strcpy(media,"0");
return;
}
exit(1);
}
} else if (S_ISDIR(st.st_mode)) {
- unlinkdir(dname,1);
+ unlinkdir(dname,0);
} else {
fprintf(stderr,"SARG: unknown path type %s\n",dname);
}