From 847c497d84366caaae4e575a7cb700a5f092279d Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" Date: Sun, 30 Nov 2014 21:10:26 +0100 Subject: ui: make ui_output() take a formatted string - minor cleanup in logging - use ui_output() for interactive output - avoid using re_printf() - stdio: added an output_handler (to stderr) --- modules/menu/menu.c | 8 ++++---- modules/mwi/mwi.c | 4 ++-- modules/quicktime/quicktime.c | 5 +---- modules/stdio/stdio.c | 9 ++++++++- 4 files changed, 15 insertions(+), 11 deletions(-) (limited to 'modules') diff --git a/modules/menu/menu.c b/modules/menu/menu.c index 9701515..32512ef 100644 --- a/modules/menu/menu.c +++ b/modules/menu/menu.c @@ -47,10 +47,10 @@ static void check_registrations(void) n = list_count(uag_list()); /* We are ready */ - (void)re_printf("\x1b[32mAll %u useragent%s registered successfully!" - " (%u ms)\x1b[;m\n", - n, n==1 ? "" : "s", - (uint32_t)(tmr_jiffies() - start_ticks)); + ui_output("\x1b[32mAll %u useragent%s registered successfully!" + " (%u ms)\x1b[;m\n", + n, n==1 ? "" : "s", + (uint32_t)(tmr_jiffies() - start_ticks)); ual_ready = true; } diff --git a/modules/mwi/mwi.c b/modules/mwi/mwi.c index 9bea26a..a04e6bf 100644 --- a/modules/mwi/mwi.c +++ b/modules/mwi/mwi.c @@ -41,8 +41,8 @@ static void notify_handler(struct sip *sip, const struct sip_msg *msg, struct mwi *mwi = arg; if (mbuf_get_left(msg->mb)) { - re_printf("----- MWI for %s -----\n", ua_aor(mwi->ua)); - re_printf("%b\n", mbuf_buf(msg->mb), mbuf_get_left(msg->mb)); + ui_output("----- MWI for %s -----\n", ua_aor(mwi->ua)); + ui_output("%b\n", mbuf_buf(msg->mb), mbuf_get_left(msg->mb)); } (void)sip_treply(NULL, sip, msg, 200, "OK"); diff --git a/modules/quicktime/quicktime.c b/modules/quicktime/quicktime.c index 5aa6bd9..84fab4b 100644 --- a/modules/quicktime/quicktime.c +++ b/modules/quicktime/quicktime.c @@ -94,7 +94,7 @@ static OSErr frame_handler(SGChannel c, Ptr p, long len, long *offset, result = SGGetChannelSampleDescription(c,(Handle)imageDesc); if (result != noErr) { - re_printf("GetChanSampDesc: %d\n", result); + warning("quicktime: GetChanSampDesc: %d\n", result); DisposeHandle((Handle)imageDesc); return noErr; } @@ -192,9 +192,6 @@ static int alloc(struct vidsrc_st **stp, struct vidsrc *vs, (void)dev; (void)errorh; - re_printf("quicktime alloc: %u x %u fps=%d\n", - prm->size.w, prm->size.h, prm->fps); - st = mem_zalloc(sizeof(*st), destructor); if (!st) return ENOMEM; diff --git a/modules/stdio/stdio.c b/modules/stdio/stdio.c index 244dc01..3121322 100644 --- a/modules/stdio/stdio.c +++ b/modules/stdio/stdio.c @@ -150,8 +150,15 @@ static int ui_alloc(struct ui_st **stp) } +static int output_handler(const char *str) +{ + return print_handler(str, str_len(str), NULL); +} + + static struct ui ui_stdio = { - .name = "stdio" + .name = "stdio", + .outputh = output_handler }; -- cgit v1.2.1