/usr/sbin/vcast
1 #!/bin/bash
2 #---------------------------------------------------------------------
3 ##
4 ##=head1 SYNOPSIS
5 ##
6 ## vcast is front-end to cast to activate voyeurism in a
7 ## separate xterm if possible.
8 ##
9 ##=head1 DESCRIPTION
10 ##
11 ## ...
12 ##
13 ##=head1 COPYRIGHT
14 ##
15 ## Original version Copyright 2001 by Kyle Sallee
16 ## Additions/corrections Copyright 2002 by the Source Mage Team
17 ##
18 ##=head1 FUNCTIONS
19 ##
20 ##=over 4
21 ##
22 #---------------------------------------------------------------------
23
24 process_parameters">process_parameters">process_parameters() {
25
26 while [ -n "$1" ]; do
27
28 if echo "" $1 | grep -q "^ -"; then
29
30 case $1 in
31
32 --from) export SOURCE_CACHE="$2"; shift 2 ;;
33 -n|--nofix) NO_SUMMON="$1"; NO_GAZE="$1"; shift 1 ;;
34 --silent) NO_SUMMON="$1"; NO_GAZE="$1"; shift 1 ;;
35 --deps) NO_SUMMON="$1"; shift 1 ;;
36 -f|--fix) NO_SUMMON="$1"; shift 1 ;;
37 --help) HELP="$1"; shift 1 ;;
38 -s) NO_SUMMON="$1"; shift 1 ;;
39 *) shift 1 ;;
40 esac
41
42 else shift
43 fi
44
45 done
46
47 }
48
49
50
51 strip_parameters">strip_parameters() {
52
53 while [ -n "$1" ]; do
54
55 if echo "" $1 | grep -q "^ -"; then
56
57 case $1 in
58 --from) shift 2 ;;
59 *) shift 1 ;;
60 esac
61
62 else echo $1; shift
63 fi
64
65 done
66
67 }
68
69 process_parameters">process_parameters">process_parameters $*
70 SPELLS=`strip_parameters">strip_parameters $*`
71
72 if [ -z "$*" ] ||
73 [ -n "$HELP" ]; then
74 cast; exit 1
75 fi
76
77
78 if [ -n "$DISPLAY" ]; then
79
80 if [ -z "$NO_GAZE" ]; then
81 xterm -bg black \
82 -fg white \
83 $XTERM_OPTIONS \
84 -T "gaze voyeur 5 $SPELLS" \
85 -e /bin/sh -c "gaze voyeur 5 $SPELLS" &
86 fi
87
88 if [ -z "$NO_SUMMON" ]; then
89 xterm -bg black \
90 -fg white \
91 $XTERM_OPTIONS \
92 -T "summon $SPELLS" \
93 -e /bin/sh -c "summon $SPELLS" &
94 fi
95
96
97 fi
98
99 cast $@
100
101
102 #---------------------------------------------------------------------
103 ##=back
104 ##
105 ##=head1 LICENSE
106 ##
107 ## This software is free software; you can redistribute it and/or modify
108 ## it under the terms of the GNU General Public License as published by
109 ## the Free Software Foundation; either version 2 of the License, or
110 ## (at your option) any later version.
111 ##
112 ## This software is distributed in the hope that it will be useful,
113 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
114 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
115 ## GNU General Public License for more details.
116 ##
117 ## You should have received a copy of the GNU General Public License
118 ## along with this software; if not, write to the Free Software
119 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
120 ##
121 #---------------------------------------------------------------------