senddoc.sh (ba2c76b2) | senddoc.sh (14c7d0b5) |
---|---|
1#!/bin/sh 2# ************************************************************* | 1#!/bin/sh 2# ************************************************************* |
3# | 3# |
4# Licensed to the Apache Software Foundation (ASF) under one 5# or more contributor license agreements. See the NOTICE file 6# distributed with this work for additional information 7# regarding copyright ownership. The ASF licenses this file 8# to you under the Apache License, Version 2.0 (the 9# "License"); you may not use this file except in compliance 10# with the License. You may obtain a copy of the License at | 4# Licensed to the Apache Software Foundation (ASF) under one 5# or more contributor license agreements. See the NOTICE file 6# distributed with this work for additional information 7# regarding copyright ownership. The ASF licenses this file 8# to you under the Apache License, Version 2.0 (the 9# "License"); you may not use this file except in compliance 10# with the License. You may obtain a copy of the License at |
11# | 11# |
12# http://www.apache.org/licenses/LICENSE-2.0 | 12# http://www.apache.org/licenses/LICENSE-2.0 |
13# | 13# |
14# Unless required by applicable law or agreed to in writing, 15# software distributed under the License is distributed on an 16# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17# KIND, either express or implied. See the License for the 18# specific language governing permissions and limitations 19# under the License. | 14# Unless required by applicable law or agreed to in writing, 15# software distributed under the License is distributed on an 16# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17# KIND, either express or implied. See the License for the 18# specific language governing permissions and limitations 19# under the License. |
20# | 20# |
21# ************************************************************* 22URI_ENCODE="`dirname "$0"`/uri-encode" 23FOPTS="" 24 | 21# ************************************************************* 22URI_ENCODE="`dirname "$0"`/uri-encode" 23FOPTS="" 24 |
25# linux file utility needs -L option to resolve symlinks | 25# Linux file utility needs -L option to resolve symlinks |
26if [ "`uname -s`" = "Linux" ] 27then 28 FOPTS="-L" 29fi 30 | 26if [ "`uname -s`" = "Linux" ] 27then 28 FOPTS="-L" 29fi 30 |
31# do not confuse the system mail clients with OOo and Java libraries | 31# do not confuse the system mail clients with AOO and Java libraries |
32unset LD_LIBRARY_PATH 33 | 32unset LD_LIBRARY_PATH 33 |
34# tries to locate the executable specified | 34# tries to locate the executable specified |
35# as first parameter in the user's path. 36which() { 37 if [ ! -z "$1" ]; then 38 for i in `echo $PATH | sed -e 's/^:/.:/g' -e 's/:$/:./g' -e 's/::/:.:/g' -e 's/:/ /g'`; do 39 if [ -x "$i/$1" -a ! -d "$i/$1" ]; then 40 echo "$i/$1" 41 break; 42 fi 43 done 44 fi 45} 46 | 35# as first parameter in the user's path. 36which() { 37 if [ ! -z "$1" ]; then 38 for i in `echo $PATH | sed -e 's/^:/.:/g' -e 's/:$/:./g' -e 's/::/:.:/g' -e 's/:/ /g'`; do 39 if [ -x "$i/$1" -a ! -d "$i/$1" ]; then 40 echo "$i/$1" 41 break; 42 fi 43 done 44 fi 45} 46 |
47# checks for the original mozilla start script(s) | 47# checks for the original Mozilla start script(s) |
48# and restrict the "-remote" semantics to those. 49run_mozilla() { 50 # find mozilla script in PATH if necessary 51 if [ "`basename $1`" = "$1" ]; then 52 moz=`which $1` 53 else 54 moz=$1 55 fi --- 15 unchanged lines hidden (view full) --- 71 MAILER=$1 72 shift 73fi 74 75# autodetect mail client from executable name 76case `basename "$MAILER" | sed 's/-.*$//'` in 77 78 iceape | mozilla | netscape | seamonkey | icedove | thunderbird) | 48# and restrict the "-remote" semantics to those. 49run_mozilla() { 50 # find mozilla script in PATH if necessary 51 if [ "`basename $1`" = "$1" ]; then 52 moz=`which $1` 53 else 54 moz=$1 55 fi --- 15 unchanged lines hidden (view full) --- 71 MAILER=$1 72 shift 73fi 74 75# autodetect mail client from executable name 76case `basename "$MAILER" | sed 's/-.*$//'` in 77 78 iceape | mozilla | netscape | seamonkey | icedove | thunderbird) |
79 | 79 |
80 while [ "$1" != "" ]; do 81 case $1 in 82 --to) 83 TO=${TO:-}${TO:+,}$2 84 shift 85 ;; 86 --cc) 87 CC=${CC:-}${CC:+,}$2 --- 34 unchanged lines hidden (view full) --- 122 COMMAND=${COMMAND:-}${COMMAND:+,}subject=\'${SUBJECT}\' 123 fi 124 if [ "$BODY" != "" ]; then 125 COMMAND=${COMMAND:-}${COMMAND:+,}body=\'${BODY}\' 126 fi 127 if [ "$ATTACH" != "" ]; then 128 COMMAND=${COMMAND:-}${COMMAND:+,}attachment=\'${ATTACH}\' 129 fi | 80 while [ "$1" != "" ]; do 81 case $1 in 82 --to) 83 TO=${TO:-}${TO:+,}$2 84 shift 85 ;; 86 --cc) 87 CC=${CC:-}${CC:+,}$2 --- 34 unchanged lines hidden (view full) --- 122 COMMAND=${COMMAND:-}${COMMAND:+,}subject=\'${SUBJECT}\' 123 fi 124 if [ "$BODY" != "" ]; then 125 COMMAND=${COMMAND:-}${COMMAND:+,}body=\'${BODY}\' 126 fi 127 if [ "$ATTACH" != "" ]; then 128 COMMAND=${COMMAND:-}${COMMAND:+,}attachment=\'${ATTACH}\' 129 fi |
130 | 130 |
131 run_mozilla "$MAILER" "$COMMAND" 132 ;; | 131 run_mozilla "$MAILER" "$COMMAND" 132 ;; |
133 134 kmail) | |
135 | 133 |
136 while [ "$1" != "" ]; do 137 case $1 in 138 --to) 139 TO="${TO:-}${TO:+,}$2" 140 shift 141 ;; 142 --cc) 143 CC="${CC:-}${CC:+,}$2" 144 shift 145 ;; 146 --bcc) 147 BCC="${BCC:-}${BCC:+,}$2" 148 shift 149 ;; 150 --subject) 151 SUBJECT="$2" 152 shift 153 ;; 154 --body) 155 BODY="$2" 156 shift 157 ;; 158 --from) 159 FROM="$2" 160 shift 161 ;; 162 --attach) 163 ATTACH="${ATTACH:-}${ATTACH:+ }--attach "`echo "file://$2" | "${URI_ENCODE}"` 164 shift 165 ;; 166 *) 167 ;; 168 esac 169 shift; 170 done | 134 kmail) |
171 | 135 |
172 ${MAILER} --composer \ 173 ${CC:+--cc} ${CC:+"${CC}"} \ 174 ${BCC:+--bcc} ${BCC:+"${BCC}"} \ 175 ${SUBJECT:+--subject} ${SUBJECT:+"${SUBJECT}"} \ 176 ${BODY:+--body} ${BODY:+"${BODY}"} \ 177 ${FROM:+--header} ${FROM:+"From: ${FROM}"} \ 178 ${ATTACH:+${ATTACH}} \ 179 ${TO:+"${TO}"} 180 ;; 181 | 136 while [ "$1" != "" ]; do 137 case $1 in 138 --to) 139 TO="${TO:-}${TO:+,}$2" 140 shift 141 ;; 142 --cc) 143 CC="${CC:-}${CC:+,}$2" 144 shift 145 ;; 146 --bcc) 147 BCC="${BCC:-}${BCC:+,}$2" 148 shift 149 ;; 150 --subject) 151 SUBJECT="$2" 152 shift 153 ;; 154 --body) 155 BODY="$2" 156 shift 157 ;; 158 --from) 159 FROM="$2" 160 shift 161 ;; 162 --attach) 163 ATTACH="${ATTACH:-}${ATTACH:+ }--attach "`echo "file://$2" | "${URI_ENCODE}"` 164 shift 165 ;; 166 *) 167 ;; 168 esac 169 shift; 170 done 171 172 ${MAILER} --composer \ 173 ${CC:+--cc} ${CC:+"${CC}"} \ 174 ${BCC:+--bcc} ${BCC:+"${BCC}"} \ 175 ${SUBJECT:+--subject} ${SUBJECT:+"${SUBJECT}"} \ 176 ${BODY:+--body} ${BODY:+"${BODY}"} \ 177 ${FROM:+--header} ${FROM:+"From: ${FROM}"} \ 178 ${ATTACH:+${ATTACH}} \ 179 ${TO:+"${TO}"} 180 ;; 181 |
182 mutt) | 182 mutt) |
183 | 183 |
184 while [ "$1" != "" ]; do 185 case $1 in 186 --from) 187 FROM="$2" 188 shift 189 ;; 190 --to) 191 TO="${TO:-}${TO:+,}$2" --- 21 unchanged lines hidden (view full) --- 213 ATTACH="$2" 214 shift 215 ;; 216 *) 217 ;; 218 esac 219 shift; 220 done | 184 while [ "$1" != "" ]; do 185 case $1 in 186 --from) 187 FROM="$2" 188 shift 189 ;; 190 --to) 191 TO="${TO:-}${TO:+,}$2" --- 21 unchanged lines hidden (view full) --- 213 ATTACH="$2" 214 shift 215 ;; 216 *) 217 ;; 218 esac 219 shift; 220 done |
221 | 221 |
222 x-terminal-emulator -e ${MAILER} \ 223 ${FROM:+-e} ${FROM:+"set from=\"${FROM}\""} \ 224 ${CC:+-c} ${CC:+"${CC}"} \ 225 ${BCC:+-b} ${BCC:+"${BCC}"} \ 226 ${SUBJECT:+-s} ${SUBJECT:+"${SUBJECT}"} \ 227 ${BODY:+-i} ${BODY:+"${BODY}"} \ 228 ${ATTACH:+-a} ${ATTACH:+"${ATTACH}"} \ 229 ${TO:+"${TO}"} & 230 rm -f $BODY 231 ;; | 222 x-terminal-emulator -e ${MAILER} \ 223 ${FROM:+-e} ${FROM:+"set from=\"${FROM}\""} \ 224 ${CC:+-c} ${CC:+"${CC}"} \ 225 ${BCC:+-b} ${BCC:+"${BCC}"} \ 226 ${SUBJECT:+-s} ${SUBJECT:+"${SUBJECT}"} \ 227 ${BODY:+-i} ${BODY:+"${BODY}"} \ 228 ${ATTACH:+-a} ${ATTACH:+"${ATTACH}"} \ 229 ${TO:+"${TO}"} & 230 rm -f $BODY 231 ;; |
232 | 232 |
233 evolution) | 233 evolution) |
234 | 234 |
235 while [ "$1" != "" ]; do 236 case $1 in 237 --to) 238 if [ "${TO}" != "" ]; then 239 MAILTO="${MAILTO:-}${MAILTO:+&}to=$2" 240 else 241 TO="$2" 242 fi --- 19 unchanged lines hidden (view full) --- 262 MAILTO="${MAILTO:-}${MAILTO:+&}attach="`echo "file://$2" | "${URI_ENCODE}"` 263 shift 264 ;; 265 *) 266 ;; 267 esac 268 shift; 269 done | 235 while [ "$1" != "" ]; do 236 case $1 in 237 --to) 238 if [ "${TO}" != "" ]; then 239 MAILTO="${MAILTO:-}${MAILTO:+&}to=$2" 240 else 241 TO="$2" 242 fi --- 19 unchanged lines hidden (view full) --- 262 MAILTO="${MAILTO:-}${MAILTO:+&}attach="`echo "file://$2" | "${URI_ENCODE}"` 263 shift 264 ;; 265 *) 266 ;; 267 esac 268 shift; 269 done |
270 | 270 |
271 MAILTO="mailto:${TO}?${MAILTO}" 272 ${MAILER} "${MAILTO}" & 273 ;; | 271 MAILTO="mailto:${TO}?${MAILTO}" 272 ${MAILER} "${MAILTO}" & 273 ;; |
274 | 274 |
275 groupwise) | 275 groupwise) |
276 | 276 |
277 while [ "$1" != "" ]; do 278 case $1 in 279 --to) 280 if [ "${TO}" != "" ]; then 281 MAILTO="${MAILTO:-}${MAILTO:+&}to=$2" 282 else 283 TO="$2" 284 fi --- 19 unchanged lines hidden (view full) --- 304 MAILTO="${MAILTO:-}${MAILTO:+&}attachment="`echo "file://$2" | "${URI_ENCODE}"` 305 shift 306 ;; 307 *) 308 ;; 309 esac 310 shift; 311 done | 277 while [ "$1" != "" ]; do 278 case $1 in 279 --to) 280 if [ "${TO}" != "" ]; then 281 MAILTO="${MAILTO:-}${MAILTO:+&}to=$2" 282 else 283 TO="$2" 284 fi --- 19 unchanged lines hidden (view full) --- 304 MAILTO="${MAILTO:-}${MAILTO:+&}attachment="`echo "file://$2" | "${URI_ENCODE}"` 305 shift 306 ;; 307 *) 308 ;; 309 esac 310 shift; 311 done |
312 | 312 |
313 MAILTO="mailto:${TO}?${MAILTO}" 314 ${MAILER} "${MAILTO}" & 315 ;; 316 317 dtmail) | 313 MAILTO="mailto:${TO}?${MAILTO}" 314 ${MAILER} "${MAILTO}" & 315 ;; 316 317 dtmail) |
318 | 318 |
319 while [ "$1" != "" ]; do 320 case $1 in 321 --to) 322 TO=${TO:-}${TO:+,}$2 323 shift 324 ;; 325 --attach) 326 ATTACH="$2" 327 shift 328 ;; 329 *) 330 ;; 331 esac 332 shift; 333 done | 319 while [ "$1" != "" ]; do 320 case $1 in 321 --to) 322 TO=${TO:-}${TO:+,}$2 323 shift 324 ;; 325 --attach) 326 ATTACH="$2" 327 shift 328 ;; 329 *) 330 ;; 331 esac 332 shift; 333 done |
334 | 334 |
335 ${MAILER} ${TO:+-T} ${TO:-} ${ATTACH:+-a} ${ATTACH:+"${ATTACH}"} 336 ;; 337 | 335 ${MAILER} ${TO:+-T} ${TO:-} ${ATTACH:+-a} ${ATTACH:+"${ATTACH}"} 336 ;; 337 |
338 sylpheed | claws) 339 | 338 sylpheed | claws | claws-mail) 339 |
340 while [ "$1" != "" ]; do 341 case $1 in 342 --to) 343 TO=${TO:-}${TO:+,}$2 344 shift 345 ;; 346 --attach) 347 ATTACH="${ATTACH:-}${ATTACH:+ }$2" 348 shift 349 ;; 350 *) 351 ;; 352 esac 353 shift; 354 done | 340 while [ "$1" != "" ]; do 341 case $1 in 342 --to) 343 TO=${TO:-}${TO:+,}$2 344 shift 345 ;; 346 --attach) 347 ATTACH="${ATTACH:-}${ATTACH:+ }$2" 348 shift 349 ;; 350 *) 351 ;; 352 esac 353 shift; 354 done |
355 | 355 |
356 ${MAILER} ${TO:+--compose} "${TO:-}" ${ATTACH:+--attach} "${ATTACH:-}" 357 ;; 358 359 Mail | Thunderbird | *.app ) 360 361 while [ "$1" != "" ]; do 362 case $1 in 363 --attach) --- 5 unchanged lines hidden (view full) --- 369 ;; 370 esac 371 shift; 372 done 373 /usr/bin/open -a "${MAILER}" ${ATTACH} 374 ;; 375 376 "") | 356 ${MAILER} ${TO:+--compose} "${TO:-}" ${ATTACH:+--attach} "${ATTACH:-}" 357 ;; 358 359 Mail | Thunderbird | *.app ) 360 361 while [ "$1" != "" ]; do 362 case $1 in 363 --attach) --- 5 unchanged lines hidden (view full) --- 369 ;; 370 esac 371 shift; 372 done 373 /usr/bin/open -a "${MAILER}" ${ATTACH} 374 ;; 375 376 "") |
377 | 377 |
378 # DESKTOP_LAUNCH, see http://freedesktop.org/pipermail/xdg/2004-August/004489.html 379 if [ -n "$DESKTOP_LAUNCH" ]; then 380 while [ "$1" != "" ]; do 381 case $1 in 382 --to) 383 if [ "${TO}" != "" ]; then 384 MAILTO="${MAILTO:-}${MAILTO:+&}to=$2" 385 else --- 21 unchanged lines hidden (view full) --- 407 MAILTO="${MAILTO:-}${MAILTO:+&}attachment="`echo "$2" | "${URI_ENCODE}"` 408 shift 409 ;; 410 *) 411 ;; 412 esac 413 shift; 414 done | 378 # DESKTOP_LAUNCH, see http://freedesktop.org/pipermail/xdg/2004-August/004489.html 379 if [ -n "$DESKTOP_LAUNCH" ]; then 380 while [ "$1" != "" ]; do 381 case $1 in 382 --to) 383 if [ "${TO}" != "" ]; then 384 MAILTO="${MAILTO:-}${MAILTO:+&}to=$2" 385 else --- 21 unchanged lines hidden (view full) --- 407 MAILTO="${MAILTO:-}${MAILTO:+&}attachment="`echo "$2" | "${URI_ENCODE}"` 408 shift 409 ;; 410 *) 411 ;; 412 esac 413 shift; 414 done |
415 | 415 |
416 MAILTO="mailto:${TO}?${MAILTO}" 417 ${DESKTOP_LAUNCH} "${MAILTO}" & 418 else 419 echo "Could not determine a mail client to use." 420 exit 2 421 fi 422 ;; | 416 MAILTO="mailto:${TO}?${MAILTO}" 417 ${DESKTOP_LAUNCH} "${MAILTO}" & 418 else 419 echo "Could not determine a mail client to use." 420 exit 2 421 fi 422 ;; |
423 | 423 |
424 *) 425 echo "Unsupported mail client: `basename $MAILER | sed 's/-.*^//'`" 426 exit 2 427 ;; | 424 *) 425 echo "Unsupported mail client: `basename $MAILER | sed 's/-.*^//'`" 426 exit 2 427 ;; |
428esac 429 | 428esac 429 |
430exit 0 | 430exit 0 |