* gnulib-local/lib/fd-styled-ostream.oo.h: New file.
* gnulib-local/lib/fd-styled-ostream.oo.c: New file.
* gnulib-local/modules/fd-styled-ostream: New file.
* gnulib-local/Makefile.am (EXTRA_DIST): Add them.
lib/exitfail.h.diff \
lib/fd-ostream.oo.c \
lib/fd-ostream.oo.h \
+lib/fd-styled-ostream.oo.c \
+lib/fd-styled-ostream.oo.h \
lib/file-ostream.oo.c \
lib/file-ostream.oo.h \
lib/fnmatch.c.diff \
modules/closeout \
modules/error-progname \
modules/fd-ostream \
+modules/fd-styled-ostream \
modules/file-ostream \
modules/fnmatch.diff \
modules/gettext-runtime-misc \
--- /dev/null
+/* Output stream with no-op styling, referring to a file descriptor.
+ Copyright (C) 2006, 2019 Free Software Foundation, Inc.
+ Written by Bruno Haible <bruno@clisp.org>, 2019.
+
+ 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
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include "fd-styled-ostream.h"
+
+#include "fd-ostream.h"
+
+#include "xalloc.h"
+
+
+struct fd_styled_ostream : struct styled_ostream
+{
+fields:
+ /* The destination stream. */
+ fd_ostream_t destination;
+};
+
+/* Implementation of ostream_t methods. */
+
+static void
+fd_styled_ostream::write_mem (fd_styled_ostream_t stream,
+ const void *data, size_t len)
+{
+ fd_ostream_write_mem (stream->destination, data, len);
+}
+
+static void
+fd_styled_ostream::flush (fd_styled_ostream_t stream)
+{
+ fd_ostream_flush (stream->destination);
+}
+
+static void
+fd_styled_ostream::free (fd_styled_ostream_t stream)
+{
+ fd_ostream_free (stream->destination);
+ free (stream);
+}
+
+/* Implementation of styled_ostream_t methods. */
+
+static void
+fd_styled_ostream::begin_use_class (fd_styled_ostream_t stream,
+ const char *classname)
+{
+}
+
+static void
+fd_styled_ostream::end_use_class (fd_styled_ostream_t stream,
+ const char *classname)
+{
+}
+
+/* Constructor. */
+
+fd_styled_ostream_t
+fd_styled_ostream_create (int fd, const char *filename)
+{
+ fd_styled_ostream_t stream =
+ XMALLOC (struct fd_styled_ostream_representation);
+
+ stream->base.base.vtable = &fd_styled_ostream_vtable;
+ stream->destination = fd_ostream_create (fd, filename, true);
+
+ return stream;
+}
--- /dev/null
+/* Output stream with no-op styling, referring to a file descriptor.
+ Copyright (C) 2006, 2019 Free Software Foundation, Inc.
+ Written by Bruno Haible <bruno@clisp.org>, 2019.
+
+ 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
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
+
+#ifndef _FD_STYLED_OSTREAM_H
+#define _FD_STYLED_OSTREAM_H
+
+#include "styled-ostream.h"
+
+
+struct fd_styled_ostream : struct styled_ostream
+{
+methods:
+};
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Create an output stream referring to the file descriptor FD, that supports
+ the styling operations as no-ops.
+ FILENAME is used only for error messages.
+ Note that the resulting stream must be closed before FD can be closed. */
+extern fd_styled_ostream_t
+ fd_styled_ostream_create (int fd, const char *filename);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _FD_STYLED_OSTREAM_H */
--- /dev/null
+Description:
+Output stream with no-op styling, referring to a file descriptor.
+
+Files:
+lib/fd-styled-ostream.oo.h
+lib/fd-styled-ostream.oo.c
+
+Depends-on:
+styled-ostream
+fd-ostream
+xalloc
+
+configure.ac:
+
+Makefile.am:
+if !WOE32DLL
+lib_SOURCES += fd-styled-ostream.c
+else
+lib_SOURCES += ../woe32dll/c++fd-styled-ostream.cc
+endif
+# This is a Makefile rule that generates multiple files at once; see the
+# automake documentation, node "Multiple Outputs", for details.
+fd-styled-ostream.h : $(top_srcdir)/build-aux/moopp fd-styled-ostream.oo.h fd-styled-ostream.oo.c styled-ostream.oo.h ostream.oo.h
+ $(top_srcdir)/build-aux/moopp $(MOOPPFLAGS) $(srcdir)/fd-styled-ostream.oo.c $(srcdir)/fd-styled-ostream.oo.h $(srcdir)/styled-ostream.oo.h $(srcdir)/ostream.oo.h
+fd-styled-ostream.c fd_styled_ostream.priv.h fd_styled_ostream.vt.h : fd-styled-ostream.h
+ @test -f $@ || { \
+ trap 'rm -rf fd-styled-ostream.lock' 1 2 13 15; \
+ if mkdir fd-styled-ostream.lock 2>/dev/null; then \
+ echo "$(top_srcdir)/build-aux/moopp $(MOOPPFLAGS) $(srcdir)/fd-styled-ostream.oo.c $(srcdir)/fd-styled-ostream.oo.h $(srcdir)/styled-ostream.oo.h $(srcdir)/ostream.oo.h"; \
+ $(top_srcdir)/build-aux/moopp $(MOOPPFLAGS) $(srcdir)/fd-styled-ostream.oo.c $(srcdir)/fd-styled-ostream.oo.h $(srcdir)/styled-ostream.oo.h $(srcdir)/ostream.oo.h; \
+ result=$$?; rm -rf fd-styled-ostream.lock; exit $$result; \
+ else \
+ while test -d fd-styled-ostream.lock; do sleep 1; done; \
+ test -f $(srcdir)/fd-styled-ostream.h; \
+ fi; \
+ }
+BUILT_SOURCES += fd-styled-ostream.h fd-styled-ostream.c fd_styled_ostream.priv.h fd_styled_ostream.vt.h
+MAINTAINERCLEANFILES += fd-styled-ostream.h fd-styled-ostream.c fd_styled_ostream.priv.h fd_styled_ostream.vt.h
+EXTRA_DIST += fd-styled-ostream.h fd-styled-ostream.c fd_styled_ostream.priv.h fd_styled_ostream.vt.h
+
+Include:
+"fd-styled-ostream.h"
+
+License:
+GPL
+
+Maintainer:
+Bruno Haible
+