/*
- * "$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
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 */
* 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...
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 */
/*
- * End of "$Id: langprintf.c 7802 2008-07-28 18:50:45Z mike $".
+ * End of "$Id$".
*/