Implement new functions for printf, fprintf and fputs for use in
command line programs.

* subversion/include/svn_cmdline.h:
* subversion/libsvn_subr/cmdline.c:
  (svn_cmdline_printf, svn_cmdline_fprintf, svn_cmdline_fputs):
  New functions.

Index: subversion/include/svn_cmdline.h
===================================================================
--- subversion/include/svn_cmdline.h	(revision 9652)
+++ subversion/include/svn_cmdline.h	(arbetskopia)
@@ -74,6 +74,35 @@
                                                      const char *src,
                                                      apr_pool_t *pool);
 
+/** Write to stdout, using a printf-like format string @a fmt, passed
+ * through @c apr_pvsprintf.  All string arguments are in UTF-8; the output
+ * is converted to the output encoding.  Use @a pool for temporary
+ * allocation.
+ */
+
+svn_error_t *svn_cmdline_printf (apr_pool_t *pool,
+                                 const char *fmt,
+                                 ...);
+
+/** Write to the stdio @a stream, using a printf-like format string @a fmt,
+ * passed through @c apr_pvsprintf.  All string arguments are in UTF-8;
+ * the output is converted to the output encoding.  Use @a pool for
+ * temporary allocation.
+ */
+
+svn_error_t *svn_cmdline_fprintf (FILE *stream,
+                                  apr_pool_t *pool,
+                                  const char *fmt,
+                                  ...);
+
+/** Output the @a string to the stdio @a stream, converting from UTF-8
+ * to the output encoding.  Use @a pool for temporary allocation.
+ */
+
+svn_error_t *svn_cmdline_fputs (const char *string,
+                                FILE *stream,
+                                apr_pool_t *pool);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
Index: subversion/libsvn_subr/cmdline.c
===================================================================
--- subversion/libsvn_subr/cmdline.c	(revision 9652)
+++ subversion/libsvn_subr/cmdline.c	(arbetskopia)
@@ -217,3 +217,49 @@
                                         svn_path_local_style (src, pool),
                                         pool);
 }
+
+svn_error_t *
+svn_cmdline_printf (apr_pool_t *pool, const char *fmt, ...)
+{
+  const char *message;
+  va_list ap;
+
+  va_start (ap, fmt);
+  message = apr_pvsprintf (pool, fmt, ap);
+  va_end (ap);
+
+  return svn_cmdline_fputs(message, stdout, pool);
+}
+
+
+svn_error_t *
+svn_cmdline_fprintf (FILE *stream, apr_pool_t *pool, const char *fmt, ...)
+{
+  const char *message;
+  va_list ap;
+
+  va_start (ap, fmt);
+  message = apr_pvsprintf (pool, fmt, ap);
+  va_end (ap);
+
+  return svn_cmdline_fputs(message, stream, pool);
+}
+
+svn_error_t *
+svn_cmdline_fputs (const char *string, FILE* stream, apr_pool_t *pool)
+{
+  svn_error_t *err;
+  const char *out;
+
+  err = svn_cmdline_cstring_from_utf8 (&out, string, pool);
+
+  if (err)
+    {
+      svn_error_clear (err);
+      out = svn_cmdline_cstring_from_utf8_fuzzy (string, pool);
+    }
+
+  fputs (out, stream);
+
+  return SVN_NO_ERROR;
+}
