Skip to content
Snippets Groups Projects
Commit 847a2378 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Add parse_cstats() function

parent 6e9fee01
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
......@@ -293,6 +293,20 @@ BOOL fwrite_cstats(FILE* fp, const stats_t* stats)
return fprintf(fp, "%.*s\n", (int)(sizeof(pad) - (len + 1)), pad) > 0;
}
void parse_cstats(str_list_t record, stats_t* stats)
{
stats->ltoday = strtoul(record[CSTATS_LOGONS], NULL, 10);
stats->ttoday = strtoul(record[CSTATS_TIMEON], NULL, 10);
stats->nusers = strtoul(record[CSTATS_NUSERS], NULL, 10);
stats->ftoday = strtoul(record[CSTATS_FBACKS], NULL, 10);
stats->etoday = strtoul(record[CSTATS_EMAIL], NULL, 10);
stats->ptoday = strtoul(record[CSTATS_POSTS], NULL, 10);
stats->uls = strtoul(record[CSTATS_UPLOADS], NULL, 10);
stats->ulb = strtoull(record[CSTATS_UPLOADB], NULL, 10);
stats->dls = strtoul(record[CSTATS_DNLOADS], NULL, 10);
stats->dlb = strtoull(record[CSTATS_DNLOADB], NULL, 10);
}
/****************************************************************************/
/* Returns the number of files in the directory 'dirnum' */
/****************************************************************************/
......
......@@ -37,6 +37,7 @@ DLLEXPORT BOOL fclose_dstats(FILE*);
DLLEXPORT BOOL fread_dstats(FILE*, stats_t*);
DLLEXPORT BOOL fwrite_dstats(FILE*, const stats_t*);
DLLEXPORT BOOL fwrite_cstats(FILE*, const stats_t*);
DLLEXPORT void parse_cstats(str_list_t, stats_t*);
DLLEXPORT BOOL getstats(scfg_t*, uint node, stats_t*);
DLLEXPORT BOOL putstats(scfg_t*, uint node, const stats_t*);
DLLEXPORT ulong getposts(scfg_t*, uint subnum);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment