-wday_t day_of_week(year_t year, month_t month, day_t day)
-{
- static int tmp[] = {0, 3, 2, 5, 0, 3,
- 5, 1, 4, 6, 2, 4};
- if (month < 3)
- year--;
- int start = year + year / 4
- - year / 100
- + year / 400
- + tmp[month];
- return (start + day) % 7;
+ /* Log to standard out */
+ if (output_fd) {
+ va_copy(tmp, ap);
+ fprintf(output_fd, "%s: ", prefix);
+ vfprintf(output_fd, fmt, tmp);
+ fprintf(output_fd, "\n");
+ fflush(output_fd);
+ }
+
+ /* Log to debug file */
+ if (debug_fd) {
+ va_copy(tmp, ap);
+ fprintf(debug_fd, "%s: ", prefix);
+ vfprintf(debug_fd, fmt, tmp);
+ fprintf(debug_fd, "\n");
+ fflush(debug_fd);
+ }
+
+ /* Log to status bar */
+ if (&view_debug) {
+ va_copy(tmp, ap);
+ view_debug(fmt, tmp);
+ }