summaryrefslogtreecommitdiffstats
path: root/cgi-bin/ml-request
diff options
context:
space:
mode:
authorJason Molenda <jsm@gcc.gnu.org>1999-08-25 22:48:12 +0000
committerJason Molenda <jsm@gcc.gnu.org>1999-08-25 22:48:12 +0000
commit92a38d6e015e03ef2bab4ac6fee7a4ae44d94ecb (patch)
treeb8095e98c046b9d62322344fa40de81eb755d1b8 /cgi-bin/ml-request
parentRemove TOC entry for "Signal 11 on GNU/Linux" which does not exist any more. (diff)
downloadgcc-wwwdocs-92a38d6e015e03ef2bab4ac6fee7a4ae44d94ecb.tar.gz
gcc-wwwdocs-92a38d6e015e03ef2bab4ac6fee7a4ae44d94ecb.tar.bz2
gcc-wwwdocs-92a38d6e015e03ef2bab4ac6fee7a4ae44d94ecb.tar.xz
1999-08-25 Jason Molenda (jsm@bugshack.cygnus.com)
* wwwdocs/cgi-bin/ml-request: New file. Send in mailing list change requests from a web form. Taken from sourceware.cygnus.com; I haven't checked to make sure I didn't break anything in the move from there to here. * wwwdocs/cgi-bin/conv.awk: Support for ml-request.
Diffstat (limited to 'cgi-bin/ml-request')
-rwxr-xr-xcgi-bin/ml-request240
1 files changed, 240 insertions, 0 deletions
diff --git a/cgi-bin/ml-request b/cgi-bin/ml-request
new file mode 100755
index 00000000..716baacf
--- /dev/null
+++ b/cgi-bin/ml-request
@@ -0,0 +1,240 @@
1#! /bin/sh
2
3HEADER='<body><h1><a href="/">GCC</a> mailing list request-o-matic</h1>'
4FOOTER='</body></html>'
5
6CONVAWK=/www/egcs/cgi-bin/conv.awk
7MAIL=/usr/bin/Mail
8
9if [ ! -f /usr/bin/gawk ]
10then
11 GAWK=gawk
12else
13 GAWK=/usr/bin/gawk
14fi
15
16normalize()
17{
18
19 resultstr="`echo $1 | sed 's/+/ /g'`" # first convert +s to spaces
20 resultstr=`echo $resultstr | $GAWK -f $CONVAWK`
21
22} # normalize()
23
24## input on stdin will be of the format
25## username=emailaddr@domain.com
26## listname=mailing-list-name
27## operation=[subscribe|unsubscribe]
28## digest=[on|off]
29
30hasat=0
31hasdot=0
32email=""
33cmdargs=""
34prnum=""
35format=""
36
37for i in `echo $QUERY_STRING | awk '-F&' '{for (i = 1 ; i <= NF ; i++) \
38 printf "%s\n" , $i }'`
39do
40 normalize $i # modifies global var ``resultstr''
41
42 case "$resultstr" in
43 username=*) email=`echo $resultstr | sed 's/^username=//' | tr '[A-Z]' '[a-z]'`
44 resultstr="" ;;
45 listname=*) listname=`echo $resultstr | sed -e 's/^listname=//' -e 's,@.*$,,' | tr '[A-Z]' '[a-z]'`
46 resultstr="" ;;
47 operation=*) operation=`echo $resultstr | sed 's/^operation=//'`
48 resultstr="" ;;
49 digest=*) digest=`echo $resultstr | sed 's/^digest=//'`
50 resultstr="" ;;
51 *) resultstr="" ;;
52 esac
53done
54
55error=0
56
57if [ -z "$operation" ]
58then
59 error=1
60fi
61
62if [ "$operation" != subscribe -a "$operation" != unsubscribe ]
63then
64 error=1
65fi
66
67if [ -n "$digest" -a "$digest" != on -a "$digest" != off ]
68then
69 error=1
70fi
71
72if [ $error -eq 1 ]
73then
74 echo "Content-type: text/html"
75 echo ""
76 echo "<HTML>"
77 echo "<head>"
78 echo "<TITLE>Cannot add you to the mailing list at this time...</TITLE>"
79 echo "</head>"
80 echo "$HEADER"
81
82 echo "<p>There was an internal error in this script. Please report"
83 echo "this problem to sourcemaster@cygnus.com."
84
85 echo "$FOOTER"
86 exit 0
87fi
88
89
90if echo "$email" | grep @ >/dev/null 2>&1
91then
92 hasat=1
93 if echo "$email" | sed 's,^[^@]*@,,' | grep '\.' >/dev/null 2>&1
94 then
95 hasdot=1
96 else
97 hasdot=0
98 fi
99else
100 hasat=0
101fi
102
103if [ -z "$listname" ]
104then
105 has_listname=0
106else
107 if [ -d /qmail/lists*/$listname ]
108 then
109 has_listname=1
110 else
111 has_listname=0
112 fi
113fi
114
115if [ "x$digest" = "xon" ]
116then
117 digest=digest-
118else
119 digest=
120fi
121
122##
123## Digest versions of announce lists don't make any sense; undo that.
124##
125
126if echo "$listname" | grep announce >/dev/null 2>&1
127then
128 if [ "$digest" = "digest-" ]
129 then
130 digest_changed=1
131 digest=""
132 fi
133fi
134
135if [ -n "$email" -a "$hasat" -eq 1 -a "$hasdot" -eq 1 -a "$has_listname" -eq 1 ]
136then
137 echo "Content-type: text/html"
138 echo ""
139 echo "<HTML>"
140 echo "<head>"
141 echo "<TITLE>Your subscription request is being sent in...</TITLE>"
142 echo "</head>"
143 echo "$HEADER"
144
145 QMAILHOST=gcc.gnu.org
146 export QMAILHOST
147 orig_email="${email}"
148 email="`echo ${email} | sed 's,@,=,g'`"
149 echo "" | $MAIL "${listname}-${digest}${operation}-${email}@gcc.gnu.org"
150
151 echo '<h2>Your (un)subscription request is being sent in...</h2>'
152
153 echo '<p>Your request is:'
154 echo '<blockquote>'
155
156 if [ "$operation" = "subscribe" ]
157 then
158 echo "<b>Subscribe</b> \"${orig_email}\" to"
159 else
160 echo "<b>Unsubscribe</b> \"${orig_email}\" from"
161 fi
162
163 echo the mailing list \"${listname}\"
164 if [ "$digest" = "digest-" ]
165 then
166 echo '(digest version)'
167 fi
168
169 echo ". </blockquote>"
170
171 echo '<p>'
172 echo "Your request has been sent! An e-mail note will be sent to"
173 echo "<tt>${orig_email}</tt> to confirm that this address works properly."
174 echo "Send that confirmation note"
175 echo "back (reply to it), and your request will be finished. "
176 echo "If you do not see this"
177 echo "confirmation note soon, please try submitting your request again. "
178 echo "<p>You can"
179 echo "also do your request by sending an e-mail note to"
180 echo "<code>${listname}-${digest}${operation}@gcc.gnu.org</code>"
181 echo "<p>The message body and Subject line are ignored."
182
183 echo "<p>See the"
184 echo "<a href=\"http://egcs.cygnus.com/ml/\">gcc mailing list page</a>"
185 echo "for more information."
186else
187 if [ "$has_listname" -eq 1 ]
188 then
189 echo "Content-type: text/html"
190 echo ""
191 echo "<HTML>"
192 echo "<head>"
193 echo "<TITLE>Cannot handle your mailing list request...</TITLE>"
194 echo "</head>"
195 echo "$HEADER"
196
197 echo '<h2>Cannot handle your mailing list request...</h2>'
198 echo '<p>'
199 echo "Something is wrong with the e-mail address. Maybe it is empty,"
200 echo "or possibly you did not include any @ sign or dots in the"
201 echo "domain name. Sorry, we don't support UUCP mail addresses. "
202 echo "Please go back"
203 echo "and give it another try."
204
205 echo "<p>You can"
206 echo "also subscribe by sending an e-mail note to"
207 echo "<code>${listname}-${digest}${operation}@gcc.gnu.org</code>"
208 echo "<p>The message body and Subject line are ignored."
209
210 echo "<p>See the"
211 echo "<a href=\"http://egcs.cygnus.com/ml/\">gcc mailing list page</a>"
212 echo "for more information."
213 else
214 echo "Content-type: text/html"
215 echo ""
216 echo "<HTML>"
217 echo "<head>"
218 echo "<TITLE>Cannot handle your mailing list request at this time...</TITLE>"
219 echo "</head>"
220 echo "$HEADER"
221
222 echo '<h2>Cannot handle your mailing list request at this time...</h2>'
223
224 echo '<p>'
225 echo "You did not provide a mailing list name, or you've entered a mailing"
226 echo 'list name which is not handled on <tt>gcc.gnu.org</tt>.'
227
228 echo '<p>If you are trying to (un)subscribe to/from a mailing list hosted at <b>gnu.org</b>,'
229 echo "send a mail note to <b>${listname}-request@gnu.org</b> with a message body"
230 echo like, \"subscribe ${listname}\".
231
232 echo "<p>See the"
233 echo "<a href=\"http://egcs.cygnus.com/ml/\">gcc mailing list page</a>"
234 echo "for more information."
235 fi
236fi
237
238echo "$FOOTER"
239
240exit 0