File: mkt1enc.sh

package info (click to toggle)
vflib3 3.6.14.dfsg-3+nmu4
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 11,936 kB
  • sloc: ansic: 36,071; sh: 10,354; asm: 3,290; makefile: 960; lisp: 123; perl: 109; awk: 43
file content (51 lines) | stat: -rwxr-xr-x 1,039 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
 
case $# in
  0)
    echo "mkt1enc.sh ENCFILE..."
    exit 1
    ;;
esac


for F in $* 
do

  case $# in
    --help|-help)
      echo "mkt1enc.sh ENCFILE..."
      exit 1
      ;;
  esac

  PSENCFILE=$F
  T1ENCFILE=`echo $PSENCFILE | sed 's|.*/\([^/]*\)|\1|' | sed 's|.enc$|.enc|'`

  echo "$PSENCFILE ==> $T1ENCFILE"

  if [ -f $T1ENCFILE ] ; then
    echo "Error: $T1ENCFILE exists." >&2
    exit 1;
  fi

  touch $T1ENCFILE

  echo "# $T1ENCFILE: an encoding vector file for T1Lib."  >>$T1ENCFILE
  echo "# Generated by mkt1enc.sh from $PSENCFILE."        >>$T1ENCFILE
  cat $PSENCFILE \
  | sed 's/%.*//' \
  | tr ' ' '\n' \
  | sed 's/[ ]*$//' | grep -v '^$' \
  | grep -v "\[" | grep -v "\]" | grep -v '^def$' \
  | sed 's|^/||' \
  | awk 'BEGIN { chr = 0; }   
         //    { if (NR == 1){ 
                   printf("Encoding=%s\n", $1); 
                  } else {
                   printf("%-50s/* %02x */\n", $0, chr); 
                   chr++;
                  }
               }' \
  | cat >>$T1ENCFILE
 
done