While looking earlier commit I noticed everything but formatting was removed
from a message in namei.c file. That inspired me to look if there are more
strings that does not need translation project attention. This change
removes at least some of them, if not all.
Reference: e19cc7b65b
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
changed in include/c.h and applied via sed:
sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c")
sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c")
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Now we are always using the same text also for commands
which had still hardcoded descriptions or where we can't
use the standard print_usage_help_options macro.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
We are using better/shorter error messages and somtimes
also errtryhelp().
Here we fix all cases where the usage function took
an int argument for exit_code.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
text-utils/tailf.c:69:21: warning: Using plain integer as NULL pointer
Since many 'struct option' has used zero as NULL make them more readable in
same go by reindenting, and using named argument requirements.
Reference: https://lwn.net/Articles/93577/
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The message "stat failed %s" seems to say that stat() failed to
do something, or failed to pass a test, but of course it means
that the statting of something failed. So say so. Also make
two very similar messages equal to this one.
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
This adds a concise description of a tool to its usage text.
A first form of this patch was proposed by Steven Honeyman
(see http://www.spinics.net/lists/util-linux-ng/msg09994.html).
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Translating these text elements should happen only once, which is
more likely when the text macros are used properly.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Fixing plain typos, miswordings, inconsistent periods, some missing
angular brackets, and a proper pluralization (even when it involves
a constant, because for some languages the precise value matters).
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
This change should make namei output more readable when multiple
arguments are supplied.
The old:
$ namei -l /usr/foo
f: /usr/foo
drwxr-xr-x root root /
drwxr-xr-x root root usr
foo - No such file or directory
The new:
$ namei -l /usr/foo
f: /usr/foo
drwxr-xr-x root root /
drwxr-xr-x root root usr
foo - No such file or directory
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Fedora 17 (/bin is symlink to /usr/bin):
[root@intel ~]# /bin/namei /bin/namei
f: /bin/namei
d /
l bin -> usr/bin
usr - No such file or directory
Reported-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Missing pathname argument can only be checked after options are
parsed. Earlier for example 'namei -l' print nothing and was
successful.
The option parsing is changed to be less POSIXLY_CORRECT and
continue if nonoption argument is found, which allows users to
define options and arguments in the order they prefer.
Unknown short options, which earlier matched case '?' that was
help option alias, are now made to indicate failure in return
value.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
namei.c: In function ‘print_namei’:
namei.c:368:16: warning: variable ‘prev’ set but not used [-Wunused-but-set-variable]
Signed-off-by: Karel Zak <kzak@redhat.com>
Solaris lacks err, errx, warn and warnx. This also means the err.h header
doesn't exist. Removed err.h include from all files, and included err.h from
c.h instead if it exists, otherwise alternatives are provided.
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
Old implementation of namei listed path all the way to non-existing
file or directory, something like:
f: /usr/bin/nxdir/file
d /
d usr
d bin
? nxdir - No such file or directory (2)
whiles the current implementation prints:
namei: failed to stat: /usr/bin/nxdir/file: No such file or directory
The new output it's not helpful. I am especially interested see where
the path is broken when a path is symlink to other path with symlink,
and few more like that, and something somewhere is broken.
[kzak@redhat.com: - coding style changes]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
$ mkdir aaa
$ ln -s aaa mylink
old version:
$ namei mylink
namei: could not stat 'mylink/aaa': No such file or directory
new version:
$ namei mylink
f: mylink
l mylink -> aaa
d aaa
Signed-off-by: Karel Zak <kzak@redhat.com>
Added file owner and group name printing support. The groupnames and
usernames are cached to avoid an extra overhead. This implementation
does not use fixed width of user/group name columns.
$ namei -l /var/www/cgi-bin
f: /var/www/cgi-bin
drwxr-xr-x root root /
drwxr-xr-x root root var
drwxr-xr-x root root www
drwxr-xr-x root root cgi-bin
Signed-off-by: Karel Zak <kzak@redhat.com>
This new version:
* not based on chdir()
* implemented without recursion (does not depend on stack size)
* list of directories is stored in allocated memory (the code is
extendable with new functionality (e.g. show usernames, groupnames,
selunux contexts, ...).
* supports long command line options
* adds a new command line option:
-n, --nosymlinks don't follow symlinks
Signed-off-by: Karel Zak <kzak@redhat.com>