summaryrefslogtreecommitdiff
path: root/usr/src/cmd/print/bsd-sysv-commands/enable.c
diff options
context:
space:
mode:
authorGowtham Thommandra <Gowtham.Thommandra@Sun.COM>2009-04-16 12:29:02 +0530
committerGowtham Thommandra <Gowtham.Thommandra@Sun.COM>2009-04-16 12:29:02 +0530
commit98f04078d5fc5800e80b21e0b18abe0024af1cbe (patch)
treecc0a3ec30ce5dfe5d659364868690b9a43366c5b /usr/src/cmd/print/bsd-sysv-commands/enable.c
parentc3c82186300a3bf11cfdda43b1cca3cd6b333629 (diff)
downloadillumos-joyent-98f04078d5fc5800e80b21e0b18abe0024af1cbe.tar.gz
6739383 print commands accept, reject, disable enable don't report status after execution.
Diffstat (limited to 'usr/src/cmd/print/bsd-sysv-commands/enable.c')
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/enable.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/usr/src/cmd/print/bsd-sysv-commands/enable.c b/usr/src/cmd/print/bsd-sysv-commands/enable.c
index 1bf7a0ccce..f67ace102c 100644
--- a/usr/src/cmd/print/bsd-sysv-commands/enable.c
+++ b/usr/src/cmd/print/bsd-sysv-commands/enable.c
@@ -20,14 +20,13 @@
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
*/
/* $Id: enable.c 146 2006-03-24 00:26:54Z njacobs $ */
-#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
@@ -49,8 +48,8 @@ usage(char *program)
name++;
fprintf(stdout,
- gettext("Usage: %s destination ...\n"),
- name);
+ gettext("Usage: %s destination ...\n"),
+ name);
exit(1);
}
@@ -82,18 +81,26 @@ main(int ac, char *av[])
char *printer = av[c];
status = papiServiceCreate(&svc, printer, NULL, NULL,
- cli_auth_callback, encryption, NULL);
+ cli_auth_callback, encryption, NULL);
if (status != PAPI_OK) {
fprintf(stderr, gettext(
- "Failed to contact service for %s: %s\n"),
- printer, verbose_papi_message(svc, status));
+ "Failed to contact service for %s: %s\n"),
+ printer, verbose_papi_message(svc, status));
exit_status = 1;
}
status = papiPrinterEnable(svc, printer);
- if (status != PAPI_OK) {
+ if (status == PAPI_OK) {
+ printf(gettext("printer \"%s\" now enabled\n"),
+ printer);
+ } else if (status == PAPI_NOT_ACCEPTING) {
+ fprintf(stderr, gettext(
+ "Destination \"%s\" was already enabled.\n"),
+ printer);
+ exit_status = 1;
+ } else {
fprintf(stderr, gettext("enable: %s: %s\n"), printer,
- verbose_papi_message(svc, status));
+ verbose_papi_message(svc, status));
exit_status = 1;
}