File: fvwm-bug.in

package info (click to toggle)
fvwm 1%3A2.6.7-3
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 16,752 kB
  • ctags: 14,275
  • sloc: ansic: 145,770; xml: 17,086; perl: 7,302; sh: 4,885; makefile: 1,055; yacc: 688; python: 629; lex: 188; sed: 11
file content (195 lines) | stat: -rw-r--r-- 4,455 bytes parent folder | download
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#!/bin/sh -
#
# fvwm-bug - create a bug report and mail it to the bug address
#          - adapted from equivalent `bashbug' script
#
# The bug address could depend on the release status of fvwm.  Currently
# it doesn't.
#

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA



PACKAGE="@PACKAGE@"
VERSION="@VERSION@"
script=`basename $0`
address=""

while test $# -gt 0; do
	case "$1" in
		--help|-help|-h|-\?)
			cat <<EOF
This script is a part of $PACKAGE-$VERSION package.

Usage: $script [OPTIONS] [address]
Options:
	[-h]	[--help] [-?]
	[-v]	[--version] [-V]

address is an alternative email address to send the bug report to;
	by default, addresses of the local admin or developers are used
EOF
			exit 0 ;;

		--version|-version|-v|-V)
			echo "$VERSION"
			exit 0 ;;

		-*)
			echo >&2 "Unrecognized option $1 specified."
			echo >&2 "Run '$0 --help' to get the usage."
			exit 1 ;;

		*)
			if test x"$address" != x; then
				echo >&2 "You may specify only one address."
				echo >&2 "Run '$0 --help' to get the usage."
				exit 1
			fi
			address="$1" ;;
	esac
	shift
done

PATH=/bin:/usr/bin:/usr/local/bin:$PATH
export PATH

: ${EDITOR:=vi}

TEMP=`mktemp -q "${TMPDIR:-/tmp}/fvwm-bug.XXXXXX"`

# Figure out how to echo a string without a trailing newline
N=`echo 'hi there\c'`
case "$N" in
	*c)	n=-n c= ;;
	*)	n= c='\c' ;;
esac

trap 'rm -f $TEMP $TEMP.x; exit 1' 1 2 3 13 15
trap 'rm -f $TEMP $TEMP.x' 0

# Who is mail from?
: ${USER:=${LOGNAME:-`whoami`}}

# Who is mail to?
if test x"$address" = x; then
	LOCAL=
	WORKERS=fvwm-workers@fvwm.org

	if test "$LOCAL"; then
		echo "Do you want to send the report to the local maintainer <$LOCAL>,"
		echo "the fvwm workers <$WORKERS>, or both?"
		echo $n "Send report to (l)ocal, (w)orkers, (b)oth? " $c
		read ans
		case "$ans" in
		l*|L*) BUGADDR=$LOCAL;;
		f*|F*|w*|W*) BUGADDR=$WORKERS;;
		b*|B*) BUGADDR=$LOCAL,$WORKERS;;
		*) echo "[Defaulting to LOCAL]"; BUGADDR=$LOCAL;;
		esac
	fi
else
	BUGADDR=$address
fi

UN=
if (uname) >/dev/null 2>&1; then
	UN=`uname -a`
fi

if [ -f /usr/lib/sendmail ] ; then
	RMAIL="/usr/lib/sendmail"
elif [ -f /usr/sbin/sendmail ] ; then
	RMAIL="/usr/sbin/sendmail"
else
	RMAIL=rmail
fi


prefix=@prefix@
exec_prefix=@exec_prefix@
datarootdir=@datarootdir@
datadir=@datadir@
libexecdir=@libexecdir@
: ${FVWM_USERDIR:=unset}
FVWM_DATADIR=@FVWM_DATADIR@
FVWM_MODULEDIR=@FVWM_MODULEDIR@


cat > $TEMP <<EOF
From: ${USER}
To: ${BUGADDR}
Subject: [50 character or so descriptive subject here (for reference)]

Configuration Information [Automatically generated, do not change]:
uname: $UN
compiler flags: @CC@ @CFLAGS@

FVWM Version:	@VERSION@@VERSIONINFO@
FVWM_MODULEDIR:	$FVWM_MODULEDIR
FVWM_DATADIR:	$FVWM_DATADIR
FVWM_USERDIR:	$FVWM_USERDIR

Description:
	[Detailed description of the problem, suggestion, or complaint.]

Repeat-By:
	[Describe the sequence of events that causes the problem
	to occur.]

Fix:
	[Description of how to fix the problem.  If you don't know a
	fix for the problem, don't include this section.]
EOF

chmod u+w $TEMP
cp $TEMP $TEMP.x

trap '' 2		# ignore interrupts while in editor

until $EDITOR $TEMP; do
	echo "$0: editor \`$EDITOR' exited with nonzero status."
	echo "$0: Perhaps it was interrupted."
	echo "$0: Type \`y' to give up, and lose your bug report;"
	echo "$0: type \`n' to re-enter the editor."
	echo $n "$0: Do you want to give up? $c"

	read ans
	case "$ans" in
	[Yy]*) exit 1 ;;
	esac
done

trap 'rm -f $TEMP $TEMP.x; exit 1' 2	# restore trap on SIGINT

if cmp -s $TEMP $TEMP.x
then
	echo "File not changed, no bug report submitted."
	exit
fi

echo $n "Send bug report? [y/n] $c"
read ans
case "$ans" in
[Nn]*)	exit 0 ;;
esac

${RMAIL} $BUGADDR < $TEMP || {
	cat $TEMP >> $HOME/dead.fvwm-bug
	echo "$0: mail failed: report saved in $HOME/dead.fvwm-bug" >&2
}

exit 0