xclip
uses the X Toolkit library, which does the options-parsing. All of the options can be abbreviated. The library only gives an error if there is an ambiguity.
Options, of course, are things like -select
which can be abbreviated as -sel
(possibly even -s
).
xterm
uses the same library, same behavior. It uses special cases (outside the library) to make the -v
command a unique abbreviation for -version
, etc.
X Toolkit uses a single dash -
for options, and does not distinguish between "short" and "long" because it is not an extension of getopt
. As I pointed out in Single dashes -
for single-character options, but double dashes --
for words?, it was introduced around the same time as GNU getopt, which did extend getopt
. This was before POSIX came along, but AT&T
getopt
had several years of use, establishing its role for single-character options. GNU getopt
uses a double-dash --
to denote long options.
Noting a long digression, you can read the source code for GNU getopt (which is unrelated to xclip
) from its git repository, e.g.,
369 Long-named options begin with `--' instead of `-'.
370 Their names may be abbreviated as long as the abbreviation is unique
371 or is an exact match for some defined option. If they have an
372 argument, it follows the option name in the same ARGV-element, separated
373 from the option name by a `=', or else the in next ARGV-element.
374 When `getopt' finds a long-named option, it returns 0 if that option's
375 `flag' field is nonzero, the value of the option's `val' field
376 if the `flag' field is zero.