X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=server.c;h=6c2cbb8758bc5f98e12ca69198ebfb069c595e77;hp=b5063e2dfc2a7bd66c9b25836438e6c4677167c7;hb=173f53675e7763e0426c063eb5a90606786d25f4;hpb=abfb661f35e99e99c09a94d84839356d905af080 diff --git a/server.c b/server.c index b5063e2d..6c2cbb87 100644 --- a/server.c +++ b/server.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2014 Andre Noll + * Copyright (C) 1997 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -113,27 +113,17 @@ struct server_command_task { struct task *task; }; -static int want_colors(void) -{ - if (conf.color_arg == color_arg_no) - return 0; - if (conf.color_arg == color_arg_yes) - return 1; - if (conf.logfile_given) - return 0; - return isatty(STDERR_FILENO); -} - -static void init_colors_or_die(void) +/** + * Return the list of tasks for the server process. + * + * This is called from \a com_tasks(). The helper is necessary since command + * handlers can not access the scheduler structure directly. + * + * \return A dynamically allocated string that must be freed by the caller. + */ +char *server_get_tasks(void) { - int i; - - if (!want_colors()) - return; - daemon_set_flag(DF_COLOR_LOG); - daemon_set_default_log_colors(); - for (i = 0; i < conf.log_color_given; i++) - daemon_set_log_color_or_die(conf.log_color_arg[i]); + return get_task_list(&sched); } /* @@ -218,7 +208,9 @@ void parse_config_or_die(int override) daemon_set_logfile(conf.logfile_arg); daemon_open_log_or_die(); } - init_colors_or_die(); + + daemon_init_colors_or_die(conf.color_arg, color_arg_auto, color_arg_no, + conf.logfile_given, conf.log_color_arg, conf.log_color_given); daemon_set_flag(DF_LOG_PID); daemon_set_flag(DF_LOG_LL); daemon_set_flag(DF_LOG_TIME);