10Sstevel@tonic-gate#!/usr/bin/ksh
20Sstevel@tonic-gate#
30Sstevel@tonic-gate# CDDL HEADER START
40Sstevel@tonic-gate#
50Sstevel@tonic-gate# The contents of this file are subject to the terms of the
60Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only
70Sstevel@tonic-gate# (the "License").  You may not use this file except in compliance
80Sstevel@tonic-gate# with the License.
90Sstevel@tonic-gate#
100Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
110Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
120Sstevel@tonic-gate# See the License for the specific language governing permissions
130Sstevel@tonic-gate# and limitations under the License.
140Sstevel@tonic-gate#
150Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
160Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
170Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
180Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
190Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
200Sstevel@tonic-gate#
210Sstevel@tonic-gate# CDDL HEADER END
220Sstevel@tonic-gate#
230Sstevel@tonic-gate#
240Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
250Sstevel@tonic-gate#
26*1211Swendyp# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
270Sstevel@tonic-gate# Use is subject to license terms.
280Sstevel@tonic-gate#
290Sstevel@tonic-gate
300Sstevel@tonic-gate#
31*1211Swendyp# Get the path/ppdfilename for this ppd NickName
32*1211Swendyp# Input:
33*1211Swendyp#	make: model: ppd:
34*1211Swendyp#	PrintersRus: ABC Model 1234: Foomatic/Postscript (recommended):
350Sstevel@tonic-gate#
360Sstevel@tonic-gate
370Sstevel@tonic-gateif [[ $# -lt 3 ]]; then
380Sstevel@tonic-gate        exit 1
390Sstevel@tonic-gatefi
400Sstevel@tonic-gate
410Sstevel@tonic-gateif [[ -f /usr/lib/lp/model/ppd/ppdcache ]]; then
42*1211Swendyp	typeset make=$(echo $* | /usr/bin/nawk '{FS=":"; print $1}')
43*1211Swendyp	# strip leading blanks
44*1211Swendyp	typeset model=$(echo $* | /usr/bin/nawk '{FS=":"; print $2}' |
45*1211Swendyp			sed -e 's/^[ ]*//')
46*1211Swendyp	typeset ppd=$(echo $* | /usr/bin/nawk '{FS=":"; print $3}' |
470Sstevel@tonic-gate			sed -e 's/^[ ]*//')
480Sstevel@tonic-gate
49*1211Swendyp	# Do not use ":" with $make. printmgr collapses manufacturer name
50*1211Swendyp	# to first word, ie PrintersRus and PrintersRus International become
51*1211Swendyp	# PrintersRus
52*1211Swendyp	/bin/grep "${make}" /usr/lib/lp/model/ppd/ppdcache |
530Sstevel@tonic-gate	/bin/grep "${model}:" |
540Sstevel@tonic-gate	/bin/grep "${ppd}:"  |
550Sstevel@tonic-gate	nawk '{FS=":"; print $4}'
560Sstevel@tonic-gate
570Sstevel@tonic-gate	exit 0
580Sstevel@tonic-gateelse
590Sstevel@tonic-gate	exit 1
600Sstevel@tonic-gatefi
61