s3:winbindd:cache: fix offline logons with cached credentials (bug #9321)
[Samba/gebeck_regimport.git] / lib / util / dprintf.c
blob90ca36c1ae5a1f3f592b280cd8dfa925587b820a
1 /*
2 Unix SMB/CIFS implementation.
3 display print functions
4 Copyright (C) Andrew Tridgell 2001
5 Copyright (C) Jelmer Vernooij 2007
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 this module provides functions for printing internal strings in the
24 "display charset".
26 This charset may be quite different from the chosen unix charset.
28 Eventually these functions will need to take care of column count constraints
30 The d_ prefix on print functions in Samba refers to the display character set
31 conversion
34 #include "includes.h"
35 #include "system/locale.h"
37 static int d_vfprintf(FILE *f, const char *format, va_list ap)
39 return vfprintf(f, format, ap);
43 _PUBLIC_ int d_fprintf(FILE *f, const char *format, ...)
45 int ret;
46 va_list ap;
48 va_start(ap, format);
49 ret = d_vfprintf(f, format, ap);
50 va_end(ap);
52 return ret;
55 static FILE *outfile;
57 _PUBLIC_ int d_printf(const char *format, ...)
59 int ret;
60 va_list ap;
62 if (!outfile) outfile = stdout;
64 va_start(ap, format);
65 ret = d_vfprintf(outfile, format, ap);
66 va_end(ap);
68 return ret;
71 /* interactive programs need a way of tell d_*() to write to stderr instead
72 of stdout */
73 void display_set_stderr(void)
75 outfile = stderr;