Mercurial > illumos > illumos-gate
changeset 4062:c84209043eff
6526418 netpr dumps core when protocol is tcp and port number is missing
6530757 creating print queue with lexmarks print driver
author | jacobs |
---|---|
date | Wed, 18 Apr 2007 21:01:55 -0700 |
parents | 0f223b243748 |
children | ca21bf366165 |
files | usr/src/cmd/lp/model/netpr/bsd_misc.c usr/src/cmd/lp/model/netpr/tcp_misc.c usr/src/cmd/print/bsd-sysv-commands/lpstat.c |
diffstat | 3 files changed, 24 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/lp/model/netpr/bsd_misc.c Wed Apr 18 20:32:49 2007 -0700 +++ b/usr/src/cmd/lp/model/netpr/bsd_misc.c Wed Apr 18 21:01:55 2007 -0700 @@ -38,18 +38,18 @@ static int job_primitive(np_bsdjob_t *, char, char *); static int create_cfA_file(np_bsdjob_t *); -static char * create_cfname(np_bsdjob_t *); -static char * create_dfname(np_bsdjob_t *); +static char *create_cfname(np_bsdjob_t *); +static char *create_dfname(np_bsdjob_t *); extern char data_file_type; np_bsdjob_t * -create_bsd_job(np_job_t * injob, int pr_order, int filesize) +create_bsd_job(np_job_t *injob, int pr_order, int filesize) { np_bsdjob_t *job; char *id; int x; - np_data_t * jobdata; + np_data_t *jobdata; if ((injob->request_id == NULL) || (injob->username == NULL) || (injob->dest == NULL) || (injob->printer == NULL)) { @@ -59,6 +59,7 @@ job = (np_bsdjob_t *)malloc(sizeof (np_bsdjob_t)); ASSERT(job, MALLOC_ERR); (void) memset(job, 0, sizeof (np_bsdjob_t)); + job->np_printer = "auto"; /* default "queue" */ /* * request-id comes in as printer-number * pull apart to create number @@ -86,7 +87,7 @@ if ((errno != 0) || (x < 0)) { x = 0; } - (void) snprintf(job->np_request_id, (size_t) 4, + (void) snprintf(job->np_request_id, (size_t)4, "%.3d", x % 1000); /* seperate the user/host from host!user or user@host */ @@ -192,7 +193,7 @@ static char * create_dfname(np_bsdjob_t *job) { - char * dfname; + char *dfname; if (job == NULL) return (NULL); @@ -218,9 +219,9 @@ } static char * -create_cfname(np_bsdjob_t * job) +create_cfname(np_bsdjob_t *job) { - char * cfname; + char *cfname; if (job == NULL) return (NULL); @@ -252,7 +253,7 @@ } static int -job_primitive(np_bsdjob_t * job, char option, char *value) +job_primitive(np_bsdjob_t *job, char option, char *value) { char buf[BUFSIZ];
--- a/usr/src/cmd/lp/model/netpr/tcp_misc.c Wed Apr 18 20:32:49 2007 -0700 +++ b/usr/src/cmd/lp/model/netpr/tcp_misc.c Wed Apr 18 21:01:55 2007 -0700 @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -21,8 +20,8 @@ */ /* - * Copyright (c) 1996-2001 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -59,6 +58,7 @@ ASSERT(tcpjob, MALLOC_ERR); (void) memset(tcpjob, 0, sizeof (np_tcpjob_t)); + tcpjob->np_port = "9100"; tcpjob->gen_data = genjob; tcpjob->gen_data->filesize = filesize;
--- a/usr/src/cmd/print/bsd-sysv-commands/lpstat.c Wed Apr 18 20:32:49 2007 -0700 +++ b/usr/src/cmd/print/bsd-sysv-commands/lpstat.c Wed Apr 18 21:01:55 2007 -0700 @@ -20,7 +20,7 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * */ @@ -533,10 +533,14 @@ status = papiServiceCreate(&svc, name, NULL, NULL, cli_auth_callback, encryption, NULL); if (status != PAPI_OK) { - fprintf(stderr, gettext( - "Failed to contact service for %s: %s\n"), - name ? name : "(NULL)", - verbose_papi_message(svc, status)); + if (status == PAPI_NOT_FOUND) + fprintf(stderr, gettext("%s: unknown printer\n"), + name ? name : "(NULL)"); + else + fprintf(stderr, gettext( + "Failed to contact service for %s: %s\n"), + name ? name : "(NULL)", + verbose_papi_message(svc, status)); papiServiceDestroy(svc); return (-1); }