xref: /dflybsd-src/contrib/grep/lib/xbinary-io.c (revision 91b9ed38d3db6a8a8ac5b66da1d43e6e331e259a)
1*09d4459fSDaniel Fojt /* Binary mode I/O with checking
2*09d4459fSDaniel Fojt    Copyright 2017-2020 Free Software Foundation, Inc.
3*09d4459fSDaniel Fojt 
4*09d4459fSDaniel Fojt    This program is free software: you can redistribute it and/or modify
5*09d4459fSDaniel Fojt    it under the terms of the GNU General Public License as published by
6*09d4459fSDaniel Fojt    the Free Software Foundation; either version 3 of the License, or
7*09d4459fSDaniel Fojt    (at your option) any later version.
8*09d4459fSDaniel Fojt 
9*09d4459fSDaniel Fojt    This program is distributed in the hope that it will be useful,
10*09d4459fSDaniel Fojt    but WITHOUT ANY WARRANTY; without even the implied warranty of
11*09d4459fSDaniel Fojt    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12*09d4459fSDaniel Fojt    GNU General Public License for more details.
13*09d4459fSDaniel Fojt 
14*09d4459fSDaniel Fojt    You should have received a copy of the GNU General Public License
15*09d4459fSDaniel Fojt    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
16*09d4459fSDaniel Fojt 
17*09d4459fSDaniel Fojt #include <config.h>
18*09d4459fSDaniel Fojt 
19*09d4459fSDaniel Fojt #define XBINARY_IO_INLINE _GL_EXTERN_INLINE
20*09d4459fSDaniel Fojt #include "xbinary-io.h"
21*09d4459fSDaniel Fojt 
22*09d4459fSDaniel Fojt #include <errno.h>
23*09d4459fSDaniel Fojt #include <error.h>
24*09d4459fSDaniel Fojt #include <stdbool.h>
25*09d4459fSDaniel Fojt #include "exitfail.h"
26*09d4459fSDaniel Fojt #include "verify.h"
27*09d4459fSDaniel Fojt 
28*09d4459fSDaniel Fojt #include "gettext.h"
29*09d4459fSDaniel Fojt #define _(msgid) gettext (msgid)
30*09d4459fSDaniel Fojt 
31*09d4459fSDaniel Fojt #if O_BINARY
32*09d4459fSDaniel Fojt 
33*09d4459fSDaniel Fojt _Noreturn void
xset_binary_mode_error(void)34*09d4459fSDaniel Fojt xset_binary_mode_error (void)
35*09d4459fSDaniel Fojt {
36*09d4459fSDaniel Fojt   error (exit_failure, errno,
37*09d4459fSDaniel Fojt          _("failed to set file descriptor text/binary mode"));
38*09d4459fSDaniel Fojt   assume (false);
39*09d4459fSDaniel Fojt }
40*09d4459fSDaniel Fojt 
41*09d4459fSDaniel Fojt #endif
42