summaryrefslogtreecommitdiff
path: root/usr/src/cmd/print/bsd-sysv-commands
diff options
context:
space:
mode:
authorsonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>2009-03-20 00:14:19 -0700
committersonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>2009-03-20 00:14:19 -0700
commit3ac6dcfa0bf841831d4cfde190aa15173622957c (patch)
treee1413d9c6224d3cff08f93c686cd703635d68f92 /usr/src/cmd/print/bsd-sysv-commands
parent47cd5876b2168926dea28a62f1857b167da29d6c (diff)
downloadillumos-joyent-3ac6dcfa0bf841831d4cfde190aa15173622957c.tar.gz
6799466 lp issue: lpmove should give friendly message as previous version
Diffstat (limited to 'usr/src/cmd/print/bsd-sysv-commands')
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/lpmove.c96
1 files changed, 70 insertions, 26 deletions
diff --git a/usr/src/cmd/print/bsd-sysv-commands/lpmove.c b/usr/src/cmd/print/bsd-sysv-commands/lpmove.c
index cdd70cc11a..ef658d364b 100644
--- a/usr/src/cmd/print/bsd-sysv-commands/lpmove.c
+++ b/usr/src/cmd/print/bsd-sysv-commands/lpmove.c
@@ -123,35 +123,79 @@ main(int ac, char *av[])
destination);
status = papiPrinterDisable(svc, printer, message);
if (status != PAPI_OK) {
- fprintf(stderr, gettext("Disable %s: %s\n"),
- printer, verbose_papi_message(svc, status));
- exit_code = 1;
- } else
+ /*
+ * If the user is denied the permission
+ * to disable then return appropriate msg
+ */
+ char *result = NULL;
+
+ result = papiServiceGetStatusMessage(svc);
+
+ if (result != NULL) {
+ /*
+ * Check if user is denied
+ * the permission
+ */
+ if (strstr(result, "permission denied")
+ != NULL) {
+ /*
+ * user is denied
+ * permission
+ */
+ fprintf(stderr, gettext(
+ "UX:lpmove: ERROR:"\
+ " You aren't allowed"\
+ " to do that.\n\t"\
+ " TO FIX: You must"\
+ " be logged in as"\
+ " \"lp\" or \"root\".\n"));
+ exit_code = 1;
+ } else {
+ fprintf(stderr, gettext(
+ "Disable %s: %s\n"),
+ printer,
+ verbose_papi_message(
+ svc, status));
+ exit_code = 1;
+ }
+ } else {
+ fprintf(stderr, gettext(
+ "Disable %s: %s\n"),
+ printer,
+ verbose_papi_message(svc, status));
+ exit_code = 1;
+ }
+ } else {
printf(gettext(
- "destination %s is not accepting "
- "requests\n"), printer);
-
- status = papiPrinterListJobs(svc, printer, NULL,
- 0, 0, &jobs);
- if (status != PAPI_OK) {
- fprintf(stderr, gettext("Jobs %s: %s\n"),
- printer, verbose_papi_message(svc, status));
- exit_code = 1;
- }
-
- printf(gettext("move in progress ...\n"));
- while ((jobs != NULL) && (*jobs != NULL)) {
- id = papiJobGetId(*jobs++);
- if (move_job(svc, printer, id, destination) < 0)
+ "destination %s is not accepting"\
+ " requests\n"), printer);
+
+ status = papiPrinterListJobs(svc, printer, NULL,
+ 0, 0, &jobs);
+ if (status != PAPI_OK) {
+ fprintf(stderr, gettext("Jobs %s:"\
+ " %s\n"),
+ printer,
+ verbose_papi_message(svc, status));
exit_code = 1;
- else
- count++;
- }
- printf(gettext(
- "total of %d requests moved from %s to %s\n"),
- count, printer, destination);
+ }
+
+ printf(gettext("move in progress ...\n"));
+ while ((jobs != NULL) && (*jobs != NULL)) {
+ id = papiJobGetId(*jobs++);
+ if (move_job(svc, printer,
+ id, destination) < 0)
+ exit_code = 1;
+ else
+ count++;
+ }
+ printf(gettext(
+ "total of %d requests moved"\
+ " from %s to %s\n"),
+ count, printer, destination);
- papiJobListFree(jobs);
+ papiJobListFree(jobs);
+ }
}
papiServiceDestroy(svc);