The original Julian's hardlink.c code is pretty readable, but for
util-linux we use a little different indention (aka Linux kernel
coding style).
Signed-off-by: Karel Zak <kzak@redhat.com>
We usually use "debug" for very detailed information. For end-user
information is better to talk about "verbose" output.
Signed-off-by: Karel Zak <kzak@redhat.com>
* use config.h like other code on package
* use c.h and remove from code stuff defined in the header file
* remove FALSE/TRUE redefinition
Signed-off-by: Karel Zak <kzak@redhat.com>
The current version used in util-linux is based on original code from
Jakub Jelinek.
The new version is based on Debian implementation from
https://salsa.debian.org/jak/hardlink. This new version uses nftw()
to walk on directories tree and organize internal data binary tree
(tsearch() and twalk()). This new version provides more features like
--ignore-{mode,owner,time}, --respect-xattrs, --respect-name,
--include, --keep-oldest, --minimize, --maximize, etc.
Note that the new version uses -f for --respect-name, the old version
uses -f to hardlinking across filesystems (very probably rarely unused
feature).
Addresses: https://github.com/karelzak/util-linux/issues/808
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/hardlink.c: In function ‘process_path’:
misc-utils/hardlink.c:287:30: warning: operand of ?: changes signedness from ‘off_t’ {aka ‘long int’} to ‘long unsigned int’ due to unsignedness of other operand [-Wsign-compare]
misc-utils/hardlink.c: In function ‘main’:
misc-utils/hardlink.c:455:5: warning: ‘exclude_pattern’ may be used uninitialized in this function [-Wmaybe-uninitialized]
Signed-off-by: Karel Zak <kzak@redhat.com>
Reason to retire NIOBUF is that it is obscure local definition, while BUFSIZ
is well understood and commonly used constant. Besized sizes of these are
not far off, the NIOBUF was 4096 bytes and BUFSIZ tends to be 8192 bytes.
Proposed-by: Karel Zak <kzak@redhat.com>
Reference: https://github.com/karelzak/util-linux/pull/783
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Well, sort of. Due to use of ctl values in atexit() print_summary() there
is need for global control structure.
Secondly couple variables can be moved to more restricted scope, namely the
PCRE variables are now in main().
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This fixes two standards compliancy warnings.
hardlink.c:65:7: warning: ISO C forbids zero-size array ‘name’ [-Wpedantic]
Reference: https://en.wikipedia.org/wiki/Flexible_array_member
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* remove \r from internationalized messages
* remove \r from all output to make it easy to use (see for example
output file from "hardlink -vv --dry-run . &> log")
* remove unnecessary formatting stuff from output, just keep is simple
and stupid...
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/hardlink.c:91:65: warning: declaration shadows a variable in the global scope [-Wshadow]
misc-utils/hardlink.c:73:5: note: previous declaration is here
int content_only = 0;
term-utils/wall.c:114:40: warning: declaration shadows a variable in the global scope [-Wshadow]
term-utils/wall.c:129:65: warning: declaration shadows a variable in the global scope [-Wshadow]
/usr/include/bits/getopt_core.h:36:14: note: previous declaration is here
extern char *optarg;
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* remove NAMELEN, use PATH_MAX
* mark global variables as static
* move all global variables to the begin of the code
Signed-off-by: Karel Zak <kzak@redhat.com>