jpayne@69
|
1 #!/bin/sh
|
jpayne@69
|
2 # Prints the user's email address, with confirmation from the user.
|
jpayne@69
|
3 #
|
jpayne@69
|
4 # Copyright (C) 2001-2003, 2005, 2013 Free Software Foundation, Inc.
|
jpayne@69
|
5 #
|
jpayne@69
|
6 # This program is free software: you can redistribute it and/or modify
|
jpayne@69
|
7 # it under the terms of the GNU General Public License as published by
|
jpayne@69
|
8 # the Free Software Foundation; either version 3 of the License, or
|
jpayne@69
|
9 # (at your option) any later version.
|
jpayne@69
|
10 #
|
jpayne@69
|
11 # This program is distributed in the hope that it will be useful,
|
jpayne@69
|
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
jpayne@69
|
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
jpayne@69
|
14 # GNU General Public License for more details.
|
jpayne@69
|
15 #
|
jpayne@69
|
16 # You should have received a copy of the GNU General Public License
|
jpayne@69
|
17 # along with this program. If not, see <https://www.gnu.org/licenses/>.
|
jpayne@69
|
18
|
jpayne@69
|
19 # Prerequisites for using ${exec_prefix}/lib and ${datarootdir}/locale.
|
jpayne@69
|
20 prefix="/mnt/c/Users/crash/Documents/BobLiterman/CSP2_Galaxy/CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce"
|
jpayne@69
|
21 exec_prefix="${prefix}"
|
jpayne@69
|
22 datarootdir="${prefix}/share"
|
jpayne@69
|
23 datadir="${datarootdir}"
|
jpayne@69
|
24 # Set variables libdir, localedir.
|
jpayne@69
|
25 libdir="${exec_prefix}/lib"
|
jpayne@69
|
26 localedir="${datarootdir}/locale"
|
jpayne@69
|
27
|
jpayne@69
|
28 # Support for relocatability.
|
jpayne@69
|
29 if test "no" = yes; then
|
jpayne@69
|
30 orig_installdir="$libdir"/gettext # see Makefile.am's install rule
|
jpayne@69
|
31 # Determine curr_installdir without caring for symlinked callers.
|
jpayne@69
|
32 curr_installdir=`echo "$0" | sed -e 's,/[^/]*$,,'`
|
jpayne@69
|
33 curr_installdir=`cd "$curr_installdir" && pwd`
|
jpayne@69
|
34 # Compute the original/current installation prefixes by stripping the
|
jpayne@69
|
35 # trailing directories off the original/current installation directories.
|
jpayne@69
|
36 while true; do
|
jpayne@69
|
37 orig_last=`echo "$orig_installdir" | sed -n -e 's,^.*/\([^/]*\)$,\1,p'`
|
jpayne@69
|
38 curr_last=`echo "$curr_installdir" | sed -n -e 's,^.*/\([^/]*\)$,\1,p'`
|
jpayne@69
|
39 if test -z "$orig_last" || test -z "$curr_last"; then
|
jpayne@69
|
40 break
|
jpayne@69
|
41 fi
|
jpayne@69
|
42 if test "$orig_last" != "$curr_last"; then
|
jpayne@69
|
43 break
|
jpayne@69
|
44 fi
|
jpayne@69
|
45 orig_installdir=`echo "$orig_installdir" | sed -e 's,/[^/]*$,,'`
|
jpayne@69
|
46 curr_installdir=`echo "$curr_installdir" | sed -e 's,/[^/]*$,,'`
|
jpayne@69
|
47 done
|
jpayne@69
|
48 # Now relocate the directory variables that we use.
|
jpayne@69
|
49 libdir=`echo "$libdir/" | sed -e "s%^${orig_installdir}/%${curr_installdir}/%" | sed -e 's,/$,,'`
|
jpayne@69
|
50 localedir=`echo "$localedir/" | sed -e "s%^${orig_installdir}/%${curr_installdir}/%" | sed -e 's,/$,,'`
|
jpayne@69
|
51 fi
|
jpayne@69
|
52
|
jpayne@69
|
53 # Internationalization.
|
jpayne@69
|
54 . gettext.sh
|
jpayne@69
|
55 TEXTDOMAIN=gettext-tools
|
jpayne@69
|
56 export TEXTDOMAIN
|
jpayne@69
|
57 TEXTDOMAINDIR="$localedir"
|
jpayne@69
|
58 export TEXTDOMAINDIR
|
jpayne@69
|
59
|
jpayne@69
|
60 # Redirect fileno 3 to interactive I/O.
|
jpayne@69
|
61 exec 3>/dev/tty
|
jpayne@69
|
62
|
jpayne@69
|
63 # Output a prompt.
|
jpayne@69
|
64 if test $# != 0; then
|
jpayne@69
|
65 echo "$1" 1>&3
|
jpayne@69
|
66 fi
|
jpayne@69
|
67
|
jpayne@69
|
68 # Find the user name on the local machine.
|
jpayne@69
|
69 user=`id -u -n 2>/dev/null`
|
jpayne@69
|
70 if test -z "$user"; then
|
jpayne@69
|
71 user="$USER"
|
jpayne@69
|
72 if test -z "$user"; then
|
jpayne@69
|
73 user="$LOGNAME"
|
jpayne@69
|
74 if test -z "$user"; then
|
jpayne@69
|
75 user=unknown
|
jpayne@69
|
76 fi
|
jpayne@69
|
77 fi
|
jpayne@69
|
78 fi
|
jpayne@69
|
79
|
jpayne@69
|
80 # Find the hostname.
|
jpayne@69
|
81 # hostname on some systems (SVR3.2, old Linux) returns a bogus exit status,
|
jpayne@69
|
82 # so uname gets run too, so we keep only the first line of output.
|
jpayne@69
|
83 #host=`(hostname || uname -n) 2>/dev/null | sed 1q`
|
jpayne@69
|
84 host=`"$libdir"/gettext/hostname --short 2>/dev/null | sed 1q`
|
jpayne@69
|
85
|
jpayne@69
|
86 # Find the hostname.
|
jpayne@69
|
87 hostfqdn=`"$libdir"/gettext/hostname --fqdn 2>/dev/null | sed 1q`
|
jpayne@69
|
88
|
jpayne@69
|
89 # Find a list of email addresses from various mailer configuration files.
|
jpayne@69
|
90 # All mailers use configuration files under $HOME. We handle them in a
|
jpayne@69
|
91 # last-modified - first-priority order.
|
jpayne@69
|
92 cd $HOME
|
jpayne@69
|
93 files=""
|
jpayne@69
|
94
|
jpayne@69
|
95 # ----------------------- BEGIN MAILER SPECIFIC CODE -----------------------
|
jpayne@69
|
96
|
jpayne@69
|
97 # Mozilla Thunderbird addresses
|
jpayne@69
|
98 files="$files .thunderbird/*/prefs.js"
|
jpayne@69
|
99
|
jpayne@69
|
100 # Mozilla addresses
|
jpayne@69
|
101 files="$files .mozilla/*/prefs.js"
|
jpayne@69
|
102
|
jpayne@69
|
103 # Netscape 4 addresses
|
jpayne@69
|
104 files="$files .netscape/liprefs.js .netscape/preferences.js"
|
jpayne@69
|
105
|
jpayne@69
|
106 # Netscape 3 addresses
|
jpayne@69
|
107 files="$files .netscape/preferences"
|
jpayne@69
|
108
|
jpayne@69
|
109 # Emacs/XEmacs rmail, Emacs/XEmacs gnus, XEmacs vm addresses
|
jpayne@69
|
110 # XEmacs mew addresses
|
jpayne@69
|
111 files="$files .emacs .emacs.el"
|
jpayne@69
|
112
|
jpayne@69
|
113 # KDE2 addresses
|
jpayne@69
|
114 files="$files .kde2/share/config/emaildefaults"
|
jpayne@69
|
115
|
jpayne@69
|
116 # KDE kmail addresses
|
jpayne@69
|
117 files="$files .kde2/share/config/kmailrc"
|
jpayne@69
|
118
|
jpayne@69
|
119 # GNOME evolution 2 addresses
|
jpayne@69
|
120 files="$files .gconf/apps/evolution/mail/%gconf.xml"
|
jpayne@69
|
121
|
jpayne@69
|
122 # GNOME evolution 1 addresses
|
jpayne@69
|
123 files="$files evolution/config.xmldb"
|
jpayne@69
|
124
|
jpayne@69
|
125 # GNOME balsa addresses
|
jpayne@69
|
126 files="$files .gnome/balsa"
|
jpayne@69
|
127
|
jpayne@69
|
128 # StarOffice and OpenOffice addresses
|
jpayne@69
|
129 sed_dos2unix='s/\r$//'
|
jpayne@69
|
130 sed_soffice51='s,StarOffice 5\.1=\(.*\)$,\1/sofficerc,p'
|
jpayne@69
|
131 sed_soffice52='s,StarOffice 5\.2=\(.*\)$,\1/user/sofficerc,p'
|
jpayne@69
|
132 sed_ooffice='s,^OpenOffice[^=]*=\(.*\)$,\1/user/config/registry/instance/org/openoffice/UserProfile.xml,p'
|
jpayne@69
|
133 files="$files Office51/sofficerc Office52/user/sofficerc "`sed -n -e "$sed_dos2unix" -e "$sed_soffice51" -e "$sed_soffice52" -e "$sed_ooffice" .sversionrc 2>/dev/null | sed -e 's,^file://*,/,'`
|
jpayne@69
|
134
|
jpayne@69
|
135 # mutt addresses
|
jpayne@69
|
136 files="$files .muttrc"
|
jpayne@69
|
137
|
jpayne@69
|
138 # pine addresses
|
jpayne@69
|
139 files="$files .pinerc"
|
jpayne@69
|
140
|
jpayne@69
|
141 # xfmail addresses
|
jpayne@69
|
142 files="$files .xfmail/.xfmailrc"
|
jpayne@69
|
143
|
jpayne@69
|
144 # tkrat addresses
|
jpayne@69
|
145 files="$files .ratatosk/ratatoskrc"
|
jpayne@69
|
146
|
jpayne@69
|
147 # ----------------------- END MAILER SPECIFIC CODE -----------------------
|
jpayne@69
|
148
|
jpayne@69
|
149 # Expand wildcards and remove nonexistent files from the list.
|
jpayne@69
|
150 nfiles=""
|
jpayne@69
|
151 for file in $files; do
|
jpayne@69
|
152 if test -r "$file" && test ! -d "$file"; then
|
jpayne@69
|
153 nfiles="$nfiles $file"
|
jpayne@69
|
154 fi
|
jpayne@69
|
155 done
|
jpayne@69
|
156 files="$nfiles"
|
jpayne@69
|
157
|
jpayne@69
|
158 addresses=""
|
jpayne@69
|
159
|
jpayne@69
|
160 if test -n "$files"; then
|
jpayne@69
|
161
|
jpayne@69
|
162 for file in `ls -t $files`; do
|
jpayne@69
|
163
|
jpayne@69
|
164 case "$file" in
|
jpayne@69
|
165
|
jpayne@69
|
166 # ----------------------- BEGIN MAILER SPECIFIC CODE -----------------------
|
jpayne@69
|
167
|
jpayne@69
|
168 # Mozilla and Mozilla Thunderbird addresses
|
jpayne@69
|
169 .mozilla/*/prefs.js | .thunderbird/*/prefs.js)
|
jpayne@69
|
170 addresses="$addresses "`grep -h '^user_pref("mail\.identity\..*\.useremail", ".*");$' $file 2>/dev/null | sed -e 's/^user_pref("mail\.identity\..*\.useremail", "\(.*\)");$/\1/'`
|
jpayne@69
|
171 ;;
|
jpayne@69
|
172
|
jpayne@69
|
173 # Netscape 4 addresses
|
jpayne@69
|
174 .netscape/liprefs.js | .netscape/preferences.js)
|
jpayne@69
|
175 addresses="$addresses "`grep -h '^user_pref("mail\.identity\.useremail", ".*");$' $file 2>/dev/null | sed -e 's/^user_pref("mail\.identity\.useremail", "\(.*\)");$/\1/'`
|
jpayne@69
|
176 ;;
|
jpayne@69
|
177
|
jpayne@69
|
178 # Netscape 3 addresses
|
jpayne@69
|
179 .netscape/preferences)
|
jpayne@69
|
180 addresses="$addresses "`grep -h '^EMAIL_ADDRESS:' $file 2>/dev/null | sed -e 's/^EMAIL_ADDRESS:[ ]*//'`
|
jpayne@69
|
181 ;;
|
jpayne@69
|
182
|
jpayne@69
|
183 .emacs | .emacs.el)
|
jpayne@69
|
184 # Emacs/XEmacs rmail, Emacs/XEmacs gnus, XEmacs vm addresses
|
jpayne@69
|
185 addresses="$addresses "`grep -h '[ (]user-mail-address "[^"]*"' $file 2>/dev/null | sed -e 's/^.*[ (]user-mail-address "\([^"]*\)".*$/\1/'`
|
jpayne@69
|
186 # XEmacs mew addresses
|
jpayne@69
|
187 domains=`grep -h '[ (]mew-mail-domain "[^"]*"' $file 2>/dev/null | sed -e 's/^.*[ (]mew-mail-domain "\([^"]*\)".*$/\1/'`
|
jpayne@69
|
188 if test -n "$domains"; then
|
jpayne@69
|
189 for domain in $domains; do
|
jpayne@69
|
190 addresses="$addresses ${user}@$domain"
|
jpayne@69
|
191 done
|
jpayne@69
|
192 fi
|
jpayne@69
|
193 ;;
|
jpayne@69
|
194
|
jpayne@69
|
195 # KDE2 addresses
|
jpayne@69
|
196 .kde2/share/config/emaildefaults)
|
jpayne@69
|
197 addresses="$addresses "`grep -h '^EmailAddress=' $file 2>/dev/null | sed -e 's/^EmailAddress=//'`
|
jpayne@69
|
198 ;;
|
jpayne@69
|
199
|
jpayne@69
|
200 # KDE kmail addresses
|
jpayne@69
|
201 .kde2/share/config/kmailrc)
|
jpayne@69
|
202 addresses="$addresses "`grep -h '^Email Address=' $file 2>/dev/null | sed -e 's/^Email Address=//'`
|
jpayne@69
|
203 ;;
|
jpayne@69
|
204
|
jpayne@69
|
205 # GNOME evolution 2 addresses
|
jpayne@69
|
206 .gconf/apps/evolution/mail/%gconf.xml)
|
jpayne@69
|
207 sedexpr0='s,^.*<addr-spec>\(.*\)</addr-spec>.*$,\1,p'
|
jpayne@69
|
208 addresses="$addresses "`sed -n -e "$sedexpr0" < $file`
|
jpayne@69
|
209 ;;
|
jpayne@69
|
210
|
jpayne@69
|
211 # GNOME evolution 1 addresses
|
jpayne@69
|
212 evolution/config.xmldb)
|
jpayne@69
|
213 sedexpr0='s/^.*<entry name="identity_address_[0-9]*" type="string" value="\([^"]*\)".*$/\1/p'
|
jpayne@69
|
214 sedexpr1='s/\(..\)/\\x\1/g'
|
jpayne@69
|
215 sedexpr2='s,$,\\n,'
|
jpayne@69
|
216 addresses="$addresses "`sed -n -e "$sedexpr0" < $file | while read hexstring; do printf \`echo "$hexstring" | sed -e "$sedexpr1" -e "$sedexpr2"\`; done`
|
jpayne@69
|
217 ;;
|
jpayne@69
|
218
|
jpayne@69
|
219 # GNOME balsa addresses
|
jpayne@69
|
220 .gnome/balsa)
|
jpayne@69
|
221 addresses="$addresses "`grep -h '^Address=' $file 2>/dev/null | sed -e 's/^Address=//'`
|
jpayne@69
|
222 ;;
|
jpayne@69
|
223
|
jpayne@69
|
224 # OpenOffice addresses
|
jpayne@69
|
225 */UserProfile.xml)
|
jpayne@69
|
226 addresses="$addresses "`sed -n -e 's,^.*<mail cfg:type="string">\(.*\)</mail>.*$,\1,p' $file 2>/dev/null`
|
jpayne@69
|
227 ;;
|
jpayne@69
|
228
|
jpayne@69
|
229 # StarOffice addresses
|
jpayne@69
|
230 # Not a typo. They really write "Adress" with a single d.
|
jpayne@69
|
231 # German orthography...
|
jpayne@69
|
232 */sofficerc)
|
jpayne@69
|
233 addresses="$addresses "`grep -h '^User-Adress=' $file 2>/dev/null | sed -e 's/#[^#]*$//' -e 's/^.*#//'`
|
jpayne@69
|
234 ;;
|
jpayne@69
|
235
|
jpayne@69
|
236 # mutt addresses
|
jpayne@69
|
237 .muttrc)
|
jpayne@69
|
238 mutt_addresses=`grep -h '^set from="[^"]*"[ ]*$' $file 2>/dev/null | sed -e 's/^set from="\([^"]*\)"[ ]*$/\1/'`
|
jpayne@69
|
239 if test -n "$mutt_addresses"; then
|
jpayne@69
|
240 addresses="$addresses $mutt_addresses"
|
jpayne@69
|
241 else
|
jpayne@69
|
242 # mutt uses $EMAIL as fallback.
|
jpayne@69
|
243 if test -n "$EMAIL"; then
|
jpayne@69
|
244 addresses="$addresses $EMAIL"
|
jpayne@69
|
245 fi
|
jpayne@69
|
246 fi
|
jpayne@69
|
247 ;;
|
jpayne@69
|
248
|
jpayne@69
|
249 # pine addresses
|
jpayne@69
|
250 .pinerc)
|
jpayne@69
|
251 domains=`grep -h '^user-domain=' $file 2>/dev/null | sed -e 's/^user-domain=//'`
|
jpayne@69
|
252 if test -n "$domains"; then
|
jpayne@69
|
253 for domain in $domains; do
|
jpayne@69
|
254 addresses="$addresses ${user}@$domain"
|
jpayne@69
|
255 done
|
jpayne@69
|
256 else
|
jpayne@69
|
257 # The use-only-domain-name option is only used if the user-domain option is not present.
|
jpayne@69
|
258 domains=`grep -h '^use-only-domain-name=' $file 2>/dev/null | sed -e 's/^use-only-domain-name=//'`
|
jpayne@69
|
259 if test "Yes" = "$domains"; then
|
jpayne@69
|
260 addresses="$addresses ${user}@"`echo "$hostfqdn" | sed -e 's/^[^.]*\.//'`
|
jpayne@69
|
261 fi
|
jpayne@69
|
262 fi
|
jpayne@69
|
263 ;;
|
jpayne@69
|
264
|
jpayne@69
|
265 # xfmail addresses
|
jpayne@69
|
266 .xfmail/.xfmailrc)
|
jpayne@69
|
267 addresses="$addresses "`grep -h '^from=.*<.*>' $file 2>/dev/null | sed -e 's/^.*<\([^<>]*\)>.*$/\1/'`
|
jpayne@69
|
268 ;;
|
jpayne@69
|
269
|
jpayne@69
|
270 # tkrat addresses
|
jpayne@69
|
271 .ratatosk/ratatoskrc)
|
jpayne@69
|
272 domains=`grep -h '^set option(masquerade_as) ' $file 2>/dev/null | sed -e 's/^set option(masquerade_as) //'`
|
jpayne@69
|
273 if test -n "$domains"; then
|
jpayne@69
|
274 for domain in $domains; do
|
jpayne@69
|
275 addresses="$addresses ${user}@$domain"
|
jpayne@69
|
276 done
|
jpayne@69
|
277 else
|
jpayne@69
|
278 # The domain option is used only if the masquerade_as option is not present.
|
jpayne@69
|
279 domains=`grep -h '^set option(domain) ' $file 2>/dev/null | sed -e 's/^set option(domain) //'`
|
jpayne@69
|
280 if test -n "$domains"; then
|
jpayne@69
|
281 for domain in $domains; do
|
jpayne@69
|
282 addresses="$addresses ${user}@${host}.$domain"
|
jpayne@69
|
283 done
|
jpayne@69
|
284 fi
|
jpayne@69
|
285 fi
|
jpayne@69
|
286 ;;
|
jpayne@69
|
287
|
jpayne@69
|
288 # ----------------------- END MAILER SPECIFIC CODE -----------------------
|
jpayne@69
|
289
|
jpayne@69
|
290 esac
|
jpayne@69
|
291
|
jpayne@69
|
292 done
|
jpayne@69
|
293
|
jpayne@69
|
294 fi
|
jpayne@69
|
295
|
jpayne@69
|
296 # Some Debian systems have a file /etc/mailname.
|
jpayne@69
|
297 if test -r /etc/mailname; then
|
jpayne@69
|
298 hostmailname=`cat /etc/mailname`
|
jpayne@69
|
299 if test -n "$hostmailname"; then
|
jpayne@69
|
300 addresses="$addresses ${user}@$hostmailname"
|
jpayne@69
|
301 fi
|
jpayne@69
|
302 fi
|
jpayne@69
|
303
|
jpayne@69
|
304 # SuSE Linux >= 8.0 systems have a file /etc/sysconfig/mail.
|
jpayne@69
|
305 if test -r /etc/sysconfig/mail; then
|
jpayne@69
|
306 hostmailname=`. /etc/sysconfig/mail && echo "$FROM_HEADER"`
|
jpayne@69
|
307 if test -n "$hostmailname"; then
|
jpayne@69
|
308 addresses="$addresses ${user}@$hostmailname"
|
jpayne@69
|
309 fi
|
jpayne@69
|
310 fi
|
jpayne@69
|
311
|
jpayne@69
|
312 # elm has no user-defined addresses.
|
jpayne@69
|
313 # mailx has no user-defined addresses.
|
jpayne@69
|
314 # mh has no user-defined addresses.
|
jpayne@69
|
315 # They use the system default.
|
jpayne@69
|
316 addresses="$addresses ${user}@$hostfqdn"
|
jpayne@69
|
317
|
jpayne@69
|
318 # Normalize addresses: remove addresses without @, lowercase the part after @,
|
jpayne@69
|
319 # and remove duplicates.
|
jpayne@69
|
320 lowercase_sed='{
|
jpayne@69
|
321 h
|
jpayne@69
|
322 s/^[^@]*@\(.*\)$/\1/
|
jpayne@69
|
323 y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
|
jpayne@69
|
324 x
|
jpayne@69
|
325 s/^\([^@]*\)@.*/\1@/
|
jpayne@69
|
326 G
|
jpayne@69
|
327 s/\n//
|
jpayne@69
|
328 p
|
jpayne@69
|
329 }'
|
jpayne@69
|
330 naddresses=""
|
jpayne@69
|
331 for addr in $addresses; do
|
jpayne@69
|
332 case "$addr" in
|
jpayne@69
|
333 "<"*">") addr=`echo "$addr" | sed -e 's/^<//' -e 's/>$//'` ;;
|
jpayne@69
|
334 esac
|
jpayne@69
|
335 case "$addr" in
|
jpayne@69
|
336 *@*)
|
jpayne@69
|
337 addr=`echo "$addr" | sed -n -e "$lowercase_sed"`
|
jpayne@69
|
338 case " $naddresses " in
|
jpayne@69
|
339 *" $addr "*) ;;
|
jpayne@69
|
340 *) naddresses="$naddresses $addr" ;;
|
jpayne@69
|
341 esac
|
jpayne@69
|
342 ;;
|
jpayne@69
|
343 esac
|
jpayne@69
|
344 done
|
jpayne@69
|
345 addresses="$naddresses"
|
jpayne@69
|
346
|
jpayne@69
|
347 # Now it's time to ask the user.
|
jpayne@69
|
348 case "$addresses" in
|
jpayne@69
|
349 " "*" "*)
|
jpayne@69
|
350 # At least two addresses.
|
jpayne@69
|
351 lines=""
|
jpayne@69
|
352 i=0
|
jpayne@69
|
353 for addr in $addresses; do
|
jpayne@69
|
354 i=`expr $i + 1`
|
jpayne@69
|
355 lines="${lines}${i} ${addr}
|
jpayne@69
|
356 "
|
jpayne@69
|
357 done
|
jpayne@69
|
358 while true; do
|
jpayne@69
|
359 { gettext "Which is your email address?"; echo; } 1>&3
|
jpayne@69
|
360 echo "$lines" 1>&3
|
jpayne@69
|
361 { gettext "Please choose the number, or enter your email address."; echo; } 1>&3
|
jpayne@69
|
362 read answer < /dev/tty
|
jpayne@69
|
363 case "$answer" in
|
jpayne@69
|
364 *@*) ;;
|
jpayne@69
|
365 [0-9]*)
|
jpayne@69
|
366 i=0
|
jpayne@69
|
367 for addr in $addresses; do
|
jpayne@69
|
368 i=`expr $i + 1`
|
jpayne@69
|
369 if test "$i" = "$answer"; then
|
jpayne@69
|
370 break 2
|
jpayne@69
|
371 fi
|
jpayne@69
|
372 done
|
jpayne@69
|
373 ;;
|
jpayne@69
|
374 esac
|
jpayne@69
|
375 case "$answer" in
|
jpayne@69
|
376 "<"*">") answer=`echo "$answer" | sed -e 's/^<//' -e 's/>$//'` ;;
|
jpayne@69
|
377 esac
|
jpayne@69
|
378 case "$answer" in
|
jpayne@69
|
379 *" "*) { gettext "Invalid email address: invalid character."; echo; echo; } 1>&3 ; continue ;;
|
jpayne@69
|
380 *@*.*) ;;
|
jpayne@69
|
381 *@*) { gettext "Invalid email address: need a fully qualified host name or domain name."; echo; echo; } 1>&3 ; continue ;;
|
jpayne@69
|
382 *) { gettext "Invalid email address: missing @"; echo; echo; } 1>&3 ; continue ;;
|
jpayne@69
|
383 esac
|
jpayne@69
|
384 addr=`echo "$answer" | sed -n -e "$lowercase_sed"`
|
jpayne@69
|
385 break
|
jpayne@69
|
386 done
|
jpayne@69
|
387 ;;
|
jpayne@69
|
388 " "*)
|
jpayne@69
|
389 # One address.
|
jpayne@69
|
390 while true; do
|
jpayne@69
|
391 { gettext "Is the following your email address?"; echo; } 1>&3
|
jpayne@69
|
392 echo " $addresses" 1>&3
|
jpayne@69
|
393 { gettext "Please confirm by pressing Return, or enter your email address."; echo; } 1>&3
|
jpayne@69
|
394 read answer < /dev/tty
|
jpayne@69
|
395 if test -z "$answer"; then
|
jpayne@69
|
396 addr=`echo "$addresses" | sed -e 's/^ //'`
|
jpayne@69
|
397 break
|
jpayne@69
|
398 fi
|
jpayne@69
|
399 case "$answer" in
|
jpayne@69
|
400 "<"*">") answer=`echo "$answer" | sed -e 's/^<//' -e 's/>$//'` ;;
|
jpayne@69
|
401 esac
|
jpayne@69
|
402 case "$answer" in
|
jpayne@69
|
403 *" "*) { gettext "Invalid email address: invalid character."; echo; echo; } 1>&3 ; continue ;;
|
jpayne@69
|
404 *@*.*) ;;
|
jpayne@69
|
405 *@*) { gettext "Invalid email address: need a fully qualified host name or domain name."; echo; echo; } 1>&3 ; continue ;;
|
jpayne@69
|
406 *) { gettext "Invalid email address: missing @"; echo; echo; } 1>&3 ; continue ;;
|
jpayne@69
|
407 esac
|
jpayne@69
|
408 addr=`echo "$answer" | sed -n -e "$lowercase_sed"`
|
jpayne@69
|
409 break
|
jpayne@69
|
410 done
|
jpayne@69
|
411 ;;
|
jpayne@69
|
412 "")
|
jpayne@69
|
413 # No address.
|
jpayne@69
|
414 { gettext "Couldn't find out about your email address."; echo; } 1>&3
|
jpayne@69
|
415 while true; do
|
jpayne@69
|
416 { gettext "Please enter your email address."; echo; } 1>&3
|
jpayne@69
|
417 read answer < /dev/tty
|
jpayne@69
|
418 case "$answer" in
|
jpayne@69
|
419 "<"*">") answer=`echo "$answer" | sed -e 's/^<//' -e 's/>$//'` ;;
|
jpayne@69
|
420 esac
|
jpayne@69
|
421 case "$answer" in
|
jpayne@69
|
422 *" "*) { gettext "Invalid email address: invalid character."; echo; echo; } 1>&3 ; continue ;;
|
jpayne@69
|
423 *@*.*) ;;
|
jpayne@69
|
424 *@*) { gettext "Invalid email address: need a fully qualified host name or domain name."; echo; echo; } 1>&3 ; continue ;;
|
jpayne@69
|
425 *) { gettext "Invalid email address: missing @"; echo; echo; } 1>&3 ; continue ;;
|
jpayne@69
|
426 esac
|
jpayne@69
|
427 addr=`echo "$answer" | sed -n -e "$lowercase_sed"`
|
jpayne@69
|
428 break
|
jpayne@69
|
429 done
|
jpayne@69
|
430 ;;
|
jpayne@69
|
431 *) echo "internal error" 1>&3 ; exit 1 ;;
|
jpayne@69
|
432 esac
|
jpayne@69
|
433
|
jpayne@69
|
434 # Print to standard output.
|
jpayne@69
|
435 echo "$addr"
|