Patch migrated from desktop gate, where it was listed as:
# date:2009-12-04 owner:yippi type:bug bugzilla:25436
diff --git a/tools/ck-history.c b/tools/ck-history.c
index 606106c..e7659d1 100644
@@ -60,6 +60,8 @@ typedef enum {
#define DEFAULT_LOG_FILENAME LOCALSTATEDIR "/log/ConsoleKit/history"
#define MAX_LINE_LEN 2048
+#define IS_STR_SET(x) (x != NULL && x[0] != '\0')
+
static GList *all_events = NULL;
static gboolean
@@ -515,21 +517,21 @@ print_last_report_record (GList *list,
if (legacy_compat) {
g_string_printf (str,
- "%-8.8s %-12.12s %-16.16s %-16.16s",
- username,
- utline != NULL ? utline : "",
- host != NULL ? host : "",
- addedtime);
+ "%s\t%s\t%s\t%s",
+ IS_STR_SET (username) ? username : "NULL",
+ IS_STR_SET (utline) ? utline : "NULL",
+ IS_STR_SET (host) ? host : "NULL",
+ IS_STR_SET (addedtime) ? addedtime : "NULL");
} else {
g_string_printf (str,
- "%-8.8s %12s %-10.10s %-7.7s %-12.12s %-28.28s %-16.16s",
- username,
- session_type,
- session_id,
- seat_id,
- utline,
- host != NULL ? host : "",
- addedtime);
+ "%s\t%s\t%s\t%s\t%s\t%s\t%s",
+ IS_STR_SET (username) ? username : "NULL",
+ IS_STR_SET (session_type) ? session_type : "NULL",
+ IS_STR_SET (session_id) ? session_id : "NULL",
+ IS_STR_SET (seat_id) ? seat_id : "NULL",
+ IS_STR_SET (utline) ? utline : "NULL",
+ IS_STR_SET (host) ? host : "NULL",
+ IS_STR_SET (addedtime) ? addedtime : "NULL");
}
g_free (username);
@@ -576,9 +578,9 @@ print_last_report_record (GList *list,
}
g_string_append_printf (str,
- " %-7.7s %-12.12s",
- removedtime,
- duration);
+ "\t%s\t%s",
+ IS_STR_SET (removedtime) ? removedtime : "NULL",
+ IS_STR_SET (duration) ? duration : "NULL");
g_print ("%s\n", str->str);
g_string_free (str, TRUE);