/usr/bin/orca is in gnome-orca 3.4.0-0ubuntu2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | #!/bin/sh
#
# Orca
#
# Copyright 2006-2008 Sun Microsystems Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., Franklin Street, Fifth Floor,
# Boston MA 02110-1301 USA.
# This script performs some clean up and will run Orca. It will also
# rerun Orca if it detects that Orca died an unnatural death.
# __id__ = "$Id: orca.in,v 1.22 2006/12/08 16:21:25 wwalker Exp $"
# __version__ = "$Revision: 1.22 $"
# __date__ = "$Date: 2006/12/08 16:21:25 $"
# __copyright__ = "Copyright (c) 2006-2008 Sun Microsystems Inc."
# __license__ = "LGPL"
# Set the user's $PATH for this script.
#
PATH="${PATH}:/usr/bin:/usr/sbin:/bin"
export PATH
# Save the arguments away.
#
ARGS="$*"
if pidof speech-dispatcher >/dev/null; then
kill $(pidof speech-dispatcher)
fi
# Save away XMODMAP settings we might change.
#
saveXmodmap()
{
# We'll save and restore the Caps_Lock as a modifier just in case
# the user is using the Caps_Lock as the Orca modifier key. We
# will also do so with the KP_Insert key since we want to make
# sure it only produces the keysyms we expect (it produces
# KP_Insert and KP_0 by default). See the use of xmodmap in
# orca.py:loadUserSettings for the other part of what's going on.
#
# [[[WDW: we probably should save/restore the autorepeat value of
# the Orca modifier key and turn the autorepeat off when Orca is
# running. That can be done using the 'xset' utility, though
# turning it on/off is easy, but getting the current state is not
# straightforward.]]]
#
if [ "x$DISPLAY" != "x" ] ; then
CAPSLOCKSETTING=`xmodmap | grep Caps_Lock | cut -f1`
KPINSERTSETTING=`xmodmap -pke | grep KP_Insert`
INSERTSETTING=`xmodmap -pke | grep Insert | grep -v KP_`
fi
}
# Restore XMODMAP settings we may have changed.
#
restoreXmodmap()
{
if [ "x$CAPSLOCKSETTING" != "x" ] ; then
xmodmap -e "add $CAPSLOCKSETTING = Caps_Lock" > /dev/null 2>&1
fi
if [ "x$KPINSERTSETTING" != "x" ] ; then
xmodmap -e "$KPINSERTSETTING" > /dev/null 2>&1
fi
if [ "x$INSERTSETTING" != "x" ] ; then
xmodmap -e "$INSERTSETTING" > /dev/null 2>&1
fi
}
# Cleans up any orca-related processes that might be running,
# restricting it to those processes owned by the user. These include
# orca itself, any speech synthesis drivers, and festival processes
# running in server mode.
#
cleanup()
{
# Check if we should force orca to quit, or just ask it nicely.
# kill -15, will give orca time to shutdown gracefully
# kill -9 will terminate immediately
if [ "$1" = "-f" ];then
KILLARG="-KILL"
else
KILLARG="-TERM"
fi
USERID=$(id -u)
PATTERN="orca[.]orca|festival [-][-]server"
pkill $KILLARG -U $USERID -f "$PATTERN"
}
waitForCleanup()
{
while $(cleanup) ; do
sleep 0.5
done
}
trap cleanup HUP QUIT TERM INT ABRT
# Runs orca.
#
runOrca()
{
exec_prefix=/usr
PYTHONPATH=${PYTHONPATH}:${exec_prefix}/lib/python2.7/dist-packages
export PYTHONPATH
saveXmodmap
/usr/bin/python -c "import orca.orca; orca.orca.main()" "$ARGS"
restoreXmodmap
}
if [ `echo $ARGS | grep -c "\-q"` -gt 0 ] ; then
# If the user has done -q or --quit, that means to tell any
# existing orca process to quit. So, we just do a cleanup.
#
cleanup
elif [ `echo $ARGS | egrep -c " \-f|^\-f|\-\-forcequit"` -gt 0 ] ; then
# If the user has done -f or --forcequit, that means
# that Orca has probably hung badly, and needs to be killed with force.
#
cleanup "-f"
else
# Allow a --replace to kill other orca processes.
#
if [ `echo $ARGS | grep -c "\-\-replace"` -gt 0 ] ; then
waitForCleanup
fi
# If the user passed in a flag that results in orca only
# outputting data to the console, don't kill any other orca
# process. We do this by looking for flags that *should* result
# in a cleanup (i.e., every legal command except -?, --help, -v,
# --version, -l, and --list-apps). This way, if the user
# erroneously types an illegal command line argument, the help
# text is emitted and the other orca is not killed.
#
if [ "x$ARGS" = "x" ] ; then
WONT_EXIT=1
else
WONT_EXIT=`echo $ARGS | egrep -c "\-s|\-t|\-n|\-u|\-e|\-d"`
fi
# Do not run if another Orca is already running.
#
if [ "x$DBUS_SESSION_BUS_ADDRESS" != "x" ] && [ $WONT_EXIT -gt 0 ] ; then
IFS=:
DBUSSENDCMD=
for dir in $PATH:/usr/sfw/bin:/usr/local/bin; do
test -x "$dir/dbus-send" && {
DBUSSENDCMD="$dir/dbus-send"
break
}
done
if [ "x$DBUSSENDCMD" != "x" ] ; then
$DBUSSENDCMD --reply-timeout=5000 --print-reply \
--dest=org.gnome.Orca / org.freedesktop.DBus.Peer.Ping \
> /dev/null 2>&1
if [ "$?" -eq 0 ] ; then
echo "Another Orca process is already running for this session."
echo "Run \"orca --replace\" if you want to replace the current"
echo "process with a new one."
exit
fi
fi
fi
runOrca
fi
|