4 ###############################################################################
5 # Copyright (c) 2000-2014 Ericsson Telecom AB
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ###############################################################################
12 ###############################################################################
13 # Shell script: ttcn3_help
15 # Purpose : opening help pages
17 # The followings can be configured
18 # browser: the application which opens the help page
19 # (netscape by default)
20 # browser_options: command line options for the browser
21 # help_format: extension of the help files
22 # help_root: root of the help files
24 # Return value: 1 on error
26 ###############################################################################
28 # check the number of arguments
29 if test "`expr $# != 1`" = "1"
30 then echo "Error: exactly one argument is expected"; exit 1;
33 # check for necessary environment variables
34 if test "${TTCN3_DIR}" = ""
35 then echo "Error: TTCN3_DIR environment variable is not set"; exit 1;
38 # file extension for help files
40 # path of the help pages
41 help_root
="${TTCN3_DIR}/help";
44 if test "${TTCN3_BROWSER}" = ""
45 then browser
="netscape"; browser_options
="-no-about-splash ";
46 else browser
="${TTCN3_BROWSER}"; browser_options
=" ";
49 # check for already running browsers
51 if test "`echo ${browser} | grep netscape`" != ""
54 # avoid listing grep command as well
55 pslist
=`/bin/ps -u ${username} -f`
56 if test "`echo ${pslist} | grep netscape`" != ""
57 then browser_options
="-remote openURL(file:"; endtag
=")"
58 else browser_options
="-no-about-splash "; endtag
=""
62 elif test "`echo ${browser} | grep mozilla`" != ""
65 # avoid listing grep command as well
66 pslist
=`/bin/ps -u ${username}`
67 if test "`echo ${pslist} | grep mozilla`" != ""
68 then browser_options
="-remote openURL(file:"; endtag
=")"
69 else browser_options
="file:"; endtag
=""
73 elif test "`echo ${browser} | grep opera`" != ""
76 # avoid listing grep command as well
77 pslist
=`/bin/ps -u ${username} -f`
78 if test "`echo ${pslist} | grep opera`" != ""
79 then browser_options
="-remote openURL(file:"; endtag
=")"
83 # Lynx should be executed in a new terminal
84 elif test "`echo ${browser} | grep lynx`" != ""
86 browser
="xterm -e ${browser}"
92 #echo "browser=$browser"
93 #echo "options=$browser_options"
94 #echo "endtag =$endtag"
96 # the file tree looks like
97 # $TTCN3_DIR/help/titan_main.html
98 # $TTCN3_DIR/help/titan_index.html
99 # $TTCN3_DIR/help/info/<keyword>.html
101 ##### check if it is a document name #####
102 if test -f ${help_root}/$1
103 then exec ${browser} ${browser_options}${help_root}/$1${endtag}
104 elif test -f ${help_root}/info
/$1
105 then exec ${browser} ${browser_options}${help_root}/info/$1${endtag}
107 ##### check if it is the keyword 'main' #####
108 elif test $1 = "main"
109 then exec ${browser} ${browser_options}${help_root}/titan_main${help_format}${endtag}
111 ##### check if it is a keyword #####
112 elif test -f ${help_root}/info
/$1${help_format}
113 then exec ${browser} ${browser_options}${help_root}/info/$1${help_format}${endtag}
115 # otherwise open the index file
116 else exec ${browser} ${browser_options}${help_root}/titan_index${help_format}${endtag}
This page took 0.036244 seconds and 6 git commands to generate.