This mini C code is very useful when a X session is started on your system.
With this code you can manage all three keyboard leds when and how you wants.
One example: with a command line like the following, you will modify NUMLOCK and CAPSLOCK status:
$ XLeds num caps
If NUMLOCK's led is ON it will be set to OFF and vice-versa. Idem for CAPSLOCK.
In order to compile this program you must have installed on your system the developement libraries of XFree86 X server.
You must compile this code with:
gcc -lX11 -lXtst -I/usr/X11R6/include -L/usr/X11R6/lib XLeds.c -o XLeds
or with the following to activate some debug messages:
gcc -lX11 -lXtst -I/usr/X11R6/include -L/usr/X11R6/lib XLeds.c -D__DEBUG -o XLedsHere are the source code.