Debian Codegraph @

debian/xfhelp4

raw
1 #!/bin/bash
2 #
3 # xfce
4 #
5 # Copyright (C) 1999 Olivier Fourdan ([email protected])
6 # Copyright (C) 2003 Jasper Huijsmans ([email protected])
7 #
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
12 #
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 #
22
23 URL="https://docs.xfce.org/"
24 HELP_DIR="/usr/share/doc"
25
26 if [ -n "$1" ]; then
27 HELP_FILE=
28 MODULE="${1%.html}"
29 case $1 in
30 *.html)
31 HELP_FILE="$1"
32 ;;
33 esac
34 else
35 exit 1
36 fi
37
38 # Check for translated documentation
39 if [ -n "$LC_ALL" ] ; then
40 LC=$LC_ALL
41 elif [ -n "$LANG" ] ; then
42 LC=$LANG
43 else
44 LC="C"
45 fi
46
47 LC_CLEAN="${LC%_*}"
48
49 if [ -r "$HELP_DIR/$MODULE/html/$LC/index.html" ]
50 then
51 URL="$HELP_DIR/$MODULE/html/$LC/index.html"
52 elif [ -r "$HELP_DIR/$MODULE/html/$LC_CLEAN/index.html" ]
53 then
54 URL="$HELP_DIR/$MODULE/html/$LC_CLEAN/index.html"
55 elif [ -r "$HELP_DIR/$MODULE/html/C/index.html" ]
56 then
57 URL="$HELP_DIR/$MODULE/html/C/index.html"
58 elif [ -n "$HELP_FILE" ]
59 then
60 if [ -r "$HELP_DIR/$MODULE/html/$LC/$HELP_FILE" ]
61 then
62 URL="$HELP_DIR/$MODULE/html/$LC/$HELP_FILE"
63 elif [ -r "$HELP_DIR/$MODULE/html/$LC_CLEAN/$HELP_FILE" ]
64 then
65 URL="$HELP_DIR/$MODULE/html/$LC_CLEAN/$HELP_FILE"
66 elif [ -r "$HELP_DIR/$MODULE/html/C/$HELP_FILE" ]
67 then
68 URL="$HELP_DIR/$MODULE/html/C/$HELP_FILE"
69 fi
70 fi
71
72 exo-open "${URL}"