| 919 | } |
| 920 | |
| 921 | static void expand_filename_template(AVBPrint *bp, const char *template, |
| 922 | struct tm *tm) |
| 923 | { |
| 924 | int c; |
| 925 | |
| 926 | while ((c = *(template++))) { |
| 927 | if (c == '%') { |
| 928 | if (!(c = *(template++))) |
| 929 | break; |
| 930 | switch (c) { |
| 931 | case 'p': |
| 932 | av_bprintf(bp, "%s", program_name); |
| 933 | break; |
| 934 | case 't': |
| 935 | av_bprintf(bp, "%04d%02d%02d-%02d%02d%02d", |
| 936 | tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, |
| 937 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
| 938 | break; |
| 939 | case '%': |
| 940 | av_bprint_chars(bp, c, 1); |
| 941 | break; |
| 942 | } |
| 943 | } else { |
| 944 | av_bprint_chars(bp, c, 1); |
| 945 | } |
| 946 | } |
| 947 | } |
| 948 | |
| 949 | static int init_report(const char *env) |
| 950 | { |