1#! /usr/bin/sh 2# 3# CDDL HEADER START 4# 5# The contents of this file are subject to the terms of the 6# Common Development and Distribution License, Version 1.0 only 7# (the "License"). You may not use this file except in compliance 8# with the License. 9# 10# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 11# or http://www.opensolaris.org/os/licensing. 12# See the License for the specific language governing permissions 13# and limitations under the License. 14# 15# When distributing Covered Code, include this CDDL HEADER in each 16# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 17# If applicable, add the following below this CDDL HEADER, with the 18# fields enclosed by brackets "[]" replaced with your own identifying 19# information: Portions Copyright [yyyy] [name of copyright owner] 20# 21# CDDL HEADER END 22# 23# 24#pragma ident "%Z%%M% %I% %E% SMI" 25# 26# Copyright (c) 1999 by Sun Microsystems, Inc. 27# All rights reserved. 28# 29 30sccsid=`echo '#pragma ident "@Z@@M@ @I@ @E@ SMI"' | sed 's/@/%/g'` 31 32 33markrow() 34{ 35 # markrow file begin end label 36 file="$1" 37 begin="$2" 38 end="$3" 39 label="$4" 40 41 awk -f - $file <<-EOT > $file.$$ 42 \$2 >= $begin && \$2 <= $end && done == 0 { 43 print ""; 44 print "# $label"; 45 done = 1; 46 } 47 { 48 print \$0; 49 } 50 EOT 51 mv -f $file.$$ $file 52} 53 54header=/tmp/header.$$ 55sorted=/tmp/sorted.$$ 56 57for i 58do 59 echo "#" > $header 60 echo "$sccsid" >> $header 61 echo "#" >> $header 62 echo "# Copyright (c) `date +%Y` by Sun Microsystems, Inc." >> $header 63 echo "# All rights reserved." >> $header 64 echo "#" >> $header 65 sed -n \ 66 -e '/^[^#]/q' \ 67 -e '/^[ ]*$/q' \ 68 -e '/%\Z%/d' \ 69 -e '/@(#)/d' \ 70 -e '/Copyright/d' \ 71 -e '/[aA]ll [rR]ights [rR]eserved/d' \ 72 -e '/^#[ ]*$/d' \ 73 -e p \ 74 $i >> $header 75 echo '#' >> $header 76 grep -v '^#' $i | 77 grep -v '^[ ]*$' | 78 sed -e 's/[ ][ ]*/ /g' | 79 sort -n +1 -o $sorted 80 # The following are specific to PC keyboards, but similar 81 # schemes should work for many other types. 82 markrow $sorted 0 0 "??? Unknown keys ???" 83 markrow $sorted 1 15 "Main Pad Row 1: digits, Backspace" 84 markrow $sorted 16 29 "Main Pad Row 2: Tab, QWERTY..." 85 markrow $sorted 30 43 "Main Pad Row 3: CapsLock, ASDFGH..., Enter" 86 markrow $sorted 44 57 "Main Pad Row 4: Shift, ZXCVBN..., Shift" 87 markrow $sorted 58 65 "Main Pad Row 5: Ctrl, Alt, Space, ..." 88 markrow $sorted 66 74 "??? Unknown keys ???" 89 markrow $sorted 75 89 "Arrow Pad" 90 markrow $sorted 90 108 "Numeric Pad" 91 markrow $sorted 109 109 "??? Unknown keys ???" 92 markrow $sorted 110 126 "Esc, Function Keys, PrintScreen/ScrollLock/Pause" 93 markrow $sorted 127 130 "??? Unknown keys ???" 94 markrow $sorted 131 133 "Japanese Keys" 95 markrow $sorted 134 149 "??? Unknown keys ???" 96 markrow $sorted 150 151 "Korean Keys" 97 markrow $sorted 152 99999 "??? Unknown keys ???" 98 cat $header $sorted > $i.neat 99 rm -f $header $sorted 100 101 echo "Neaten $i -> $i.neat" 102done 103