summaryrefslogtreecommitdiff
path: root/ao-tools/lib
diff options
context:
space:
mode:
Diffstat (limited to 'ao-tools/lib')
-rw-r--r--ao-tools/lib/cc-log.c23
-rw-r--r--ao-tools/lib/cc.h2
2 files changed, 16 insertions, 9 deletions
diff --git a/ao-tools/lib/cc-log.c b/ao-tools/lib/cc-log.c
index dd8177f4..ed51f87e 100644
--- a/ao-tools/lib/cc-log.c
+++ b/ao-tools/lib/cc-log.c
@@ -82,9 +82,10 @@ cc_get_log_dir(void)
}
char *
-cc_make_filename(int serial, char *ext)
+cc_make_filename(int serial, int flight, char *ext)
{
char base[50];
+ char seq[20];
struct tm tm;
time_t now;
char *full;
@@ -96,13 +97,19 @@ cc_make_filename(int serial, char *ext)
cc_mkdir(cc_get_log_dir());
sequence = 0;
for (;;) {
- 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);
full = cc_fullname(cc_get_log_dir(), base);
r = access(full, F_OK);
if (r < 0)
diff --git a/ao-tools/lib/cc.h b/ao-tools/lib/cc.h
index 46b16a8e..ede46aa0 100644
--- a/ao-tools/lib/cc.h
+++ b/ao-tools/lib/cc.h
@@ -61,7 +61,7 @@ char *
cc_get_log_dir(void);
char *
-cc_make_filename(int serial, char *ext);
+cc_make_filename(int serial, int flight, char *ext);
/*
* For sequential data which are not evenly spaced