#!/bin/sh
#
# Provide some enhancements to the wxpaste command, which pastes from X11
# clipboard text buffers to standard output.
#
# Allow pasting to stdout from any of the cutbuffers.  Note that they are
# indexed counting from 0.
#
# Author: Luke Kendall
#

if [ $# = 0 ]
then
    wxpaste $WXPASTE_DEFS
else
    MYNAME=`basename $0`
    USAGE="usage: $MYNAME [ [0-9]... ] [wxpaste's args]"
    for n
    do
	if expr "x$n" : 'x[0-9][0-9]*$' > /dev/null
	then
	    NUMARGS="$NUMARGS $n"
	elif [ "x$n" = "x-h" ]
	then
	    echo "$USAGE" >&2
	    exit 0
	else
	    WXARGS="$WXARGS $n"
	fi
    done
    set - $NUMARGS
    for n
    do
	wxpaste $WXPASTE_DEFS $WXARGS -cutbuffer $n
    done
fi
