localectl.c revision 2f7a4867babd3fd382e5495f21724358f30fa67d
3988N/A along with systemd; If not, see <http://www.gnu.org/licenses/>.
4001N/A#include "dbus-common.h"
3988N/A#include "spawn-polkit-agent.h"
3988N/A#include "path-util.h"
3988N/Astatic bool arg_no_pager = false;
3988N/Astatic bool arg_ask_password = true;
3988N/Astatic bool arg_convert = true;
3988N/Astatic void pager_open_if_enabled(void) {
3988N/A if (arg_no_pager)
3988N/Astatic void polkit_agent_open_if_enabled(void) {
3988N/A if (!arg_ask_password)
3988N/Atypedef struct StatusInfo {
3988N/A const char *vconsole_keymap;
3988N/A const char *vconsole_keymap_toggle;
3988N/A const char *x11_layout;
3988N/A const char *x11_variant;
3988N/A const char *x11_options;
4001N/A case DBUS_TYPE_STRING: {
4001N/A i->vconsole_keymap = s;
4001N/A i->vconsole_keymap_toggle = s;
4001N/A i->x11_layout = s;
4001N/A i->x11_variant = s;
3988N/A i->x11_options = s;
3988N/A case DBUS_TYPE_ARRAY:
3988N/A "/org/freedesktop/locale1",
3988N/A "/org/freedesktop/locale1",
3988N/A struct namehashent {
3988N/A const struct namehashent *e;
3988N/A const void *p = MAP_FAILED;
3988N/A if (p == MAP_FAILED) {
h = (const struct locarhead *) p;
r = -EBADMSG;
goto finish;
for (i = 0; i < h->namehash_size; i++) {
if (e[i].locrec_offset == 0)
r = log_oom();
goto finish;
free(z);
goto finish;
r = log_oom();
goto finish;
strv_sort(l);
STRV_FOREACH(j, l)
puts(*j);
if (p != MAP_FAILED)
return -EINVAL;
b = arg_convert;
return bus_method_call_with_reply(
bus,
"/org/freedesktop/locale1",
&reply,
NULL,
DBUS_TYPE_BOOLEAN, &b,
static int nftw_cb(
const char *fpath,
int tflag,
return log_oom();
if (r == -EEXIST)
free(p);
free(p);
if (!keymaps)
return log_oom();
return log_oom();
if (strv_isempty(l)) {
return -ENOENT;
strv_sort(l);
STRV_FOREACH(i, l)
puts(*i);
strv_free(l);
return -EINVAL;
b = arg_convert;
return bus_method_call_with_reply(
bus,
"/org/freedesktop/locale1",
&reply,
NULL,
DBUS_TYPE_BOOLEAN, &b,
static int help(void) {
help();
case ARG_VERSION:
case ARG_NO_CONVERT:
arg_convert = false;
case ARG_NO_PAGER:
arg_no_pager = true;
return -EINVAL;
return -EINVAL;
const char* verb;
MORE,
LESS,
} argc_cmp;
const int argc;
} verbs[] = {
int left;
if (left <= 0)
help();
return -EINVAL;
case EQUAL:
return -EINVAL;
case MORE:
return -EINVAL;
case LESS:
return -EINVAL;
if (!bus) {
return -EIO;
log_open();
goto finish;
goto finish;
if (bus) {
pager_close();
return retval;