File: globus-args-parser-header

package info (click to toggle)
globus-common 18.15-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,684 kB
  • sloc: ansic: 36,506; sh: 4,534; makefile: 354; perl: 151
file content (105 lines) | stat: -rw-r--r-- 2,374 bytes parent folder | download | duplicates (8)
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


# 
# Copyright 1999-2006 University of Chicago
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
# http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# 

# Suggested format for version variables:
# 
# PROGRAM_NAME=`echo $0 | sed 's|.*/||g'`
# 
# PROGRAM_VERSION=`echo '$Revision$'| ${GLOBUS_SH_SED-sed} -e 's|\\$||g' -e 's|Revision: \(.*\)|\1|'`
# 
# VERSION="@VERSION@"
# 
# PACKAGE="@PACKAGE@"
# 
# DIRT_TIMESTAMP="@DIRT_TIMESTAMP@"
# DIRT_BRANCH_ID="@DIRT_BRANCH_ID@"

	globus_args_short_usage()
	{
	    cat 1>&2 <<EOF

Syntax : ${short_usage}

Use -help to display full usage.

EOF
	}

	globus_args_option_error()
	{
	    cat 1>&2 <<EOF

ERROR: option $1 : $2
EOF
	    globus_args_short_usage
	    exit 1
	}
	
	globus_args_unrecognized_option()
	{
	    globus_args_option_error $1 "unrecognized option"
	    exit 1
	}	

	_done=no
	_n=1
	while [ "$_done" = no -a "$_n" -le "$#" ] ; do
	    _tmp="echo \"\$${_n}\""
	    _arg="`eval ${_tmp}`"
	    case "${_arg}" in
		-help | -h | --help | -usage | --usage)
		    long_usage
		    exit 0
		    ;;
		-version|--version)
		    if [ "X${PROGRAM_NAME}" != "X" -a \
			  "X${PROGRAM_VERSION}" != "X" ]; then
		        echo "${PROGRAM_NAME}: ${PROGRAM_VERSION}"
		    elif [ "X${PACKAGE}" != "X" -a \
		           "X${VERSION}" != "X" ]; then
			echo "${PACKAGE}: ${VERSION}"
		    else
			echo "No version information available."
		    fi
		    exit 0
		    ;;
		-versions|--versions)
		    if [ -n "${PACKAGE}" -a -n "${VERSION}" -a \
			 -n "${DIRT_TIMESTAMP}" -a -n "${DIRT_BRANCH_ID}" -a \
			 "X${DIRT_TIMESTAMP}" != "X@DIRT_TIMESTAMP@" -a \
			 "X${DIRT_BRANCH_ID}" != "X@DIRT_BRANCH_ID@" ];
		    then
			echo "${PACKAGE}: ${VERSION} (${DIRT_TIMESTAMP}-${DIRT_BRANCH_ID})"
		    else
			echo "No DiRT information available."
		    fi
		    exit 0;
		    ;;
	        --)
		    _done=yes
		    ;;
		*)
		    _n=`expr $_n + 1`
		    ;;
	    esac
	done
	_n=
	_tmp=
	_arg=
	_done=