Debian Codegraph @

lib/linkcheck

raw
1 # -*-Shell-script-*-
2 #
3 # Copyright (C) 2015-2020 SUSE Software Solutions Germany GmbH
4 #
5 # Author:
6 # Frank Sundermeyer <fsundermeyer at opensuse dot org>
7 #
8 ###########################################################################
9 #
10 # LINKCHECK
11 #
12 # checks http links in file or from rootid
13 #
14 ###########################################################################
15
16 function linkcheck {
17 local SHORT_OPTS LONG_OPTS SUB_CMD
18
19 SUB_CMD=$1
20 shift
21
22 SHORT_OPTS="h"
23 LONG_OPTS="file:,help,not-validate-tables,rootid:,show"
24
25 parse_args "$SHORT_OPTS" "$LONG_OPTS" "$SUB_CMD" "$@"
26 eval set -- "$P_REMAIN_ARGS"
27
28 #------ Computing the values returned from the parser -----
29 if [[ 1 -eq $P_HELP ]]; then
30 help_scmd_head "$SUB_CMD" "${HELP_SUBCOMMAND[$SUB_CMD]}"
31 help_file
32 help_help
33 help_not-validate-tables
34 help_rootid
35 help_show_check
36 cat <<EOF
37 NOTES: * Options --file (-f) and --rootid exclude one another.
38 * If neither file nor rootid is specified, the rootid
39 from the DC-file is used
40 * $SUB_CMD follows xi:includes
41 EOF
42 exit 0
43 fi
44
45 if [[ -z "$P_ROOTID" && -z "$P_FILE" ]]; then
46 if [[ 0 != $VERBOSITY ]]; then
47 ccecho "info" "Neither file nor rootid specified, using rootid from DC-file"
48 fi
49 elif [[ -n "$P_ROOTID" && -n "$P_FILE" ]]; then
50 exit_on_error "Options --file (-f) and --rootid exclude one another.\nPlease specify only one of these options"
51 fi
52
53 if [[ -n "$P_FILE" ]]; then
54 ROOTID=$($XSLTPROC --stylesheet "$DAPSROOT/daps-xslt/common/get-rootelement-id.xsl" --file "$P_FILE" "$XSLTPROCESSOR") || exit_on_error "Cannot get a rootid from file $FILE"
55 export ROOTID
56 fi
57
58 call_make "$SUB_CMD" "$@"
59 }