From 68f47b095684684e4247265e02ba8c0d12ba26b8 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 12 Jan 2011 14:52:11 -0800 Subject: [PATCH] move output logic to one function This is in preparation for colored output. Signed-off-by: Greg Kroah-Hartman --- bti.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/bti.c b/bti.c index a70443a..3938e0a 100644 --- a/bti.c +++ b/bti.c @@ -283,6 +283,16 @@ static CURL *curl_init(void) return curl; } +/* The final place data is sent to the screen/pty/tty */ +bti_output_line(struct session *session, xmlChar *user, xmlChar *id, + xmlChar *created, xmlChar *text) +{ + if (session->verbose) + printf("[%s] {%s} (%.16s) %s\n", user, id, created, text); + else + printf("[%s] %s\n", user, text); +} + static void parse_statuses(struct session *session, xmlDocPtr doc, xmlNodePtr current) { @@ -314,12 +324,7 @@ static void parse_statuses(struct session *session, } if (user && text && created && id) { - if (session->verbose) - printf("[%s] {%s} (%.16s) %s\n", - user, id, created, text); - else - printf("[%s] %s\n", - user, text); + bti_output_line(session, user, id, created, text); xmlFree(user); xmlFree(text); xmlFree(created); -- 2.39.5