X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=ao-tools%2Flib%2Fcc-log.c;h=f76743599a5ae7ce530545de58a3a1578078ba21;hp=dd8177f4d7ef33c2e6c230d4af0da54ac15f9404;hb=HEAD;hpb=35c54b3a278fa9bc2bc7f4b5ee04866697c93ba0 diff --git a/ao-tools/lib/cc-log.c b/ao-tools/lib/cc-log.c index dd8177f4..f7674359 100644 --- a/ao-tools/lib/cc-log.c +++ b/ao-tools/lib/cc-log.c @@ -3,7 +3,8 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -82,9 +83,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 +98,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)