]> ToastFreeware Gitweb - gregoa/bti.git/blobdiff - bti.c
rewrite the config parser
[gregoa/bti.git] / bti.c
diff --git a/bti.c b/bti.c
index a70443a5431a636050d9a9cbbd45a9e716bd97ce..f6479f86c50299bf8a5eb32173008be29f572c14 100644 (file)
--- a/bti.c
+++ b/bti.c
@@ -52,7 +52,7 @@
        } while (0)
 
 
-static int debug;
+int debug;
 
 static void display_help(void)
 {
@@ -283,6 +283,16 @@ static CURL *curl_init(void)
        return curl;
 }
 
+/* The final place data is sent to the screen/pty/tty */
+void 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);