- snprintf(base, sizeof (base), "%04d-%02d-%02d-serial-%03d-flight-%03d.%s",
- tm.tm_year + 1900,
- tm.tm_mon + 1,
- tm.tm_mday,
- serial,
- sequence,
- ext);
+ if (sequence)
+ snprintf(seq, sizeof(seq), "-seq-%03d", sequence);
+ else
+ seq[0] = '\0';
+
+ snprintf(base, sizeof (base), "%04d-%02d-%02d-serial-%03d-flight-%03d%s.%s",
+ tm.tm_year + 1900,
+ tm.tm_mon + 1,
+ tm.tm_mday,
+ serial,
+ flight,
+ seq,
+ ext);