summaryrefslogtreecommitdiff
path: root/usr/src/cmd/print/bsd-sysv-commands
diff options
context:
space:
mode:
authorKeerthi Kondaka <Keerthi.Kondaka@Sun.COM>2009-04-22 16:33:59 -0700
committerKeerthi Kondaka <Keerthi.Kondaka@Sun.COM>2009-04-22 16:33:59 -0700
commit2cb53ad67f463fb038a7c555bb0611fb6a8acec7 (patch)
tree44a5ac3fe0252b021399f3294c9bac685c93e003 /usr/src/cmd/print/bsd-sysv-commands
parent6809eb4e2a4a94bcc76229c7b5108b96134537b6 (diff)
downloadillumos-joyent-2cb53ad67f463fb038a7c555bb0611fb6a8acec7.tar.gz
6813037 Unable to cancel print jobs when printer name contains a hyphen
Diffstat (limited to 'usr/src/cmd/print/bsd-sysv-commands')
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/cancel.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/usr/src/cmd/print/bsd-sysv-commands/cancel.c b/usr/src/cmd/print/bsd-sysv-commands/cancel.c
index 6efd95bda4..dc3121ab7c 100644
--- a/usr/src/cmd/print/bsd-sysv-commands/cancel.c
+++ b/usr/src/cmd/print/bsd-sysv-commands/cancel.c
@@ -113,6 +113,8 @@ main(int ac, char *av[])
papi_encryption_t encryption = PAPI_ENCRYPT_NEVER;
int c;
int32_t rid = 0;
+ int first_dest = 0;
+
(void) setlocale(LC_ALL, "");
(void) textdomain("SUNW_OST_OSCMD");
@@ -139,15 +141,24 @@ main(int ac, char *av[])
char *printer = NULL;
int32_t id = -1;
- (void) get_printer_id(av[c], &printer, &id);
-
- status = papiServiceCreate(&svc, printer, NULL, NULL,
+ status = papiServiceCreate(&svc, av[c], NULL, 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));
- exit(1);
+ if (first_dest == 0) {
+ (void) get_printer_id(av[c], &printer, &id);
+ status = papiServiceCreate(&svc, printer, NULL,
+ 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));
+ exit(1);
+ }
+ } else {
+ first_dest = 1;
+ printer = av[c];
}
#define OUT ((status == PAPI_OK) ? stdout : stderr)