int ranking, const char *which);
static int show_printers(const char *printers, int num_dests,
cups_dest_t *dests, int long_status);
-static void show_scheduler(void);
+static int show_scheduler(void);
static void usage(void) _CUPS_NORETURN;
case 'r' : /* Show scheduler status */
op = 'r';
- show_scheduler();
+ if (!show_scheduler())
+ return (0);
break;
case 's' : /* Show summary */
}
}
- show_scheduler();
+ if (!show_scheduler())
+ return (0);
+
show_default(cupsGetDest(NULL, NULL, num_dests, dests));
status |= show_classes(NULL);
status |= show_devices(NULL, num_dests, dests);
response = cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/");
- if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
- cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
+ if (cupsLastError() == IPP_STATUS_ERROR_SERVICE_UNAVAILABLE)
+ {
+ _cupsLangPrintf(stderr, _("%s: Scheduler is not running."), "lpstat");
+ ippDelete(response);
+ return (1);
+ }
+ else if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST || cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
{
_cupsLangPrintf(stderr,
_("%s: Error - add '/version=1.1' to server name."),
response = cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/");
+ if (cupsLastError() == IPP_STATUS_ERROR_SERVICE_UNAVAILABLE)
+ {
+ _cupsLangPrintf(stderr, _("%s: Scheduler is not running."), "lpstat");
+ ippDelete(response);
+ return (1);
+ }
if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
{
response = cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/");
+ if (cupsLastError() == IPP_STATUS_ERROR_SERVICE_UNAVAILABLE)
+ {
+ _cupsLangPrintf(stderr, _("%s: Scheduler is not running."), "lpstat");
+ ippDelete(response);
+ return (1);
+ }
if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
{
response = cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/");
+ if (cupsLastError() == IPP_STATUS_ERROR_SERVICE_UNAVAILABLE)
+ {
+ _cupsLangPrintf(stderr, _("%s: Scheduler is not running."), "lpstat");
+ ippDelete(response);
+ return (1);
+ }
if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
{
response = cupsDoRequest(CUPS_HTTP_DEFAULT, request, "/");
+ if (cupsLastError() == IPP_STATUS_ERROR_SERVICE_UNAVAILABLE)
+ {
+ _cupsLangPrintf(stderr, _("%s: Scheduler is not running."), "lpstat");
+ ippDelete(response);
+ return (1);
+ }
if (cupsLastError() == IPP_STATUS_ERROR_BAD_REQUEST ||
cupsLastError() == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED)
{
* 'show_scheduler()' - Show scheduler status.
*/
-static void
+static int /* 1 on success, 0 on failure */
show_scheduler(void)
{
http_t *http; /* Connection to server */
{
_cupsLangPuts(stdout, _("scheduler is running"));
httpClose(http);
+ return (1);
}
else
+ {
_cupsLangPuts(stdout, _("scheduler is not running"));
+ return (0);
+ }
}