| 91 | |
| 92 | |
| 93 | unsigned char * dologname (unsigned char *buf, unsigned char *name, const unsigned char *ext, ROTATION lt, time_t t) { |
| 94 | struct tm *ts; |
| 95 | |
| 96 | ts = localtime(&t); |
| 97 | if(strchr((char *)name, '%')){ |
| 98 | struct clientparam fakecli; |
| 99 | |
| 100 | memset(&fakecli, 0, sizeof(fakecli)); |
| 101 | dobuf2(&fakecli, buf, NULL, NULL, ts, (char *)name); |
| 102 | } |
| 103 | else switch(lt){ |
| 104 | case NONE: |
| 105 | sprintf((char *)buf, "%s", name); |
| 106 | break; |
| 107 | case ANNUALLY: |
| 108 | sprintf((char *)buf, "%s.%04d", name, ts->tm_year+1900); |
| 109 | break; |
| 110 | case MONTHLY: |
| 111 | sprintf((char *)buf, "%s.%04d.%02d", name, ts->tm_year+1900, ts->tm_mon+1); |
| 112 | break; |
| 113 | case WEEKLY: |
| 114 | t = t - (ts->tm_wday * (60*60*24)); |
| 115 | ts = localtime(&t); |
| 116 | sprintf((char *)buf, "%s.%04d.%02d.%02d", name, ts->tm_year+1900, ts->tm_mon+1, ts->tm_mday); |
| 117 | break; |
| 118 | case DAILY: |
| 119 | sprintf((char *)buf, "%s.%04d.%02d.%02d", name, ts->tm_year+1900, ts->tm_mon+1, ts->tm_mday); |
| 120 | break; |
| 121 | case HOURLY: |
| 122 | sprintf((char *)buf, "%s.%04d.%02d.%02d-%02d", name, ts->tm_year+1900, ts->tm_mon+1, ts->tm_mday, ts->tm_hour); |
| 123 | break; |
| 124 | case MINUTELY: |
| 125 | sprintf((char *)buf, "%s.%04d.%02d.%02d-%02d.%02d", name, ts->tm_year+1900, ts->tm_mon+1, ts->tm_mday, ts->tm_hour, ts->tm_min); |
| 126 | break; |
| 127 | default: |
| 128 | break; |
| 129 | } |
| 130 | if(ext){ |
| 131 | strcat((char *)buf, "."); |
| 132 | strcat((char *)buf, (char *)ext); |
| 133 | } |
| 134 | return buf; |
| 135 | } |
| 136 | |
| 137 | int start_proxy_thread(struct child * chp){ |
| 138 | pthread_t thread; |
no test coverage detected