summaryrefslogtreecommitdiff
path: root/setxkbmap.c
AgeCommit message (Collapse)Author
2021-12-31make functions staticWalter Harms
It is good practise to make functions static to prevent export by accident Signed-off-by: Walter Harms <wharms@bfs.de>
2021-12-31fix exit statusWalter Harms
the status of exit() is actually status & 0377 change status value to return as intended Signed-off-by: Walter Harms <wharms@bfs.de>
2021-12-31fix: warning: assignment discards ‘const’ qualifier from pointer target typeWalter Harms
fix: warning: assignment discards ‘const’ qualifier from pointer target type make warning go away with casting Signed-off-by: Walter Harms <wharms@bfs.de>
2021-07-13Check for Xwayland and print a warningPeter Hutterer
Running setxkbmap isn't supported by Xwayland, so let's warn the user that this won't work. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Acked-by: Olivier Fourdan <ofourdan@redhat.com>
2019-06-09Correct error messages for missing/invalid file passed to -configAlan Coopersmith
Now a non-existent file prints: Couldn't find configuration file "not-there" and a file that fails to parse prints: Couldn't parse configuration file "not-right" Fixes: #3, https://bugs.freedesktop.org/show_bug.cgi?id=101845 Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-08-30Printing the program's version number on -version.Benno Schulenberg
Also unwrap a help-text line, as it looks neater and stays within 80 characters, and alphabetize the -help option in the man page. Signed-off-by: Benno Schulenberg <bensberg@justemail.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> [squashed in: include "config.h" directive] Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-07-02Ensure consistency between the manpage and the output of the -h optionStéphane Aulery
This is in addition to the correction [1] for bug #524510 reported by Debian [2]. [1] http://cgit.freedesktop.org/xorg/app/setxkbmap/commit/?id=2011f509c56b73cc62105c689d702f279f522017 [2] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=524510 Signed-off-by: Stéphane Aulery <lkppo@free.fr> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-02-12Use C99 struct initializer for cmdNames in applyComponentNamesAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-02-12Make len a size_t instead of converting back & forth to an intAlan Coopersmith
Gets rid of a number of clang warnings: setxkbmap.c:689:28: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32] len = strlen(orig) + 1; ~ ~~~~~~~~~~~~~^~~ setxkbmap.c:701:39: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion] orig = (char *) realloc(orig, len); ~~~~~~~ ^~~ setxkbmap.c:707:32: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion] orig = (char *) calloc(len, 1); ~~~~~~ ^~~ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-02-12Move global rules variable into applyRules, the only function that uses itAlan Coopersmith
Clears gcc warning: setxkbmap.c: In function `tryLoadRules': setxkbmap.c:811: warning: declaration of 'rules' shadows a global declaration setxkbmap.c:132: warning: shadowed declaration is here No longer marked static, since the function is called exactly once, so storing the value across calls seems pointless. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-28Add const attributes to fix gcc -Wwrite-strings warningsAlan Coopersmith
Fixes many, but not all, of the warnings raised by this option Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-02-28Minor style changes in help message.Van de Bugger
1. `args' renamed to `options'. (xkbcomp and gcc name these entities `options'). 2. `Where legal args are:' replaced with `Options:'. (Short and correct. As I remember, GNU does not recommend to use word `legal' unless it related to law and lawyers). 3. Option descriptions shifted right by 2 space. (Like gcc.) Signed-off-by: Van de Bugger <van.de.bugger@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-02-28Few messages added for easier troubleshooting.Van de Bugger
If setxkbmap fails to load rules file, it is not possible to find out where setxkbmap looks for it. Increasing verbosity level does not help: $ ./setxkbmap -v 10 Setting verbose level to 10 locale is C Couldn't find rules file (evdev) The problem fixed by adding two messages: before loading file and after successful loading. Messages are displayed if verbosity level is 8 or higher: $ ./setxkbmap -v 10 Setting verbose level to 10 locale is C Trying to load rules file ./rules/evdev... Trying to load rules file /usr/local/share/X11/xkb/rules/evdev... Couldn't find rules file (evdev) Signed-off-by: Van de Bugger <van.de.bugger@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-02-28Consistent handling of memory allocation errors.Van de Bugger
Macro `OOM' ("Out of memory") introduced for checking and reporting memory allocation errors. The same macro is used in all the cases. One check was missed in original source; fixed. Changes after patch review: 1. `OOM' macro uses `do ... while (0)'. 2. `exit(-1)', not `abort()'. Signed-off-by: Van de Bugger <van.de.bugger@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-02-25Removed unused arg subdir in function findFileInPath()Alexandr Shadchin
Signed-off-by: Alexandr Shadchin <Alexandr.Shadchin@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-02-23Minor style fixes.Van de Bugger
Few tabs replaced with spaces; pointers are written as "list_t *list" (no space between asterisk and variable name). Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-02-23Set of macros converted to enum type.Lev Nezhdanov
Signed-off-by: Van de Bugger <van.de.bugger@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-02-17Refactoring the help message.Van de Bugger
1. Entire help message is printed at once (not line-by-line). 2. Brackets around argumnets of -I option removed, since argument is mandatory. 3. Added a space after comma in. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-02-16Bug in searching config files fixed.Van de Bugger
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-02-15Data refactored: list_t introduced to keep list and its sizes together.Van de Bugger
From 49380ed12a0c451207cf5a12ca2c1e0c9c16c9e6 Mon Sep 17 00:00:00 2001 From: Van de Bugger <van.de.bugger@gmail.com> Date: Mon, 14 Feb 2011 01:45:23 +0300 Subject: [PATCH setxkbmap] Data refactored: list_t introduced to keep list and its sizes together. In older code there were 3 separate global variables: szOptions, numOptions, and options. All 3 variables are related: options is a list (array) of items, szOptions is the allocated size and numOptions is the number of used elements. 3 more variables (szInclPath, numInclPath, inclPath) represent another list. list_t structure combines related info (pointer to array, allocated size, and number of used elements) together. Few functions changed to accept list_t argument instead of separated list and sizes. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-02-15Data refactored: 3 separate arrays and set of macros merged into a struct.Van de Bugger
Bunch of XXX_NDX defines, and 3 arrays: `svName', `svSrc' and `svValue' are merged into one structure. Interace of 2 functions `trySetString' and `setOptString' changed: instead of receiving `which' argument of `int' type (an index to those arrays) the functions now receive `setting' argument, which hold everything about the setting: `name', `src', and `value', so the functions do not use global variables any more. Signed-off-by: Van de Bugger <van.de.bugger@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-02-15Tabs replaced with spaces; trailing spaces deleted.Van de Bugger
Signed-off-by: Van de Bugger <van.de.bugger@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-02-13assigned value never used: "next" set at setxkbmap.c(654)Alan Coopersmith
If we go through the loop, next is overwritten on the very first line. If we don't go through the loop, next is never referenced again. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Dirk Wallenstein <halsmit@t-online.de>
2011-02-13Use snprintf instead of trying to pre-measure sprintf result sizes.Alan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Dirk Wallenstein <halsmit@t-online.de>
2011-02-13Bug 34151: Potential bug and buffer overflow due to misused rules filenameAlan Coopersmith
https://bugs.freedesktop.org/show_bug.cgi?id=34151 Use rfName consistently, instead of sometimes reverting to svValue[RULES_NDX] Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Dirk Wallenstein <halsmit@t-online.de>
2011-02-13Bug 34117: setxkbmap -I dir not accepted, despite man pageAlan Coopersmith
Easy enough to accept the syntax documented in the man page, so accept the -I flag with or without a space between -I and the directory argument. https://bugs.freedesktop.org/show_bug.cgi?id=34117 Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Dirk Wallenstein <halsmit@t-online.de> Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
2011-01-19Fix crash when when -device is specified without argumentStuart Kreitman
http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6971649 Signed-off-by: Stuart Kreitman <stuart.kreitman@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Dirk Wallenstein <halsmit@t-online.de> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2009-10-08Change default XKB rules file from "xorg" to "base"Alan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
2009-10-08Add -query option to print current RLMVO settingsAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-31Comment typo fixAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
2009-01-19Ansification and compile warning fixes.Paulo Cesar Pereira de Andrade
This also uses XORG_CHANGELOG and XORG_CWARNFLAGS, corrects make distcheck and all gcc 4.3 and sparse warnings.
2008-12-01Check return value of calloc and realloc. #18759 and #18760Peter Hutterer
X.Org Bug <http://bugs.freedesktop.org/show_bug.cgi?id=18759> X.Org Bug <http://bugs.freedesktop.org/show_bug.cgi?id=18760> Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
2008-08-12Adding some explanatory comments.Peter Hutterer
2008-08-12Indent consistently.Peter Hutterer
indent -cbi 0 -nprs -nut -npcs -i4 -bli 0 *.c *.h
2008-08-12Remove RCS tags.Peter Hutterer
2007-04-17Minor code cleanups (remove unused static and opencoding of strdup)Alan Coopersmith
2006-10-15add support for extended devicesDaniel Stone
Add a -device parameter, which allows setting the map on arbitary extended devices.
2006-10-15defaults: make the defaults a bit more modernDaniel Stone
Fix default path, bump default model from pc101 to pc105.
2006-03-10Bump to 1.0.2; release.setxkbmap-1_0_2XORG-7_1XORG-7_0_99_901Daniel Stone
Initialise vd.variant and vd.variant to NULL when failing to get the active RMLVO components from the server.
2004-04-23Merging XORG-CURRENT into trunkxprint_packagertest_20041217_basexprint_packagertest_20041125_basesco_port_update-baserel-0-6-1lg3d-rel-0-7-0lg3d-rel-0-6-2lg3d-baseXORG-6_8_99_903XORG-6_8_99_902XORG-6_8_99_901XORG-6_8_99_900XORG-6_8_99_9XORG-6_8_99_8XORG-6_8_99_7XORG-6_8_99_6XORG-6_8_99_5XORG-6_8_99_4XORG-6_8_99_3XORG-6_8_99_2XORG-6_8_99_16XORG-6_8_99_15XORG-6_8_99_14XORG-6_8_99_13XORG-6_8_99_12XORG-6_8_99_11XORG-6_8_99_10XORG-6_8_99_1XORG-6_8_2XORG-6_8_1_904XORG-6_8_1_903XORG-6_8_1_902XORG-6_8_1_901XORG-6_8_1XORG-6_8_0XORG-6_7_99_904XORG-6_7_99_903XORG-6_7_99_902XORG-6_7_99_901XORG-6_7_99_2XORG-6_7_99_1XACE-SELINUX-MERGExprint_packagertest_20041217xprint_packagertest_20041125sco_port_updatelg3d-masterlg3d-eventlg3d-dev-0-7-1lg3d-dev-0-7-0lg3d-dev-0-6-latestlg3d-dev-0-6-2lg3d-dev-0-6-1-latestlg3d-dev-0-6-1-currentlg3d-dev-0-6-1-1lg3d-dev-0-6-1lg3dXORG-6_8-branchCOMPOSITEWRAPEgbert Eich
2004-03-14Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004xf86-4_4_99_1Egbert Eich
2004-03-03Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004xf86-4_4_0STSF-CURRENTEgbert Eich
2004-02-26readding XFree86's cvs IDsxf86-4_3_99_903Egbert Eich
2004-02-26Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004Egbert Eich
2003-11-25XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folksxf86-4_3_99_903_specialxf86-4_3_99_902xf86-4_3_99_901xf86-4_3_99_16xf86-012804-2330Kaleb Keithley
2003-11-14Initial revisionXORG-STABLEKaleb Keithley