Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion xclip.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "xclib.h"

/* command line option table for XrmParseCommand() */
XrmOptionDescRec opt_tab[14];
XrmOptionDescRec opt_tab[17];

/* Options that get set on the command line */
int sloop = 0; /* number of loops */
Expand Down Expand Up @@ -265,6 +265,12 @@ doOptTarget(void)
if (fverb == OVERBOSE) /* print in verbose mode only */
fprintf(stderr, "Using %s.\n", rec_val.addr);
}
else if (XrmGetResource(opt_db, "xclip.TARGETS", "", &rec_typ, &rec_val) ) {
target = XInternAtom(dpy, "TARGETS", False);
fdiri = F; /* always output when -T used */
if (fverb == OVERBOSE) /* print in verbose mode only */
fprintf(stderr, "Using TARGETS.\n");
}
else {
target = XA_UTF8_STRING(dpy);
if (fverb == OVERBOSE) /* print in verbose mode only */
Expand Down Expand Up @@ -666,6 +672,24 @@ main(int argc, char *argv[])
opt_tab[13].argKind = XrmoptionNoArg;
opt_tab[13].value = (XPointer) xcstrdup(ST);

/* -T is shorthand for "-target TARGETS" */
opt_tab[14].option = xcstrdup("-TARGETS");
opt_tab[14].specifier = xcstrdup(".TARGETS");
opt_tab[14].argKind = XrmoptionNoArg;
opt_tab[14].value = (XPointer) xcstrdup("T");

/* -c is shorthand for "-selection clipboard" */
opt_tab[15].option = xcstrdup("-clipboard");
opt_tab[15].specifier = xcstrdup(".selection");
opt_tab[15].argKind = XrmoptionNoArg;
opt_tab[15].value = (XPointer) xcstrdup("clipboard");

/* Allow -b as synonym for -c for folks used to xsel */
opt_tab[16].option = xcstrdup("-board");
opt_tab[16].specifier = xcstrdup(".selection");
opt_tab[16].argKind = XrmoptionNoArg;
opt_tab[16].value = (XPointer) xcstrdup("clipboard");

/* parse command line options */
doOptMain(argc, argv);

Expand Down