summaryrefslogtreecommitdiff
path: root/src/timedate/timedatectl.c
Commit message (Collapse)AuthorAgeFilesLines
* Highlight the synopsis and summary in --helpZbigniew Jędrzejewski-Szmek2019-10-081-2/+4
| | | | | This doesn't cover all the binaries, but I don't know how to script this, and I run out of steam ;)
* Move the Commands section above Options sectionZbigniew Jędrzejewski-Szmek2019-10-081-14/+14
| | | | | | | For executables which take a verb, we should list the verbs first, and then options which modify those verbs second. The general layout of the man page is from general description to specific details, usually Overview, Commands, Options, Return Value, Examples, References.
* timedatectl: add 'ntp-servers' and 'revert' commands to modify link NTP serversYu Watanabe2019-07-171-0/+103
|
* Enable log colors for most of tools in /usr/binZbigniew Jędrzejewski-Szmek2019-05-081-0/+1
| | | | | | | | | | When emitting the calendarspec warning we want to see some color. Follow-up for 04220fda5c. Exceptions: - systemctl, because it has a lot hand-crafted coloring - tmpfiles, sysusers, stdio-bridge, etc, because they are also used in services and I'm not sure if this wouldn't mess up something.
* bus-util: drop unnecessary re-formattingYu Watanabe2019-03-041-1/+1
|
* timedated: Add dbus method to retrieve list of time zones (#11114)tibbling2018-12-121-3/+18
| | | | Move function call get_timezones from timedatectl to timedated and create a dbus method to list timezones.
* coccinelle: make use of SYNTHETIC_ERRNOZbigniew Jędrzejewski-Szmek2018-11-221-8/+6
| | | | | | | | | | | Ideally, coccinelle would strip unnecessary braces too. But I do not see any option in coccinelle for this, so instead, I edited the patch text using search&replace to remove the braces. Unfortunately this is not fully automatic, in particular it didn't deal well with if-else-if-else blocks and ifdefs, so there is an increased likelikehood be some bugs in such spots. I also removed part of the patch that coccinelle generated for udev, where we returns -1 for failure. This should be fixed independently.
* Split out pretty-print.c and move pager.c and main-func.h to shared/Zbigniew Jędrzejewski-Szmek2018-11-201-0/+1
| | | | | This is high-level functionality, and fits better in shared/ (which is for our executables), than in basic/ (which is also for libraries).
* timedatectl: define main through macroZbigniew Jędrzejewski-Szmek2018-11-201-17/+9
| | | | pager_close() is called from DEFINE_MAIN_FUNCTION().
* basic/pager: convert the pager options to a flags argumentZbigniew Jędrzejewski-Szmek2018-11-141-3/+3
| | | | | Pretty much everything uses just the first argument, and this doesn't make this common pattern more complicated, but makes it simpler to pass multiple options.
* bus-util: make --property= optionally take valueYu Watanabe2018-09-121-10/+2
|
* tree-wide: add clickable man page link to all --help textsLennart Poettering2018-08-201-1/+11
| | | | | | | | | | This is a bit like the info link in most of GNU's --help texts, but we don't do info but man pages, and we make them properly clickable on terminal supporting that, because awesome. I think it's generally advisable to link up our (brief) --help texts and our (more comprehensive) man pages a bit, so this should be an easy and straight-forward way to do it.
* tree-wide: shorten error logging a bitYu Watanabe2018-08-071-8/+8
| | | | Continuation of 4027f96aa08c73f109aa46b89842ca0e25c9c0e9.
* tree-wide: drop copyright headers from frequent contributorsZbigniew Jędrzejewski-Szmek2018-06-201-3/+0
| | | | | | | | Fixes #9320. for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms' done
* tree-wide: beautify remaining copyright statementsLennart Poettering2018-06-141-1/+1
| | | | | | Let's unify an beautify our remaining copyright statements, with a unicode ©. This means our copyright statements are now always formatted the same way. Yay.
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-141-1/+0
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-2/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* timedatectl: add 'show' command to display machine-readable outputYu Watanabe2018-06-141-0/+22
| | | | Closes #9249.
* tree-wide: drop !! casts to booleansZbigniew Jędrzejewski-Szmek2018-06-131-1/+1
| | | | | | | | | | | They are not needed, because anything that is non-zero is converted to true. C11: > 6.3.1.2: When any scalar value is converted to _Bool, the result is 0 if the > value compares equal to 0; otherwise, the result is 1. https://stackoverflow.com/questions/31551888/casting-int-to-bool-in-c-c
* timedatectl: add timesync-status and show-timesync commandsYu Watanabe2018-05-031-13/+461
| | | | Closes #1589.
* timedatectl: update output format of status commandYu Watanabe2018-04-171-21/+21
|
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* bus-util: add flags for bus_map_all_properties() (#8546)Yu Watanabe2018-03-281-0/+1
| | | | | | | | | This adds flags BUS_MAP_STRDUP and BUS_MAP_BOOLEAN_AS_BOOL. If BUS_MAP_STRDUP is set, then each "s" message is duplicated. If BUS_MAP_BOOLEAN_AS_BOOL is set, then each "b" message is written to a bool pointer. Follow-up for #8488. See https://github.com/systemd/systemd/pull/8488#discussion_r175816270.
* bus-util: make bus_map_all_properties() not copy stringYu Watanabe2018-03-201-13/+8
|
* tree-wide: voidify pager_open()Yu Watanabe2018-03-191-1/+1
| | | | | | Even if pager_open() fails, in general, we should continue the operations. All erroneous cases in pager_open() show log message in the function. So, it is not necessary to check the returned value.
* timedatectl: use dispatch_verb()Yu Watanabe2018-03-191-119/+45
|
* tree-wide: use "cannot" instead of "can not"Zbigniew Jędrzejewski-Szmek2018-02-081-1/+1
| | | | This is the usual spelling, and a bit shorter.
* Comment the fact that some tools need to termintate their bus connect firstFranck Bui2018-01-121-0/+2
|
* Revert "tree-wide: use _cleanup_(sd_bus_flush_close_unrefp) at various ↵Franck Bui2018-01-121-1/+2
| | | | | | | | | | | appropriate places" This reverts commit 0b3c84eb7da3a8c28ac248a68228f6a7edbb2e19. The removal of _cleanup_() usages was done on purpose, see cf647b69baee4c478d3909c327e3d917e1563f44. Fixes: #3543
* timedatectl: fix status output (#7696)Yu Watanabe2017-12-191-1/+1
| | | | | Follow-up for 3ec530a1890925efe347f739917dd4078c1b1942. Fixes #7693.
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* tree-wide: use _cleanup_(sd_bus_flush_close_unrefp) at various appropriate ↵Lennart Poettering2017-11-101-2/+1
| | | | | | places Let's shorten the code a bit.
* treewide: unify identical definitions of polkit_agent_open_if_enabled() (#7187)Zbigniew Jędrzejewski-Szmek2017-10-301-16/+4
| | | Follows the same pattern as pager_open() now.
* timedatectl: stop using xstrftimeZbigniew Jędrzejewski-Szmek2017-10-181-10/+11
| | | | | | | | | | | | | | | | | | | | | | | | When using strftime in arbitrary locales, we cannot really say how big the buffer should be. Let's make the buffer "large", which will work fine pretty much always, and just print n/a if the timestamp does not fit. strftime returns 0 if the buffer is too small and a NUL-terminated string otherwise, so we can drop the size specifications in string formatting. $ export LANG=fa_IR.UTF-8 $ date چهارشنبه ۱۸ اكتبر ۱۷، ساعت ۱۰:۵۴:۲۴ (+0330) $ timedatectl Assertion 'xstrftime: a[] must be big enough' failed at ../src/timedate/timedatectl.c:105, function print_status_info(). Aborting. now: $ timedatectl Local time: چهارشنبه 2017-10-18 16:29:40 CEST Universal time: چهارشنبه 2017-10-18 14:29:40 UTC RTC time: چهارشنبه 2017-10-18 14:29:40 … https://bugzilla.redhat.com/show_bug.cgi?id=1503452
* timedatectl: be more explicit what "ntp synchronized" meansZbigniew Jędrzejewski-Szmek2017-09-211-10/+10
| | | | | | | The documentation explained that the message doesn't really mean what it says, but I think it's better to just make the message more straightforward. Fixes #6554.
* tree-wide: make bus_map_all_properties return a proper sd_bus_errorLennart Poettering2017-02-091-1/+4
| | | | | | | | And then show it, to make things a bit friendlier to the user if we fail acquiring some props. In fact, this fixes a number of actual bugs, where we used an error structure for output that we actually never got an error in.
* sd-bus: make sure bus_map_all_properties() handle booleans rightLennart Poettering2016-06-211-4/+4
| | | | | | | | | | sd-bus generally exposes bools as "int" instead of "bool" in the public API. This is relevant when unmarshaling booleans, as the relevant functions expect an int* pointer and no bool* pointer. Since sizeof(bool) is not necessarily the same as sizeof(int) this is problematic and might result in memory corruption. Let's fix this, and make sure bus_map_all_properties() handles booleans as ints, as the rest of sd-bus, and make all users of it expect the right thing.
* systemctl: make sure we terminate the bus connection first, and then close ↵Lennart Poettering2016-06-161-1/+2
| | | | | | | | | | | | | | | the pager (#3550) If "systemctl -H" is used, let's make sure we first terminate the bus connection, and only then close the pager. If done in this order ssh will get an EOF on stdin (as we speak D-Bus through ssh's stdin/stdout), and then terminate. This makes sure the standard error we were invoked on is released by ssh, and only that makes sure we don't deadlock on the pager which waits for all clients closing its input pipe. (Similar fixes for the various other xyzctl tools that support both pagers and -H) Fixes: #3543
* tree-wide: use ansi_highlight() instead of ANSI_HIGHLIGHT where appropriateLennart Poettering2016-05-301-7/+7
| | | | Let's make sure SYSTEMD_COLORS is honour by more tools
* tree-wide: merge pager_open_if_enabled() to the pager_open()Alexander Kuleshov2016-02-261-9/+1
| | | | | | | | | Many subsystems define own pager_open_if_enabled() function which checks '--no-pager' command line argument and open pager depends on its value. All implementations of pager_open_if_enabled() are the same. Let's merger this function with pager_open() from the shared/pager.c and remove pager_open_if_enabled() from all subsytems to prevent code duplication.
* tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* tree-wide: expose "p"-suffix unref calls in public APIs to make gcc cleanup easyLennart Poettering2015-11-271-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GLIB has recently started to officially support the gcc cleanup attribute in its public API, hence let's do the same for our APIs. With this patch we'll define an xyz_unrefp() call for each public xyz_unref() call, to make it easy to use inside a __attribute__((cleanup())) expression. Then, all code is ported over to make use of this. The new calls are also documented in the man pages, with examples how to use them (well, I only added docs where the _unref() call itself already had docs, and the examples, only cover sd_bus_unrefp() and sd_event_unrefp()). This also renames sd_lldp_free() to sd_lldp_unref(), since that's how we tend to call our destructors these days. Note that this defines no public macro that wraps gcc's attribute and makes it easier to use. While I think it's our duty in the library to make our stuff easy to use, I figure it's not our duty to make gcc's own features easy to use on its own. Most likely, client code which wants to make use of this should define its own: #define _cleanup_(function) __attribute__((cleanup(function))) Or similar, to make the gcc feature easier to use. Making this logic public has the benefit that we can remove three header files whose only purpose was to define these functions internally. See #2008.
* util-lib: split string parsing related calls from util.[ch] into parse-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* bus-util: rename bus_open_transport() to bus_connect_transport()Lennart Poettering2015-09-291-1/+1
| | | | | | | | | | | | | | In sd-bus, the sd_bus_open_xyz() family of calls allocates a new bus, while sd_bus_default_xyz() family tries to reuse the thread's default bus. bus_open_transport() sometimes internally uses the former, sometimes the latter family, but suggests it only calls the former via its name. Hence, let's avoid this confusion, and generically rename the call to bus_connect_transport(). Similar for all related calls. And while we are at it, also change cgls + cgtop to do direct systemd connections where possible, since all they do is talk to systemd itself.
* util: introduce common version() implementation and use it everywhereLennart Poettering2015-09-291-9/+7
| | | | | | This also allows us to drop build.h from a ton of files, hence do so. Since we touched the #includes of those files, let's order them properly according to CODING_STYLE.
* cgtop: underline table headerLennart Poettering2015-09-221-2/+2
| | | | | | Let's underline the header line of the table shown by cgtop, how it is customary for tables. In order to do this, let's introduce new ANSI underline macros, and clean up the existing ones as side effect.
* timedatectl: when no timezone is set consider UTC the defaultLennart Poettering2015-08-201-1/+1
| | | | | This fixes #993, and ensures that the libc does not consider any old timezone information into account, that was set earlier.
* timedatectl: assert timezone is not null in setenv() call.Dimitri John Ledkov2015-08-191-1/+1
| | | | | | | | | | | | | setenv is declared as: extern int setenv (const char *__name, const char *__value, int __replace) __THROW __nonnull ((2)); And i->timezone can be NULL, if for example /etc/localtime is missing. Previously that worked, but now result in a libc dumping core, as seen with gcc 2.22, due to: https://sourceware.org/ml/glibc-cvs/2015-q2/msg00075.html
* sd-bus: introduce new sd_bus_flush_close_unref() callLennart Poettering2015-07-031-1/+1
| | | | | | | | | | | | | | | | sd_bus_flush_close_unref() is a call that simply combines sd_bus_flush() (which writes all unwritten messages out) + sd_bus_close() (which terminates the connection, releasing all unread messages) + sd_bus_unref() (which frees the connection). The combination of this call is used pretty frequently in systemd tools right before exiting, and should also be relevant for most external clients, and is hence useful to cover in a call of its own. Previously the combination of the three calls was already done in the _cleanup_bus_close_unref_ macro, but this was only available internally. Also see #327
* timedatectl: trim non-local RTC warning to 80 chars wideVedran Miletić2015-07-021-5/+6
|