Print this page
XXX Remove nawk(1)
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/print/scripts/ppdfilename2mmp
+++ new/usr/src/cmd/print/scripts/ppdfilename2mmp
1 1 #!/usr/bin/ksh
2 2 #
3 3 # CDDL HEADER START
4 4 #
5 5 # The contents of this file are subject to the terms of the
6 6 # Common Development and Distribution License (the "License").
7 7 # You may not use this file except in compliance with the License.
8 8 #
9 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 # or http://www.opensolaris.org/os/licensing.
11 11 # See the License for the specific language governing permissions
12 12 # and limitations under the License.
13 13 #
14 14 # When distributing Covered Code, include this CDDL HEADER in each
↓ open down ↓ |
14 lines elided |
↑ open up ↑ |
15 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 # If applicable, add the following below this CDDL HEADER, with the
17 17 # fields enclosed by brackets "[]" replaced with your own identifying
18 18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 19 #
20 20 # CDDL HEADER END
21 21 #
22 22 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 23 # Use is subject to license terms.
24 24 #
25 -# ident "%Z%%M% %I% %E% SMI"
26 -#
27 25
28 26 #
29 27 # Get the make/model/nickname as well as the repository/label from ppdfilename
30 28 #
31 29
32 30 # Input
33 31 # ppdfilename
34 32 # /var/lp/ppd/user/HP/foo.ppd.gz
35 33 # Output
36 34 # make
37 35 # model
38 36 # label(repository letter): driver
39 37 #
40 38 # Lexmark
41 39 # IBM Page Printer 3112
42 40 # foomatic(L): Foomatic/hpijs
43 41 #
44 42
45 43 if [[ $# -lt 1 ]]; then
46 44 exit 1
47 45 fi
48 46
49 47 cachefile=/var/lp/ppd/ppdcache
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
50 48 [[ -f $cachefile ]] || exit 1
51 49
52 50 cacheentry=$(/bin/grep "$1" $cachefile)
53 51 [[ -n "$cacheentry" ]] || exit 1
54 52
55 53 #
56 54 # Retrieve the manufacturer (make)
57 55 # Use only the first word in manufacturer entry
58 56 #
59 57 manuf=$(echo "$cacheentry" |
60 -nawk '{FS=":"; print $1}' |
61 -nawk '{print $1}')
58 +/usr/xpg4/bin/awk '{FS=":"; print $1}' |
59 +/usr/xpg4/bin/awk '{print $1}')
62 60
63 61 # Retrieve the model
64 -model=$(echo "$cacheentry" | nawk '{FS=":"; print $2}')
62 +model=$(echo "$cacheentry" | /usr/xpg4/bin/awk '{FS=":"; print $2}')
65 63
66 64 # Retrieve the driver
67 -driver=$(echo "$cacheentry" | nawk '{FS=":"; print $3}')
65 +driver=$(echo "$cacheentry" | /usr/xpg4/bin/awk '{FS=":"; print $3}')
68 66
69 67 #
70 68 # Retrieve the PPD path. Parse the PPD path to get the
71 69 # label path and to figure out the repository letter
72 70 # associated with the label path. Note:
73 71 # the PPD file name is the 6th colon separated entry
74 72 # in the cache entry. This is may need to be modified if the
75 73 # format changes.
76 74 #
77 -ppdpath=$(echo "$cacheentry" | /bin/nawk '{FS=":"; print $6}' )
75 +ppdpath=$(echo "$cacheentry" | /usr/xpg4/bin/awk '{FS=":"; print $6}' )
78 76 manupath=$(/bin/dirname "$ppdpath")
79 77 labelpath=$(/bin/dirname "$manupath")
80 78
81 79 case "$labelpath" in
82 80 /usr/share/ppd/*)
83 81 repltr=S
84 82 ;;
85 83 /opt/share/ppd/*)
86 84 repltr=V
87 85 ;;
88 86 /usr/local/share/ppd/*)
89 87 repltr=A
90 88 ;;
91 89 /var/lp/ppd/*)
92 90 repltr=U
93 91 ;;
94 92 esac
95 93
96 94 [[ -n "${repltr}" ]] || exit 1
97 95 echo "${manuf}\n${model}"
98 96 echo "$(/bin/basename "$labelpath")(${repltr}): $driver"
99 97
100 98 exit 0
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX