Commit graph

33 commits

Author SHA1 Message Date
Michal Schmidt d5099efc47 hashmap: introduce hash_ops to make struct Hashmap smaller
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-09-15 16:08:50 +02:00
Zbigniew Jędrzejewski-Szmek 601185b43d Unify parse_argv style
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-08-03 21:46:07 -04:00
Zbigniew Jędrzejewski-Szmek a2a5291b3f Reject invalid quoted strings
String which ended in an unfinished quote were accepted, potentially
with bad memory accesses.

Reject anything which ends in a unfished quote, or contains
non-whitespace characters right after the closing quote.

_FOREACH_WORD now returns the invalid character in *state. But this return
value is not checked anywhere yet.

Also, make 'word' and 'state' variables const pointers, and rename 'w'
to 'word' in various places. Things are easier to read if the same name
is used consistently.

mbiebl_> am I correct that something like this doesn't work
mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-passwd "Unlock EncFS"'
mbiebl_> systemd seems to strip of the quotes
mbiebl_> systemctl status shows
mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-password Unlock EncFS  $RootDir $MountPoint
mbiebl_> which is pretty weird
2014-07-31 04:00:31 -04:00
Lennart Poettering 6b01f1d391 delta: draw arrows with draw_special_char()
Let's unify generation of unicode chars at one place.

Also, don't add an extra space into chars we print, except for the tree
chars where this is really necessary.
2014-04-23 19:06:39 +02:00
Zbigniew Jędrzejewski-Szmek 00a5cc3a63 delta: do not use unicode chars in C locale
https://bugzilla.redhat.com/show_bug.cgi?id=1088418
2014-04-16 23:33:48 -04:00
Lukas Nykryn 277f2f75f6 delta: ensure that d_type will be set on every fs 2014-01-09 16:43:00 +01:00
Zbigniew Jędrzejewski-Szmek 6096dfd616 delta: if prefix is specified, only show overrides there
systemd-delta /run/systemd/system will show all unit overrides
in /run, etc.
2013-12-22 22:54:15 -05:00
Zbigniew Jędrzejewski-Szmek f939e9a47c delta: fix delta for drop-ins
Also, fix highlighting, add more debug statements, make const tables
static and global, run path_kill_slashes only at entry.
2013-12-22 22:53:56 -05:00
Florian Weimer 6887ec4f00 delta: replace readdir_r with readdir 2013-12-21 18:35:55 -05:00
Zbigniew Jędrzejewski-Szmek 2b6bf07dd2 Get rid of our reimplementation of basename
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-12-06 21:29:55 -05:00
Lennart Poettering eb9da376d7 clients: unify how we invoke getopt_long()
Among other things this makes sure we always expose a --version command
and show it in the help texts.
2013-11-06 18:28:39 +01:00
Daniel Schaal 0b5a519c89 systemd-delta: Only print colors when on a tty
This make systemd-delta follow the behaviour of systemctl
and journalctl.

https://bugs.freedesktop.org/show_bug.cgi?id=67656

[zj: unify color query methods between those three programs.]
2013-08-04 08:33:02 -04:00
Zbigniew Jędrzejewski-Szmek 8fd57568e6 systemd-delta: count overrides only of the requested type 2013-05-16 17:23:28 -04:00
Lukas Nykryn 0000ce05ed systemd-delta: add support for drop-in snippets 2013-05-16 17:23:28 -04:00
Harald Hoyer 1b12a7b589 pager: introduce "jump to end" option
$ journalctl -be

is what you want :)

https://bugzilla.redhat.com/show_bug.cgi?id=867841
2013-03-07 21:16:04 +01:00
Thomas Hindoe Paaboel Andersen 641906e936 use strneq instead of strncmp 2013-02-13 00:56:13 +01:00
Lennart Poettering bc2708414b build-sys: drop all distribution specfic checks
Yay, we now have a completely generic systemd. No distribution specific checks anymore!
2013-01-04 23:26:21 +01:00
Thomas Hindoe Paaboel Andersen 377ec8bf19 delta.c: fix option '-t'
Both the help and man page claims that it accepts -t with an argument
so let's do that.
2012-11-14 00:18:02 +01:00
Thomas Hindoe Paaboel Andersen e26970a82c delta.c: use _cleanup_ 2012-11-13 23:45:41 +01:00
Thomas Hindoe Paaboel Andersen 33b4055123 remove duplicate semicolons 2012-11-12 22:38:44 +01:00
Lennart Poettering 7d5e9c0f60 util: define union dirent_storage and make use of it everywhere
Make sure to allocate enough space for readdir_r().

https://bugzilla.redhat.com/show_bug.cgi?id=858754
2012-09-19 22:21:09 +02:00
Lennart Poettering b7def68494 util: rename join() to strjoin()
This is to match strappend() and the other string related functions.
2012-07-13 13:41:01 +02:00
Lennart Poettering a7480dbad2 core: rename system.preset to system-presets to follow naming scheme of other dirs in /usr/lib/systemd/
Thankfully nobody is using this yet, and presets aren't documented yet,
hence take the liberty to rename this.
2012-06-27 14:34:24 +02:00
Harald Hoyer d966a7b363 delta/delta.c: initialize bottom for fail state 2012-05-21 18:51:44 +02:00
Nis Martensen 386da8589b delta: fix spelling of overridden 2012-05-21 18:31:43 +02:00
Lennart Poettering c0ef53aa5b delta: drop PHP'ism 2012-05-21 02:02:40 +02:00
Lennart Poettering 8e812a2301 delta: don't highlight unchanged files 2012-05-21 02:02:31 +02:00
Lennart Poettering 866062b152 delta: introduce arg_flags field, to follow our usual scheme 2012-05-21 02:01:52 +02:00
Lennart Poettering c8021373fb delta: use same nomenclature for equivalent and redirected everywhere 2012-05-16 18:57:57 +02:00
Lennart Poettering 4c4e643161 delta: enums are much cooler than defines 2012-05-16 18:53:46 +02:00
Gergely Nagy 807f464522 delta: Support filtering what type of deltas to show
Not everyone is interested in every kind of deltas (and some might
even be interested knowing which files do not have overrides), so this
here is an implementation of a --type=LIST... option for
systemd-delta, that makes it possible to filter what subset of deltas
we want.

The available modifiers are masked, equivalent, redirected, overriden,
and unchanged - they should be self explanatory, and the man page
explains them in a little more detail anyway.

As a side effect, in case of overriden files, the diff output was made
optional.

By default, everything is shown (with a diff, if appropriate) except
for completely unchanged files.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
2012-05-16 18:51:26 +02:00
Lennart Poettering 3ea6e73287 delta: add preset dirs 2012-05-16 03:40:42 +02:00
Lennart Poettering 7e8d5761ec delta: add missing files 2012-05-16 03:36:42 +02:00