3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 # This file incorporates work covered by the following license notice:
11 # Licensed to the Apache Software Foundation (ASF) under one or more
12 # contributor license agreements. See the NOTICE file distributed
13 # with this work for additional information regarding copyright
14 # ownership. The ASF licenses this file to you under the Apache
15 # License, Version 2.0 (the "License"); you may not use this file
16 # except in compliance with the License. You may obtain a copy of
17 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 # tries to locate the executable specified
21 # as first parameter in the user's path.
23 if [ ! -z "$1" ]; then
24 for i
in `echo $PATH | sed -e 's/^:/.:/g' -e 's/:$/:./g' -e 's/::/:.:/g' -e 's/:/ /g'`; do
25 if [ -x "$i/$1" -a ! -d "$i/$1" ]; then
33 # checks for the original mozilla start script(s)
34 # and restrict the "-remote" semantics to those.
36 if file "$1" |
grep script > /dev
/null
&& grep NPL
"$1" > /dev
/null
; then
37 "$1" -remote 'ping()' 2>/dev
/null
>/dev
/null
42 "openURL($(printf '%s' "$2" \
43 | sed -e 's/(/%28/g' -e 's/)/%29/g' -e 's/,/%2C/g'),new-window)" &
50 # special handling for mailto: uris
51 if echo "$1" |
grep '^mailto:' > /dev
/null
; then
53 mailer
=`which xdg-email`
54 if [ ! -z "$mailer" ]; then
58 # check $MAILER variable
59 if [ ! -z "$MAILER" ]; then
63 # mozilla derivates may need -remote semantics
64 for i
in thunderbird mozilla netscape icedove iceape
; do
66 if [ ! -z "$mailer" ]; then
67 run_mozilla
"$mailer" "$1"
71 # handle all non mozilla mail clients below
75 browser
=`which xdg-open`
76 if [ ! -z "$browser" ]; then
80 # check $BROWSER variable
81 if [ ! -z "$BROWSER" ]; then
85 # mozilla derivates may need -remote semantics
86 for i
in chrome seamonkey firefox iceweasel iceape
; do
88 if [ ! -z "$browser" ]; then
89 run_mozilla
"$browser" "$1"
93 # handle all non mozilla browers below