diff options
author | jacobs <none@none> | 2006-09-22 15:03:12 -0700 |
---|---|---|
committer | jacobs <none@none> | 2006-09-22 15:03:12 -0700 |
commit | b51e021de072d76292addb44467f777617c6a8c1 (patch) | |
tree | f23d5bd037f70dea859cf0c77ec7791bdcb96570 /usr/src/cmd/print/bsd-sysv-commands/lpc.c | |
parent | 5d3a5ad8d2a9319e80861563ceff0e6d8d530a32 (diff) | |
download | illumos-joyent-b51e021de072d76292addb44467f777617c6a8c1.tar.gz |
6443139 lpadmin -x deletes all queue in /etc/printers.conf when just removing one
6454036 */usr/bin/lpc* status sub command dumps core
6473215 papiPrintersList() can't be called twice
Diffstat (limited to 'usr/src/cmd/print/bsd-sysv-commands/lpc.c')
-rw-r--r-- | usr/src/cmd/print/bsd-sysv-commands/lpc.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/usr/src/cmd/print/bsd-sysv-commands/lpc.c b/usr/src/cmd/print/bsd-sysv-commands/lpc.c index 6d0aa6135d..53e7b6560d 100644 --- a/usr/src/cmd/print/bsd-sysv-commands/lpc.c +++ b/usr/src/cmd/print/bsd-sysv-commands/lpc.c @@ -465,11 +465,29 @@ process(int ac, char **av) return (-1); } - if (((printer != NULL) && (strcmp(printer, "all") != 0)) || - (num_args <= ac)) - rc = process_one(handler, av, num_args); - else + if (((ac == 0) && (num_args != 0)) || + ((printer != NULL) && strcmp(printer, "all") == 0)) rc = process_all(handler, av, num_args); + else if (num_args < ac) { + int i; + char *argv[4]; + + memset(argv, 0, sizeof (argv)); + argv[0] = av[0]; + + if (strcmp(av[0], "topq") == 0) { + argv[1] = av[1]; + for (i = 2; i <= ac; i++) { + argv[2] = av[i]; + process_one(handler, argv, num_args); + } + } else + for (i = 1; i <= ac; i++) { + argv[1] = av[i]; + process_one(handler, argv, num_args); + } + } else + rc = process_one(handler, av, num_args); return (rc); } @@ -508,7 +526,7 @@ lpc_shell() if ((av = strsplit(line, " \t\n")) != NULL) for (ac = 0; av[ac] != NULL; ac++); - (void) process(ac, av); + (void) process(ac - 1, av); free(av); } } @@ -534,7 +552,7 @@ main(int ac, char *av[]) if (optind == ac) lpc_shell(); else - result = process(optind - 2, &av[optind]); + result = process(ac - optind - 1, &av[optind]); return (result); } |