summaryrefslogtreecommitdiff
path: root/tools/tools-common.c
Commit message (Collapse)AuthorAgeFilesLines
* Possible fix for non-MSVC windows compilersRan Benita2023-04-111-2/+2
| | | | | | | | `_MSC_VER` is specific to MSVC, but there can be other compilers targeting windows. Hopefully they do define `_WIN32`, so let's use that. Refs: https://github.com/xkbcommon/libxkbcommon/issues/305 Signed-off-by: Ran Benita <ran@unusedvar.com>
* meson.build: define PATH_MAX where it's missingPeter Hutterer2020-09-011-3/+0
| | | | | | | | | | | PATH_MAX is not POSIX and can be missing on some systems, notably Windows (which provides MAX_PATH instead tough) and Hurd. Let's define it to a sane value where missing, i.e. the one it's defined to in limits.h. Except on Windows where we're limited to 260. Fixes https://github.com/xkbcommon/libxkbcommon/issues/180 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: make independent from src/Ran Benita2020-07-251-3/+5
| | | | Signed-off-by: Ran Benita <ran@unusedvar.com>
* Drop use of ronn, switch to raw roff insteadPeter Hutterer2020-07-251-7/+1
| | | | | | | | | | | | | Drop the ronn source files, check in the generated files instead. This gets rid of the ruby+gem+ronn toolchain requirement at the cost of having to edit raw man pages. ronn files are as-generated but with the preamble and generation date removed. The latter isn't important enough to keep, it'll just go stale for manually maintained files and it's not worth setting up a configure_file() just for that date. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: don't mangle the path for tools, just exec directlyPeter Hutterer2020-07-251-24/+9
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: don't assert on 64+ commandline arguments, just returnPeter Hutterer2020-07-251-1/+4
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* tools: add a xkbcli tool as entry point for the various tools we havePeter Hutterer2020-07-251-0/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | This is the base tool, no subtools are currently connected so you only get help and version for now. The goal here is to have a git-like infrastructure where /usr/bin/xkbcli is the main tool, anything else will hide in libexec. The infrastructure for this is copied from libinput. Tools themselves will will be installed in $prefix/libexec/xkbcommon and the xkbcli tool forks off whatever argv[1] is after modifying the PATH to include the libexec dir. libinput has additional code for checking whether we're running this from the builddir but it's a bit iffy and it's usefulness is limited - if you're in the builddir anyway you can just run ./builddir/xkbcli-<toolname> directly. So for this code here, running ./builddir/xkbcli <toolname> will execute the one in the prefix/libexecdir. Since we want that tool available everywhere even where some of the subtools aren't present, we need to ifdef the getopt handling. man page generation is handled via ronn which is a ruby program but allows markdown for the sources. It's hidden behind a meson option to disable where downloading ronn isn't an option. The setup is generic enough that we can add other man-pages by just appending to the array. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* test: untangle interactive-evdev from the test headersPeter Hutterer2020-06-251-4/+115
| | | | | | | | | Move (sometimes duplicate) the required bits into new shared files tools-common.(c|h) that are compiled into the internal tools library. Rename the test_foo() functions to tools_foo() and in one case just copy the code of the keymap compile function to the tool. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* test: simplify error handling in interactive-evdevPeter Hutterer2020-06-251-0/+89
Passing -errno around and having separate labels depending on failure types is superfluous here. All the unref calls can handle NULL and nothing cares about errno once we're out of the immediate scope. So let's simplify this and deal with 0 and 1 only. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>