code review
[wmaker-crm.git] / util / wcopy
blobb0618d3b50cf9d5f066b4ec0a19ada369cbb5aa8
1 #!/bin/sh
3 # Provide some enhancements to the wxcopy command, which copies standard input
4 # to an X11 clipboard text buffer.
6 # Allow copying from stdin to any of the cutbuffers. Note that they are
7 # indexed counting from 0.
9 # Author: Luke Kendall
12 if [ $# = 0 ]
13 then
14 wxcopy $WXCOPY_DEFS
15 else
16 MYNAME=`basename $0`
17 USAGE="usage: $MYNAME [ [0-9]... ] [wxcopy's args]"
18 for n
20 if expr "x$n" : 'x[0-9][0-9]*$' > /dev/null
21 then
22 NUMARGS="$NUMARGS $n"
23 elif [ "x$n" = "x-h" ]
24 then
25 echo "$USAGE" >&2
26 exit 0
27 else
28 WXARGS="$WXARGS $n"
30 done
31 set - $NUMARGS
32 wxcopy $WXCOPY_DEFS $WXARGS -cutbuffer $1
33 ORIG="$1"
34 shift
35 for n
37 wxpaste -cutbuffer $ORIG | wxcopy $WXCOPY_DEFS $WXARGS -cutbuffer $n
38 done