alols / xcape

Linux utility to configure modifier keys to act as other keys when pressed and released on their own.
GNU General Public License v3.0
2.1k stars 117 forks source link

Creates a dummy process with incorrect arguments #25

Closed gideonite closed 9 years ago

gideonite commented 10 years ago

If you run xcape with no arguments it creates a process:

$ ./path/to/xcape
$ ps aux | grep xcape
=> username   21310  0.0  0.0  30508   720 ?        Ssl  18:19   0:00 ./xcape

If you run it with an argument that does not have a -:

$ ./path/to/xcape foobar
$ ps aux | grep xcape
=> a     bunch     of     stuff    ./xcape foobar

It'd be great if these threw an error, even if it's clear that options to linux commands always start with -.

I think that this has something to do with the way arguments are being handled with getopt and that optind may hold the answer but I haven't been able to pin down where to put the check for argv[optind] != NULL. Correct me if I'm on the wrong track here.

alols commented 10 years ago

It should run without arguments. It defaults to mapping unused CTRL to ESC. Originally this was all that it did so it didn't need arguments. I wont change the default behaviour now because that would cause problems for many users.

However, you have a point that invalid arguments should at least produce a warning.