X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fterminal%2Fmsg-ui.c;h=383ccb8cd35b112c35e1ea9f82ad39f4dfcb4aa2;hb=c0823c90e5209ed2bf60ed2785a480158ea75e8d;hp=173f60a7fa282e5dee213fb0211eb5cd7582ab63;hpb=610159421fde49f3f24622c60e193cf415086a64;p=pspp-builds.git diff --git a/src/ui/terminal/msg-ui.c b/src/ui/terminal/msg-ui.c index 173f60a7..383ccb8c 100644 --- a/src/ui/terminal/msg-ui.c +++ b/src/ui/terminal/msg-ui.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2010 Free Software Foundation, Inc. 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 @@ -18,20 +18,23 @@ #include "msg-ui.h" -#include "linebreak.h" -#include "localcharset.h" - -#include -#include #include +#include #include +#include #include #include -#include -#include +#include +#include + #include +#include #include #include +#include + +#include "unilbrk.h" +#include "localcharset.h" #include "gettext.h" #define _(msgid) gettext (msgid) @@ -89,14 +92,14 @@ check_msg_count (struct source_stream *ss) { if (!getl_is_interactive (ss)) { - if (get_errorbreak () && error_count) + if (settings_get_errorbreak () && error_count) msg (MN, _("Terminating execution of syntax file due to error.")); - else if (error_count > get_mxerrs() ) - msg (MN, _("Errors (%d) exceeds limit (%d)."), - error_count, get_mxerrs()); - else if (error_count + warning_count > get_mxwarns() ) + else if (error_count > settings_get_mxerrs () ) + msg (MN, _("Errors (%d) exceed limit (%d)."), + error_count, settings_get_mxerrs ()); + else if (error_count + warning_count > settings_get_mxwarns () ) msg (MN, _("Warnings (%d) exceed limit (%d)."), - error_count + warning_count, get_mxwarns() ); + error_count + warning_count, settings_get_mxwarns () ); else return; @@ -174,20 +177,21 @@ handle_msg (const struct msg *m) ds_put_cstr (&string, m->text); - if (msg_file != stdout || get_error_routing_to_terminal ()) - dump_message (ds_cstr (&string), get_viewwidth (), 8, + if (msg_file != stdout || settings_get_error_routing_to_terminal ()) + dump_message (ds_cstr (&string), + isatty (fileno (msg_file)) ? settings_get_viewwidth () : INT_MAX, 8, write_stream, msg_file); dump_message (ds_cstr (&string), 78, 0, write_journal, NULL); - if (get_error_routing_to_listing ()) + if (settings_get_error_routing_to_listing ()) { /* Disable screen output devices, because the error should already have been reported to the screen with the dump_message call above. */ - outp_enable_device (false, OUTP_DEV_SCREEN); + output_set_type_enabled (false, OUTPUT_DEVICE_SCREEN); tab_output_text (TAB_LEFT, ds_cstr (&string)); - outp_enable_device (true, OUTP_DEV_SCREEN); + output_set_type_enabled (true, OUTPUT_DEVICE_SCREEN); } ds_destroy (&string); @@ -222,7 +226,7 @@ dump_message (char *msg, unsigned width, unsigned indent, /* Break into lines. */ if (indent > width / 3) indent = width / 3; - mbs_width_linebreaks (string, length, + ulc_width_linebreaks (string, length, width - indent, -indent, 0, NULL, locale_charset (), breaks); @@ -265,7 +269,7 @@ write_stream (int line_indent, struct substring line, void *stream_) /* Writes LINE to the journal. */ static void -write_journal (int line_indent, struct substring line, void *unused UNUSED) +write_journal (int line_indent UNUSED, struct substring line, void *unused UNUSED) { char *s = xstrndup (ss_data (line), ss_length (line)); journal_write (true, s);