[go: up one dir, main page]

File: setfont

package info (click to toggle)
console-tools 1998.08.11-3
  • links: PTS
  • area: main
  • in suites: slink
  • size: 5,240 kB
  • ctags: 805
  • sloc: ansic: 8,241; sh: 2,947; yacc: 970; makefile: 356; lex: 287; pascal: 192; perl: 110
file content (127 lines) | stat: -rwxr-xr-x 2,058 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#! /bin/sh

# wrapper around consolechars(8), 
# expanding arguments just in case abreviated args get changed.

function usage
{
    echo >&2 "Usage: `basename $0` [<fontfile>] [-m <mapfile>] [-u <unimapfile>]"
    echo >&2 "          [-o <oldfontfile>] [-om <oldmapfile>] [-ou <oldunimapfile>]"
    echo >&2 "          [-h] [-v] [-V] [-<N>]"
    exit 1
}

function warning
{
    echo >&2 'Warning: this is a shell wrapper; consider using consolechars(8)'
}

OPTIONS=""
QUIET=0

if [ $# = 0 ] ; then
    OPTIONS="--default-font"
fi

while [ $# -gt 0 ] ; do
    case $1 in
# 	--quiet)
# 	    QUIET=1
# 	    shift
# 	    ;;
	-v)
	    OPTIONS="$OPTIONS --verbose"
	    shift
	    ;;
	-h)
	    warning
	    usage
	    exit 0
	    ;;
	-V)
	    OPTIONS="$OPTIONS --version"
	    shift
	    ;;

	-m)
	    if [ "$NEWMAP" = "" ]; then
		if [ "$2" = "none" ]; then
		    echo >&2 'Warning: "-m none" does nothing; ignored.'
		else
		    NEWMAP="--acm $2"
		shift
		shift
		fi
	    else
		usage
	    fi
	    ;;
      
	-u)
	    if [ "$NEWUNIMAP" = "" ]; then
		if [ "$2" = "none" ]; then
		    NEWUNIMAP="--force-no-sfm"
		else
		    NEWUNIMAP="--sfm $2"
		    shift
		    shift
		fi
	    else
		usage
	    fi
	    ;;
      
	-o)
	    if [ "$OLDFONT" = "" ]; then
		OLDFONT="--old-font-raw $2"
		shift
		shift
	    else
		usage
	    fi
	    ;;
      
	-om)
	    if [ "$OLDMAP" = "" ]; then
		OLDMAP="-old-acm $2"
		shift
		shift
	    else
		usage
	    fi
	    ;;
      
	-ou)
	    if [ "$OLDUNIMAP" = "" ]; then
		OLDUNIMAP="-old-sfm $2"
		shift
		shift
	    else
		usage
	    fi
	    ;;
      
	-*)
	    # redirect to /dev/null to prevent test barfing on non-numeric args
	    if [ "$CHARSIZE" = "" -a "${1#-}" -gt 0 -a "${1#-}" -lt 32 ] 2>/dev/null; then
		CHARSIZE="--char-height ${1#-}"
		shift
	    else
		usage
	    fi
	    ;;
      
	*)
	    if [ "$NEWFONT" = "" ]; then
		NEWFONT="--font $1"
		shift
	    else
		usage
	    fi
	;;
    esac
done

test $QUIET = 1 || warning

consolechars $OPTIONS $CHARSIZE $NEWFONT $NEWUNIMAP $NEWMAP $OLDFONT $OLDUNIMAP $OLDMAP