]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hardlink: add long options
authorKarel Zak <kzak@redhat.com>
Mon, 11 Feb 2019 13:01:55 +0000 (14:01 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 11 Feb 2019 13:01:55 +0000 (14:01 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/hardlink.1
misc-utils/hardlink.c

index c7500b5a90f4cf96c3a5b6f05d68f4fc16ab307c..c564fd76a537490ad4ef0bcbb9ec74e278904e66 100644 (file)
@@ -2,8 +2,9 @@
 .SH "NAME"
 hardlink \- Consolidate duplicate files via hardlinks
 .SH "SYNOPSIS"
-.PP
-\fBhardlink\fP [\fB-c\fP] [\fB-n\fP] [\fB-v\fP] [\fB-vv\fP] [\fB-x pattern\fP] [\fB-h\fP] directory1 [ directory2 ... ]
+.B hardlink
+[options]
+.RI [ directory ...]
 .SH "DESCRIPTION"
 .PP
 This manual page documents \fBhardlink\fP, a
@@ -20,29 +21,37 @@ on a single filesystem contain many duplicate files.
 Since hard links can only span a single filesystem, \fBhardlink\fP
 is only useful when all directories specified are on the same filesystem.
 .SH "OPTIONS"
-.PP
-.IP "\fB-c\fP" 10
+.TP
+.BR \-c , " \-\-content"
 Compare only the contents of the files being considered for consolidation.
 Disregards permission, ownership and other differences.
-.IP "\fB-f\fP" 10
+.TP
+.BR \-f , " \-\-force"
 Force hardlinking across file systems.
-.IP "\fB-n\fP" 10
+.TP
+.BR \-n , " \-\-dry\-run"
 Do not perform the consolidation; only print what would be changed.
-.IP "\fB-v\fP" 10
-Print summary after hardlinking.
-.IP "\fB-vv\fP" 10
-Print every hardlinked file and bytes saved. Also print summary after hardlinking.
-.IP "\fB-x pattern\fP" 10
+.TP
+.BR \-v , " \-\-verbose"
+Print summary after hardlinking. The option may be specified more than once. In
+this case (e.g. \fB-vv\fP) it prints every hardlinked file and bytes saved.
+.TP
+.BR \-x , " \-\-exclude " \fIregex\f
 Exclude files and directories matching pattern from hardlinking.
-.IP "\fB-h\fP" 10
-Show help.
-.PP
+.sp
 The optional pattern for excluding files and directories must be a PCRE2
 compatible regular expression. Only the basename of the file or directory
 is checked, not its path. Excluded directories' contents will not be examined.
+.TP
+.BR \-h , " \-\-help"
+Display help text and exit.
+.TP
+.BR \-V , " \-\-version"
+Display version information and exit.
 .SH "AUTHOR"
 .PP
-\fBhardlink\fP was written by Jakub Jelinek <jakub@redhat.com>.
+\fBhardlink\fP was written by Jakub Jelinek <jakub@redhat.com> and later modified by
+Ruediger Meier <ruediger.meier@ga-group.nl> and Karel Zak <kzak@redhat.com> for util-linux.
 .PP
 Man page written by Brian Long and later updated by Jindrich Novy <jnovy@redhat.com>
 .SH "BUGS"
index 3e05ea5058d9aef8f7bd3dd85943211dfaf4992a..1558573f76f533019265dd89ed741332a5f10714 100644 (file)
@@ -141,12 +141,12 @@ static void __attribute__((__noreturn__)) usage(void)
        puts(_("Consolidate duplicate files using hardlinks."));
 
        fputs(USAGE_OPTIONS, stdout);
-       puts(_(" -c             when finding candidates for linking, compare only file contents"));
-       puts(_(" -n             don't actually link anything, just report what would be done"));
-       puts(_(" -v             print summary after hardlinking"));
-       puts(_(" -vv            print every hardlinked file and bytes saved + summary"));
-       puts(_(" -f             force hardlinking across filesystems"));
-       puts(_(" -x <regex>     exclude files matching pattern"));
+       puts(_(" -c, --content          compare only contents, ignore permission, etc."));
+       puts(_(" -n, --dry-run          don't actually link anything"));
+       puts(_(" -v, --verbose          print summary after hardlinking"));
+       puts(_(" -vv                    print every hardlinked file and summary"));
+       puts(_(" -f, --force            force hardlinking across filesystems"));
+       puts(_(" -x, --exclude <regex>  exclude files matching pattern"));
 
        fputs(USAGE_SEPARATOR, stdout);
        printf(USAGE_HELP_OPTIONS(16)); /* char offset to align option descriptions */
@@ -400,8 +400,13 @@ int main(int argc, char **argv)
        struct hardlink_dynstr nam1 = { NULL, 0 };
 
        static const struct option longopts[] = {
-               { "version",    no_argument, NULL, 'V' },
+               { "content",    no_argument, NULL, 'c' },
+               { "dry-run",    no_argument, NULL, 'n' },
+               { "exclude",    required_argument, NULL, 'x' },
+               { "force",      no_argument, NULL, 'f' },
                { "help",       no_argument, NULL, 'h' },
+               { "verbose",    no_argument, NULL, 'v' },
+               { "version",    no_argument, NULL, 'V' },
                { NULL, 0, NULL, 0 },
        };
 
@@ -429,7 +434,7 @@ int main(int argc, char **argv)
                        exclude_pattern = (PCRE2_SPTR) optarg;
 #else
                        errx(EXIT_FAILURE,
-                            _("option -x not supported (built without pcre2)"));
+                            _("option --exclude not supported (built without pcre2)"));
 #endif
                        break;
                case 'V':