- now = time(NULL);
- (void) localtime_r(&now, &tm);
- aoview_mkdir(aoview_file_dir);
- for (;;) {
- snprintf(base, sizeof (base), "%04d-%02d-%02d-serial-%03d-flight-%03d.%s",
- tm.tm_year + 1900,
- tm.tm_mon + 1,
- tm.tm_mday,
- file->serial,
- file->sequence,
- file->ext);
- full = aoview_fullname(aoview_file_dir, base);
- r = access(full, F_OK);
- if (r < 0) {
- file->file = fopen(full, "w");
- if (!file->file) {
- aoview_file_open_failed(full);
- free(full);
- file->failed = 1;
- return FALSE;
- } else {
- setlinebuf(file->file);
- file->name = full;
- return TRUE;
- }
- }
+ full = cc_make_filename(file->serial, file->flight, file->ext);
+ file->file = fopen(full, "w");
+ if (!file->file) {
+ aoview_file_open_failed(full);