commit - 16d61a8bc15dd706c6e8ca85bbbbd91d774352ce
commit + 2b3466ac63a61e9a06a891d6c0a7035091c29fed
blob - 06592cc7ce5929a7df8bf32faa36911dd43489e1
blob + 09fe357a632814fc40360bc88b81b9dae4a0075e
--- FICS/comproc.c
+++ FICS/comproc.c
char count[10] = { '\0' };
char junk[MAX_LINE_SIZE] = { '\0' };
char *junkp;
+ const char *v_scan_fmt = "%" SCNd64 " " "%9s";
int64_t lval;
time_t crtime;
return;
if (fgets(junk, sizeof junk, fp) == NULL || feof(fp) ||
- sscanf(junk, "%" SCNd64 " " "%9s", &lval, count) != 2)
+ sscanf(junk, v_scan_fmt, &lval, count) != 2)
return;
rscan_news2(fp, p, num - 1);
char filename[MAX_FILENAME_SIZE] = { '\0' };
char junk[MAX_LINE_SIZE] = { '\0' };
char *junkp = NULL;
+ const char *v_scan_fmt = "%" SCNd64 " " "%9s";
int found = 0;
int64_t lval = 0;
time_t crtime = 0;
return COM_OK;
}
-#define SCAN_JUNK ("%" SCNd64 " " "%9s")
_Static_assert(9 < ARRAY_SIZE(count), "'count' too small");
if (param[0].type == 0) {
pprintf(p, "Index of recent news items:\n");
if (fgets(junk, sizeof junk, fp) == NULL ||
- sscanf(junk, SCAN_JUNK, &lval, count) != 2) {
+ sscanf(junk, v_scan_fmt, &lval, count) != 2) {
warnx("%s: error: fgets() or sscanf()", __func__);
fclose(fp);
return COM_FAILED;
pprintf(p, "Index of all news items:\n");
if (fgets(junk, sizeof junk, fp) == NULL ||
- sscanf(junk, SCAN_JUNK, &lval, count) != 2) {
+ sscanf(junk, v_scan_fmt, &lval, count) != 2) {
warnx("%s: error: fgets() or sscanf()", __func__);
fclose(fp);
return COM_FAILED;
if (fgets(junk, sizeof junk, fp) == NULL || feof(fp))
break;
- if (sscanf(junkp, SCAN_JUNK, &lval, count) != 2)
+ if (sscanf(junkp, v_scan_fmt, &lval, count) != 2)
warnx("%s: sscanf() error...", __func__);
crtime = lval;