void log_init(byte *argv0);
void log_file(byte *name);
void log_fork(void);
-void log_switch(void);
+int log_switch(void);
void assert_failed(char *assertion, char *file, int line) NONRET;
void assert_failed_noinfo(void) NONRET;
/*
* UCW Library -- Keeping of Log Files
*
- * (c) 1997--2004 Martin Mares <mj@ucw.cz>
+ * (c) 1997--2005 Martin Mares <mj@ucw.cz>
*
* This software may be freely distributed and used according to the terms
* of the GNU Lesser General Public License.
static int log_filename_size;
int log_switch_nest;
-static void
+static int
do_log_switch(struct tm *tm)
{
int fd, l;
char name[log_filename_size];
+ int switched = 0;
if (!log_name_patt ||
log_filename[0] && !log_params)
- return;
+ return 0;
log_switch_nest++;
l = strftime(name, log_filename_size, log_name_patt, tm);
if (l < 0 || l >= log_filename_size)
close(fd);
close(1);
dup(2);
+ switched = 1;
}
log_switch_nest--;
+ return switched;
}
-void
+int
log_switch(void)
{
time_t tim = time(NULL);
- do_log_switch(localtime(&tim));
+ return do_log_switch(localtime(&tim));
}
static void