File: program.in

package info (click to toggle)
autoproject 0.17-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 804 kB
  • ctags: 437
  • sloc: sh: 2,850; ansic: 1,675; cpp: 201; makefile: 99
file content (132 lines) | stat: -rw-r--r-- 2,255 bytes parent folder | download | duplicates (11)
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/bin/sh

# #NAME# - #DESCRIPTION#

# @configure_input@

# this is usually a good idea
set -e


# Parse the options

TEMP=`getopt -n #NAME# -o \
@output@
o:\
@@
@interactive@
i\
@@
@quiet@
q\
@@
hV \
--long \
@output@
output:,\
@@
@interactive@
interactive,\
@@
@dry-run@
dry-run,\
@@
@no-warn@
no-warn,\
@@
@quiet@
quiet,silent,\
@@
@brief@
brief,\
@@
@verbose@
verbose,\
@@
@directory@
directory:,\
@@
@cd@
cd:,\
@@
help,version -- "$@"`

if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi

# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"

while true ; do
    case "$1" in
@output@
	-o|--output) OFILE="$2"; shift 2 ;;
@@
@interactive@
	-i|--interactive) INTERACTIVE="yes"; shift ;;
@@
@dry-run@
	--dry-run) DRY_RUN="yes"; shift ;;
@@
@no-warn@
	--no-warn) NO_WARN="yes"; shift ;;
@@
@quiet@
	-q|--quiet|--silent) QUIET="yes"; shift ;;
@@
@brief@
	--brief) BRIEF="yes"; shift ;;
@@
@verbose@
	--verbose) VERBOSE="yes"; shift ;;
@@
@directory@
	--directory) DIRECTORY="$2"; shift 2 ;;
@@
@cd@
	--cd) NEW_DIRECTORY="$2"; shift 2 ;;
@@
	-V|--version) echo "#NAME# @VERSION@"; exit 0 ;;
	-h|--help)
	    echo "#NAME# - #DESCRIPTION#";
	    echo "usage: #NAME# [options]";
	    echo "options:";
@output@
	    echo "  -o, --output NAME          send output to NAME instead of standard output";
@@
@interactive@
	    echo "  -i, --interactive          prompt for confirmation";
@@
@dry-run@
	    echo "  --dry-run                  take no real actions";
@@
@no-warn@
	    echo "  --no-warn                  disable warnings";
@@
@quiet@
	    echo "  -q, --quiet, --silent      inhibit usual output";
@@
@brief@
	    echo "  --brief                    shorten output";
@@
@verbose@
	    echo "  --verbose                  print more information";
@@
@directory@
	    echo "  --directory NAME           use specified directory ";
@@
@cd@
	    echo "  --cd NAME                  change to specified directory before proceeding";
@@
	    echo "  -h, --help                 display this help and exit";
	    echo "  -V, --version              output version information and exit";

	    exit 0
	    ;;
	--) shift ; break ;;
	*) echo "Internal error!  no case for option \"$1\"" ; exit 1 ;;
    esac
done

# do the work

exit 0