This source file includes following definitions.
- xfreopen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 #include <config.h>
18 #include "xfreopen.h"
19
20 #include <errno.h>
21 #include "error.h"
22 #include "exitfail.h"
23 #include "quote.h"
24
25 #include "gettext.h"
26 #define _(msgid) gettext (msgid)
27
28 void
29 xfreopen (char const *filename, char const *mode, FILE *fp)
30 {
31 if (!freopen (filename, mode, fp))
32 {
33 char const *f = (filename ? filename
34 : (fp == stdin ? _("stdin")
35 : (fp == stdout ? _("stdout")
36 : (fp == stderr ? _("stderr")
37 : _("unknown stream")))));
38 error (exit_failure, errno, _("failed to reopen %s with mode %s"),
39 quote_n (0, f), quote_n (1, mode));
40 }
41 }