- sprintf(print_buffer,
- /* enable lower case letters */
- "%c"
- /* Transaction-ID (Anzahl verkaufter Einträge, inklusive des zu druckenden!)
- -- 5-stellig */
- "[%3u] "
- /* Uhrzeit -- 8-stellig */
- "%8s - "
- /* Eintragname (= Getränk) -- 9-stellig */
- "%-" xstr(MAX_ITEM_NAME_LENGTH) "s - "
- /* Preis (in Cents) -- 7-stellig */
- "%" xstr(sizeof(price) - 1) "s - "
- /* restguthaben (7-stellig) */
- "%" xstr(sizeof(rest) - 1) "s - "
- /* Anzahl -- 2-stellig */
- "%2d - "
- /* Nickname (falls es vom Guthaben abgezogen wird) -- 10-stellig */
- "an %" xstr(NICKNAME_MAX_LEN)"s\r",
- 17, status.transaction_id, time, name, price, rest, einheiten,
- (*nickname != '\0' ? nickname : "Unbekannt"));
+ n = snprintf(print_buffer, sizeof(print_buffer),
+ /* enable lower case letters -- 1 */
+ "%c"
+ /* Transaction-ID (Anzahl verkaufter Einträge, inklusive des zu druckenden!)
+ -- 6-stellig */
+ "[%3u] "
+ /* Uhrzeit -- 8-stellig + 3 */
+ "%8s - "
+ /* Eintragname (= Getränk) -- 9-stellig + 3 */
+ "%-" xstr(MAX_ITEM_NAME_LENGTH) "s - "
+ /* Preis (in Cents) -- 7-stellig + 3 */
+ "%" xstr(EUR_FORMAT_MINLEN) "s - "
+ /* restguthaben (7-stellig) + 3 */
+ "%" xstr(EUR_FORMAT_MINLEN) "s - "
+ /* Anzahl -- 2-stellig + 3 */
+ "%2d - "
+ /* Nickname (falls es vom Guthaben abgezogen wird) -- 10-stellig + 4 */
+ "an %" xstr(NICKNAME_MAX_LEN)"s\r",
+ 17, status.transaction_id, time, name, price, rest, einheiten,
+ (*nickname != '\0' ? nickname : "Unbekannt"));