Error message if printing fails

This commit is contained in:
Jim Monte 2020-04-25 19:06:48 +02:00 committed by Holger Vogt
parent e3441044dd
commit 1e938f91b1
1 changed files with 18 additions and 6 deletions

View File

@ -188,9 +188,15 @@ void com_hardcopy(wordlist *wl)
if (!cp_getvar("lprplot5", CP_STRING, format, sizeof(format))) if (!cp_getvar("lprplot5", CP_STRING, format, sizeof(format)))
strcpy(format, SYSTEM_PLOT5LPR); strcpy(format, SYSTEM_PLOT5LPR);
(void) sprintf(buf, format, device, fname); (void) sprintf(buf, format, device, fname);
fprintf(cp_out, "Printing %s on the %s printer.\n", fname, device); if (system(buf) == -1) {
(void) system(buf); fprintf(cp_out, "Printing %s on the %s printer failed.\n",
printed = 1; fname, device);
}
else {
fprintf(cp_out, "Printing %s on the %s printer OK.\n",
fname, device);
printed = 1;
}
} }
#endif #endif
#ifdef SYSTEM_PSLPR #ifdef SYSTEM_PSLPR
@ -199,9 +205,15 @@ void com_hardcopy(wordlist *wl)
if (!cp_getvar("lprps", CP_STRING, format, sizeof(format))) if (!cp_getvar("lprps", CP_STRING, format, sizeof(format)))
strcpy(format, SYSTEM_PSLPR); strcpy(format, SYSTEM_PSLPR);
(void) sprintf(buf, format, device, fname); (void) sprintf(buf, format, device, fname);
fprintf(cp_out, "Printing %s on the %s printer.\n", fname, device); if (system(buf) == -1) {
(void) system(buf); fprintf(cp_out, "Printing %s on the %s printer failed.\n",
printed = 1; fname, device);
}
else {
fprintf(cp_out, "Printing %s on the %s printer OK.\n",
fname, device);
printed = 1;
}
} }
#endif #endif
} }