From 1e938f91b1f6db6e5877bb0074e70f694e90f937 Mon Sep 17 00:00:00 2001 From: Jim Monte Date: Sat, 25 Apr 2020 19:06:48 +0200 Subject: [PATCH] Error message if printing fails --- src/frontend/com_hardcopy.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/frontend/com_hardcopy.c b/src/frontend/com_hardcopy.c index 2a7cba1a8..a9c7e61fb 100644 --- a/src/frontend/com_hardcopy.c +++ b/src/frontend/com_hardcopy.c @@ -188,9 +188,15 @@ void com_hardcopy(wordlist *wl) if (!cp_getvar("lprplot5", CP_STRING, format, sizeof(format))) strcpy(format, SYSTEM_PLOT5LPR); (void) sprintf(buf, format, device, fname); - fprintf(cp_out, "Printing %s on the %s printer.\n", fname, device); - (void) system(buf); - printed = 1; + if (system(buf) == -1) { + fprintf(cp_out, "Printing %s on the %s printer failed.\n", + fname, device); + } + else { + fprintf(cp_out, "Printing %s on the %s printer OK.\n", + fname, device); + printed = 1; + } } #endif #ifdef SYSTEM_PSLPR @@ -199,9 +205,15 @@ void com_hardcopy(wordlist *wl) if (!cp_getvar("lprps", CP_STRING, format, sizeof(format))) strcpy(format, SYSTEM_PSLPR); (void) sprintf(buf, format, device, fname); - fprintf(cp_out, "Printing %s on the %s printer.\n", fname, device); - (void) system(buf); - printed = 1; + if (system(buf) == -1) { + fprintf(cp_out, "Printing %s on the %s printer failed.\n", + fname, device); + } + else { + fprintf(cp_out, "Printing %s on the %s printer OK.\n", + fname, device); + printed = 1; + } } #endif }