--- /dev/null
-#endif /* !LOG_FILE_H */
+ /*
+ * Copyright (C) 2015 Alexandros Frantzis
+ * Author: Alexandros Frantzis <alexandros.frantzis@canonical.com>
+ *
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
+ * license.
+ */
+
+ #ifndef LOG_FILE_H_
+ #define LOG_FILE_H_
+
+ #include <glib.h>
+
+ #include "log-mode.h"
+
+ int log_file_open (const gchar *log_filename, LogMode log_mode);
+
++#endif /* LOG_FILE_H_ */
gboolean
seat_get_boolean_property (Seat *seat, const gchar *name)
{
- return g_strcmp0 (seat_get_string_property (seat, name), "true") == 0;
+ const gchar *value;
+ gint i, length = 0;
+
+ value = seat_get_string_property (seat, name);
+ if (!value)
+ return FALSE;
+
+ /* Count the number of non-whitespace characters */
+ for (i = 0; value[i]; i++)
+ if (!g_ascii_isspace (value[i]))
+ length = i + 1;
+
+ return strncmp (value, "true", MAX (length, 4)) == 0;
}
gint
log_filename = g_build_filename (log_dir, filename, NULL);
g_free (log_dir);
g_free (filename);
- session_set_log_file (session, log_filename);
+ session_set_log_file (session, log_filename, LOG_MODE_APPEND);
g_free (log_filename);
}