Commit Graph

27 Commits

Author SHA1 Message Date
Dov Grobgeld fabb90676a Added --no-override option to rename. 2017-05-27 23:26:32 +03:00
Sami Kerola 8c1ce08da9 rename: make --no-act to imply --verbose
It is reasonable to assume use of --no-act means one wants to always see
what would have happen if rename is done.  To say same slightly differently,
if there is sn use case for silent rename --no-act run I cannot think one.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-05-19 11:43:34 +02:00
Alexander F Rødseth 990bf1f048 rename: add --no-act option
[kzak@redhat.com: - rename --dry-run to --no-act]

Signed-off-by: Alexander F Rødseth <xyproto@archlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-15 13:41:46 +01:00
Karel Zak 677ec86cef Use --help suggestion on invalid option
The current default is to print all usage() output. This is overkill
in many case.

Addresses: https://github.com/karelzak/util-linux/issues/338
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-12-19 13:13:34 +01:00
Andreas Henriksson 9fa6088aa9 rename: allow full-path renames
The command "touch b0;rename.ul -v ./b0 ./b1 ./b0" used to work
before "allow renaming in subdirectories" change.
(regression in commit bd9ced628b)

Addresses: https://bugs.debian.org/789240
Reported-by: gregrwm <bug-grub@whitleymott.net>
Reviewed-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2015-06-25 12:01:36 +02:00
Sami Kerola 2fc5a0d5bc rename: use strrchr() instead of rindex()
The rindex() is marked legacy in POSIX.1-2001, and apparently Androids
bionic libc does not even have it so it is best not to use the legacy
interface.

Reference: https://lists.gnu.org/archive/html/weechat-dev/2014-02/msg00004.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-02-10 13:21:23 +01:00
Benno Schulenberg fc14ceba5e textual: grammarize and harmonize the stat error message
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>
2015-02-02 11:27:10 +01:00
Benno Schulenberg 451dbcfae1 textual: add a docstring to most of the utilities
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>
2015-01-06 11:27:38 +01:00
Benno Schulenberg 09af3db48e textual: fix some typos and inconsistencies in various messages
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>
2014-07-23 08:56:00 +02:00
Sami Kerola 5651128abd rename: use function pointer to select file or symlink operation
Add separate functions to different functionality, and add a function for
the stuff that is in common for both.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-07-18 18:34:15 +01:00
Sami Kerola d6cf9e1669 rename: continue despite something failed
Try to do all file operations even when one or some of them fail, and
use exit value to inform what happen.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-07-18 18:34:15 +01:00
Sami Kerola bd9ced628b rename: allow renaming in subdirectories
Earlier the rename(1) considered path as possible string to be renamed,
could lead to an issue with none existing destination.  See below for
demonstration of this issue.  After this change all directory elements
are ignored when the match finding happens.

$ cd $(mktemp -d)
$ mkdir aa ab
$ touch a{a,b}/aa
$ rename -v a x */aa
rename: aa/aa: rename to xa/aa failed: No such file or directory

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-07-18 18:34:14 +01:00
Karel Zak af5f87a678 rename: fix mem leak [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-01-14 17:56:47 +01:00
Karel Zak 23b4715b8d rename: fix memory leak [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-27 16:29:48 +01:00
Sami Kerola 540dfebe3e rename: make usage() translator friendly
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-01-25 16:40:05 +01:00
Benno Schulenberg 8c219bf463 textual: gettextize several overlooked messages
Also improve the clarity of some of them.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-01-25 11:47:29 +01:00
Karel Zak c717b0328d rename: use macro to print version
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-12-10 13:14:38 +01:00
Jan (yac) Matějka 5a2a8177f8 rename: add --symlink option for renaming symlink target
[kzak@redhat.com: - coding style clean up]

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-12-10 13:07:09 +01:00
Sami Kerola c05a80ca63 misc-utils: verify writing to streams was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-04 19:56:48 +02:00
Karel Zak f70e2a11c8 rename: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 12:36:00 +02:00
Sami Kerola d200a926df rename: verbose option & maintenance fixes
The rename has new verbose option which will print which files
where renamed. Maintenance fixes includes long options, coding
style and freeing memory after usage.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-06-25 13:45:27 +02:00
Davidlohr Bueso 87f3feac71 misc-utils: use new xmalloc() wrapper
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2010-10-21 10:31:50 +02:00
Li Zefan 14608fdff0 rename: remove useless variable
The number of files successfully renamed is calculated and stored in variable
ct, > but actually the variable is not used afterwards.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
2007-09-05 11:51:11 +02:00
Karel Zak baf39af15b Imported from util-linux-2.13-pre2 tarball. 2006-12-07 00:26:58 +01:00
Karel Zak 48d7b13a1e Imported from util-linux-2.13-pre1 tarball. 2006-12-07 00:26:54 +01:00
Karel Zak 22853e4a82 Imported from util-linux-2.10m tarball. 2006-12-07 00:25:43 +01:00
Karel Zak eb63b9b8f4 Imported from util-linux-2.10f tarball. 2006-12-07 00:25:41 +01:00