From bcc2c44d7b7238bac094a2e33bb26ceade5a429a Mon Sep 17 00:00:00 2001 From: Koki Fukuda Date: Wed, 25 Nov 2020 00:04:41 +0900 Subject: [PATCH] Add support for GNU-style command line options --- xclip.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xclip.c b/xclip.c index f326e4b..f4b6b0f 100644 --- a/xclip.c +++ b/xclip.c @@ -176,6 +176,14 @@ int clean_requestors() { static void doOptMain(int argc, char *argv[]) { + /* Support both -option and --option form. */ + int i; + for (i = 1; i < argc; ++i) { + if (!strncmp(argv[i], "--", 2)) { + argv[i]++; + } + } + /* Initialise resource manager and parse options into database */ XrmInitialize(); XrmParseCommand(&opt_db, opt_tab, opt_tab_size, PACKAGE_NAME, &argc,