/*
- * Copyright (C) 1997-2014 Andre Noll <maan@tuebingen.mpg.de>
+ * Copyright (C) 1997 Andre Noll <maan@tuebingen.mpg.de>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
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);
}
/*
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);