]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/langprintf.c
Fix compile error.
[thirdparty/cups.git] / cups / langprintf.c
index c8a680c39b42ecb0da9e788176d3deb0991c75a7..f63a473f70e2f32c7b8f64b954279b352b681e8c 100644 (file)
@@ -1,9 +1,9 @@
 /*
- * "$Id: langprintf.c 7802 2008-07-28 18:50:45Z mike $"
+ * "$Id$"
  *
  *   Localized printf/puts functions for CUPS.
  *
- *   Copyright 2007-2010 by Apple Inc.
+ *   Copyright 2007-2012 by Apple Inc.
  *   Copyright 2002-2007 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -42,6 +42,7 @@ _cupsLangPrintError(const char *prefix,       /* I - Non-localized message prefix */
   int          bytes;                  /* Number of bytes formatted */
   int          last_errno;             /* Last error */
   char         buffer[2048],           /* Message buffer */
+               *bufptr,                /* Pointer into buffer */
                output[8192];           /* Output buffer */
   _cups_globals_t *cg;                 /* Global data */
 
@@ -72,8 +73,19 @@ _cupsLangPrintError(const char *prefix,      /* I - Non-localized message prefix */
   * Format the message...
   */
 
-  snprintf(buffer, sizeof(buffer), "%s%s: %s\n", prefix ? prefix : "",
+  if (prefix)
+  {
+    snprintf(buffer, sizeof(buffer), "%s:", prefix);
+    bufptr = buffer + strlen(buffer);
+  }
+  else
+    bufptr = buffer;
+
+  snprintf(bufptr, sizeof(buffer) - (bufptr - buffer),
+          /* TRANSLATORS: Message is "subject: error" */
+          _cupsLangString(cg->lang_default, _("%s: %s")),
           _cupsLangString(cg->lang_default, message), strerror(last_errno));
+  strlcat(buffer, "\n", sizeof(buffer));
 
  /*
   * Convert and write to stderr...
@@ -292,7 +304,7 @@ _cupsSetLocale(char *argv[])                /* IO - Command-line arguments */
     strlcpy(charset, ".UTF-8", sizeof(new_lc_time) - (charset - new_lc_time));
   }
   else
-    strcpy(new_lc_time, "C");
+    strlcpy(new_lc_time, "C", sizeof(new_lc_time));
 
   setlocale(LC_TIME, new_lc_time);
 #endif /* LC_TIME */
@@ -336,5 +348,5 @@ _cupsSetLocale(char *argv[])                /* IO - Command-line arguments */
 
 
 /*
- * End of "$Id: langprintf.c 7802 2008-07-28 18:50:45Z mike $".
+ * End of "$Id$".
  */