(root)/
gettext-0.22.4/
libtextstyle/
lib/
misc.c
       1  /* Miscellaneous public API.
       2     Copyright (C) 2019, 2021 Free Software Foundation, Inc.
       3     Written by Bruno Haible <bruno@clisp.org>, 2019.
       4  
       5     This program is free software: you can redistribute it and/or modify
       6     it under the terms of the GNU General Public License as published by
       7     the Free Software Foundation; either version 3 of the License, or
       8     (at your option) any later version.
       9  
      10     This program is distributed in the hope that it will be useful,
      11     but WITHOUT ANY WARRANTY; without even the implied warranty of
      12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      13     GNU General Public License for more details.
      14  
      15     You should have received a copy of the GNU General Public License
      16     along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
      17  
      18  #include <config.h>
      19  
      20  /* Specification.  */
      21  #include "misc.h"
      22  
      23  #include "term-styled-ostream.h"
      24  #include "noop-styled-ostream.h"
      25  #include "fd-ostream.h"
      26  #include "exitfail.h"
      27  
      28  
      29  styled_ostream_t
      30  styled_ostream_create (int fd, const char *filename, ttyctl_t tty_control,
      31                         const char *css_filename)
      32  {
      33    styled_ostream_t stream;
      34  
      35    stream = term_styled_ostream_create (fd, filename, tty_control, css_filename);
      36    if (stream == NULL)
      37      stream =
      38        noop_styled_ostream_create (fd_ostream_create (fd, filename, true), true);
      39  
      40    return stream;
      41  }
      42  
      43  
      44  void
      45  libtextstyle_set_failure_exit_code (int exit_code)
      46  {
      47    exit_failure = exit_code;
      48  }