OLD | NEW |
(Empty) | |
| 1 #!/bin/sh |
| 2 #--------------------------------------------- |
| 3 # xdg-copy |
| 4 # |
| 5 # Utility script to copy files specified by URLs, including |
| 6 # downloading and uploading from/to remote sites. |
| 7 # |
| 8 # Refer to the usage() function below for usage. |
| 9 # |
| 10 # Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at> |
| 11 # Copyright 2006, Jeremy White <jwhite@codeweavers.com> |
| 12 # |
| 13 # LICENSE: |
| 14 # |
| 15 #--------------------------------------------- |
| 16 |
| 17 manualpage() |
| 18 { |
| 19 cat << _MANUALPAGE |
| 20 _MANUALPAGE |
| 21 } |
| 22 |
| 23 usage() |
| 24 { |
| 25 cat << _USAGE |
| 26 _USAGE |
| 27 } |
| 28 |
| 29 #@xdg-utils-common@ |
| 30 |
| 31 copy_kde() |
| 32 { |
| 33 kfmclient copy "$1" "$2" |
| 34 |
| 35 if [ $? -eq 0 ]; then |
| 36 exit_success |
| 37 else |
| 38 exit_failure_operation_failed |
| 39 fi |
| 40 } |
| 41 |
| 42 copy_gnome() |
| 43 { |
| 44 gnomevfs-copy "$1" "$2" |
| 45 |
| 46 if [ $? -eq 0 ]; then |
| 47 exit_success |
| 48 else |
| 49 exit_failure_operation_failed |
| 50 fi |
| 51 } |
| 52 |
| 53 [ x"$1" != x"" ] || exit_failure_syntax |
| 54 |
| 55 source= |
| 56 dest= |
| 57 while [ $# -gt 0 ] ; do |
| 58 parm=$1 |
| 59 shift |
| 60 |
| 61 case $parm in |
| 62 -*) |
| 63 exit_failure_syntax "unexpected option '$parm'" |
| 64 ;; |
| 65 |
| 66 *) |
| 67 if [ -n "$dest" ] ; then |
| 68 exit_failure_syntax "unexpected argument '$parm'" |
| 69 fi |
| 70 if [ -n "$source" ] ; then |
| 71 dest=$parm |
| 72 else |
| 73 source=$parm |
| 74 fi |
| 75 ;; |
| 76 esac |
| 77 done |
| 78 |
| 79 if [ -z "${source}" ] ; then |
| 80 exit_failure_syntax "source argument missing" |
| 81 fi |
| 82 if [ -z "${dest}" ] ; then |
| 83 exit_failure_syntax "destination argument missing" |
| 84 fi |
| 85 |
| 86 detectDE |
| 87 |
| 88 case "$DE" in |
| 89 kde) |
| 90 copy_kde "$source" "$dest" |
| 91 ;; |
| 92 |
| 93 gnome) |
| 94 copy_gnome "$source" "$dest" |
| 95 ;; |
| 96 |
| 97 *) |
| 98 exit_failure_operation_impossible "no method available for copying '$source'
to '$dest'" |
| 99 ;; |
| 100 esac |
OLD | NEW |