/*
* "lp" command for CUPS.
*
- * Copyright 2007-2016 by Apple Inc.
+ * Copyright 2007-2017 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
if (printer == NULL)
{
- val = NULL;
-
- if ((printer = getenv("LPDEST")) == NULL)
- {
- if ((printer = getenv("PRINTER")) != NULL)
- {
- if (!strcmp(printer, "lp"))
- printer = NULL;
- else
- val = "PRINTER";
- }
- }
- else
- val = "LPDEST";
-
- if (printer && !cupsGetNamedDest(NULL, printer, NULL))
- _cupsLangPrintf(stderr,
- _("%s: Error - %s environment variable names "
- "non-existent destination \"%s\"."), argv[0], val,
- printer);
- else if (cupsLastError() == IPP_NOT_FOUND)
- _cupsLangPrintf(stderr,
- _("%s: Error - no default destination available."),
- argv[0]);
+ if (!cupsGetNamedDest(NULL, NULL, NULL) && cupsLastError() == IPP_STATUS_ERROR_NOT_FOUND)
+ _cupsLangPrintf(stderr, _("%s: Error - %s"), argv[0], cupsLastErrorString());
else
- _cupsLangPrintf(stderr, _("%s: Error - scheduler not responding."),
- argv[0]);
+ _cupsLangPrintf(stderr, _("%s: Error - scheduler not responding."), argv[0]);
return (1);
}