summaryrefslogtreecommitdiff
path: root/src/locale/localectl.c
AgeCommit message (Collapse)Author
2014-12-24sd-bus: rename sd_bus_open_system_container() to sd_bus_open_system_machine()Lennart Poettering
Pretty much everywhere else we use the generic term "machine" when referring to containers in API, so let's do though in sd-bus too. In particular, since the concept of a "container" exists in sd-bus too, but as part of the marshalling system.
2014-12-11localectl,man: make it obvious that set-*-keymaps sets both keymapsZbigniew Jędrzejewski-Szmek
https://bugs.freedesktop.org/show_bug.cgi?id=85411
2014-11-28treewide: another round of simplificationsMichal Schmidt
Using the same scripts as in f647962d64e "treewide: yet more log_*_errno + return simplifications".
2014-11-28treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt
If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
2014-11-28treewide: yet more log_*_errno + return simplificationsMichal Schmidt
Using: find . -name '*.[ch]' | while read f; do perl -i.mmm -e \ 'local $/; local $_=<>; s/(if\s*\([^\n]+\))\s*{\n(\s*)(log_[a-z_]*_errno\(\s*([->a-zA-Z_]+)\s*,[^;]+);\s*return\s+\g4;\s+}/\1\n\2return \3;/msg; print;' $f done And a couple of manual whitespace fixups.
2014-11-28treewide: drop unnecessary trailing \n in log_*() callsMichal Schmidt
2014-11-28treewide: no need to negate errno for log_*_errno()Michal Schmidt
It corrrectly handles both positive and negative errno values.
2014-11-28treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt
As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
2014-11-04localectl: fix localectl set-x11-keymap syntax descriptionJan Synacek
This complements the fix in: commit cd4c6fb12598435fe24431f1dd616f9582f0e3bd Author: Jan Synacek <jsynacek@redhat.com> Date: Mon Oct 20 12:43:39 2014 +0200 man: fix localectl set-x11-keymap syntax description
2014-10-02localectl: always print warnings with log_warning() instead of printf()Lennart Poettering
They really should got to stderr, not stdout.
2014-10-02localectl: count locale variables from 0, instead of VARIABLE_LANGLennart Poettering
That way the we make our code safe regarding reordering of the variables in the enum.
2014-09-25localectl: print warning when there are options given on kernel cmdlineMichal Sekletar
2014-09-15hashmap: introduce hash_ops to make struct Hashmap smallerMichal Schmidt
It is redundant to store 'hash' and 'compare' function pointers in struct Hashmap separately. The functions always comprise a pair. Store a single pointer to struct hash_ops instead. systemd keeps hundreds of hashmaps, so this saves a little bit of memory.
2014-08-04bus: always explicitly close bus from main programsLennart Poettering
Since b5eca3a2059f9399d1dc52cbcf9698674c4b1cf0 we don't attempt to GC busses anymore when unsent messages remain that keep their reference, when they otherwise are not referenced anymore. This means that if we explicitly want connections to go away, we need to close them. With this change we will no do so explicitly wherver we connect to the bus from a main program (and thus know when the bus connection should go away), or when we create a private bus connection, that really should go away after our use. This fixes connection leaks in the NSS and PAM modules.
2014-08-03Unify parse_argv styleZbigniew Jędrzejewski-Szmek
getopt is usually good at printing out a nice error message when commandline options are invalid. It distinguishes between an unknown option and a known option with a missing arg. It is better to let it do its job and not use opterr=0 unless we actually want to suppress messages. So remove opterr=0 in the few places where it wasn't really useful. When an error in options is encountered, we should not print a lengthy help() and overwhelm the user, when we know precisely what is wrong with the commandline. In addition, since help() prints to stdout, it should not be used except when requested with -h or --help. Also, simplify things here and there.
2014-07-07shared: make timezone and locale enumeration and validation genericLennart Poettering
This way we can reuse it other code thatn just localectl/localed + timedatectl/timedated.
2014-02-20api: in constructor function calls, always put the returned object pointer ↵Lennart Poettering
first (or second) Previously the returned object of constructor functions where sometimes returned as last, sometimes as first and sometimes as second parameter. Let's clean this up a bit. Here are the new rules: 1. The object the new object is derived from is put first, if there is any 2. The object we are creating will be returned in the next arguments 3. This is followed by any additional arguments Rationale: For functions that operate on an object we always put that object first. Constructors should probably not be too different in this regard. Also, if the additional parameters might want to use varargs which suggests to put them last. Note that this new scheme only applies to constructor functions, not to all other functions. We do give a lot of freedom for those. Note that this commit only changes the order of the new functions we added, for old ones we accept the wrong order and leave it like that.
2014-02-14localectl: log error if bus_map_all_properties() failsDjalal Harouni
2013-12-06Get rid of our reimplementation of basenameZbigniew Jędrzejewski-Szmek
The only problem is that libgen.h #defines basename to point to it's own broken implementation instead of the GNU one. This can be fixed by #undefining basename.
2013-11-18localed: match converted keymaps before legacyZbigniew Jędrzejewski-Szmek
Before, X11 keymap fr-pc105-oss would be converted to fr, even though fr-oss exists. Now, if /usr/lib/kbd/keymaps/xkb/<layout>[-<variant>].map[.gz] exists, <layout>[-<variant>] will be used as the console keymap, falling back to the legacy mappings otherwise. % sudo localectl set-x11-keymap pl pc105 % localectl System Locale: LANG=en_US.UTF-8 VC Keymap: pl (was pl2 before) X11 Layout: pl X11 Model: pc105 % sudo localectl set-x11-keymap fr pc105 oss % localectl System Locale: LANG=en_US.UTF-8 VC Keymap: fr-oss (was fr before) X11 Layout: fr X11 Model: pc105 X11 Variant: oss % sudo localectl set-x11-keymap fr pc105 % localectl System Locale: LANG=en_US.UTF-8 VC Keymap: fr X11 Layout: fr X11 Model: pc105 % sudo localectl set-x11-keymap gb % localectl System Locale: LANG=en_US.UTF-8 VC Keymap: gb (was uk before) X11 Layout: gb
2013-11-18remove unused variablesThomas Hindoe Paaboel Andersen
2013-11-12bus: rename sd_bus_send_with_reply_and_block() to sd_bus_call()Lennart Poettering
The call is one of the most important ones we expose, where we place major emphasis on. We should make sure to give it a short, memorable name.
2013-11-08localectl: port over to bus_log_create_error()Lennart Poettering
2013-11-07clients: try to follow roughly the same order in --help texts for common optionsLennart Poettering
2013-11-07polkit: don't spawn local client if we access a remote systemLennart Poettering
2013-11-06clients: unify how we invoke getopt_long()Lennart Poettering
Among other things this makes sure we always expose a --version command and show it in the help texts.
2013-11-06clients: various simplificationsLennart Poettering
2013-11-05bus: update bus_map_all_properties()Kay Sievers
2013-11-02bus: use internal helper to read org.freedesktop.DBus.Properties::GetAll ↵Kay Sievers
variables
2013-10-31localectl: always print error message when an operation failsLennart Poettering
2013-10-30localectl: remove unused 'P' argThomas Hindoe Paaboel Andersen
2013-10-30localectl: port to libsystemd-busKay Sievers
2013-08-01Add /usr/share/keymaps to localectl supported locations.Michał Górny
This is the standard upstream location where kbd installs keymaps.
2013-06-09Allow for the use of @ in remote host callsDaniel Wallace
Without this you have to use %40 with the -H flag because dbus doesn't like the @ sign being unescaped.
2013-05-23Fix --no-ask-passwordJan Janssen
POSIX_ME_HARDER mode is disabled for localectl. It doesn't make much sense in case of localectl, and there's little reason for localectl to behave specially.
2013-05-21man: Document missing optionsJan Janssen
2013-04-24Add set_consume which always takes ownershipZbigniew Jędrzejewski-Szmek
Freeing in error path is the common pattern with set_put().
2013-04-18move _cleanup_ attribute in front of the typeHarald Hoyer
http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
2013-04-15localectl: read X11 keymaps from the correct fileLennart Poettering
As reported by Sergey Udaltsov.
2013-04-10localctl: skip locale entries with non-UTF8 namesLennart Poettering
glibc should place these in the locale archive. For now, let's just skip them from our output, since they are aliases anyway. https://bugs.freedesktop.org/show_bug.cgi?id=63389
2013-04-05Use initalization instead of explicit zeroingZbigniew Jędrzejewski-Szmek
Before, we would initialize many fields twice: first by filling the structure with zeros, and then a second time with the real values. We can let the compiler do the job for us, avoiding one copy. A downside of this patch is that text gets slightly bigger. This is because all zero() calls are effectively inlined: $ size build/.libs/systemd text data bss dec hex filename before 897737 107300 2560 1007597 f5fed build/.libs/systemd after 897873 107300 2560 1007733 f6075 build/.libs/systemd … actually less than 1‰. A few asserts that the parameter is not null had to be removed. I don't think this changes much, because first, it is quite unlikely for the assert to fail, and second, an immediate SEGV is almost as good as an assert.
2013-04-05localectl: add support for listing X11 keymap informationLennart Poettering
2013-03-29Always use errno > 0 to help gccZbigniew Jędrzejewski-Szmek
gcc thinks that errno might be negative, and functions could return something positive on error (-errno). Should not matter in practice, but makes an -O4 build much quieter.
2013-03-07pager: introduce "jump to end" optionHarald Hoyer
$ journalctl -be is what you want :) https://bugzilla.redhat.com/show_bug.cgi?id=867841
2013-02-12localectl: fix --help textLennart Poettering
https://bugs.freedesktop.org/show_bug.cgi?id=60595
2013-02-07strv: add strv_printThomas Hindoe Paaboel Andersen
Clearer, and spares the temp variable.
2013-01-07localectl: use automatic cleanupZbigniew Jędrzejewski-Szmek
set_freep() is added to automatize set_free().
2013-01-07localectl: support systems without locale-archiveGiovanni Campagna
Not all systems ships with locales inside /usr/lib/locale-archive, some prefer to have locale data as individual subdirectories of /usr/lib/locale. (A notable example of this is OpenEmbeddded, and OSes deriving from it like gnome-ostree). Given that glibc supports both ways, localectl should too.
2013-01-04build-sys: drop all distribution specfic checksLennart Poettering
Yay, we now have a completely generic systemd. No distribution specific checks anymore!
2012-12-12localectl: fix dbus call arguments in set_x11_keymapMichal Schmidt
Fixes an assertion failure in the dbus lib. https://bugzilla.redhat.com/show_bug.cgi?id=882212