]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
add -h option
authorJindrich Novy <jnovy@fedoraproject.org>
Mon, 7 Nov 2005 14:07:33 +0000 (14:07 +0000)
committerRuediger Meier <ruediger.meier@ga-group.nl>
Tue, 12 Jun 2018 12:23:25 +0000 (14:23 +0200)
misc-utils/hardlink.1 [new file with mode: 0644]
misc-utils/hardlink.c

diff --git a/misc-utils/hardlink.1 b/misc-utils/hardlink.1
new file mode 100644 (file)
index 0000000..7ffc2b4
--- /dev/null
@@ -0,0 +1,39 @@
+.TH "hardlink" "1"
+.SH "NAME"
+hardlink \- Consolidate duplicate files via hardlinks
+.SH "SYNOPSIS"
+.PP
+\fBhardlink\fP [\fB-c\fP] [\fB-n\fP] [\fB-v\fP] [\fB-h\fP] directory1 [ directory2 ... ]
+.SH "DESCRIPTION"
+.PP
+This manual page documents \fBhardlink\fP, a 
+program which consolidates duplicate files in one or more directories
+using hardlinks.
+.PP
+\fBhardlink\fP traverses one 
+or more directories searching for duplicate files.  When it finds duplicate
+files, it uses one of them as the master.  It then removes all other
+duplicates and places a hardlink for each one pointing to the master file.
+This allows for conservation of disk space where multiple directories
+on a single filesystem contain many duplicate files.
+.PP
+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
+Compare only the contents of the files being considered for consolidation.
+Disregards permission, ownership and other differences.
+.IP "\fB-n\fP" 10
+Do not perform the consolidation; only print what would be changed.
+.IP "\fB-v\fP" 10
+Enable verbose logging.
+.IP "\fB-h\fP" 10
+Show help.
+.SH "AUTHOR"
+.PP
+\fBhardlink\fP was written by Jakub Jelinek <jakub@redhat.com>. 
+.PP
+Man page written by Brian Long.
+.PP
+Man page updated by Jindrich Novy <jnovy@redhat.com>
index 1e102101fad39f3c6b7c781fc1b039af63802666..fd511c8947e20005ca77b85eac33023486f51a51 100644 (file)
@@ -96,10 +96,11 @@ void doexit(int i)
 
 void usage(char *prog)
 {
-  fprintf (stderr, "Usage: %s [-cnv] directories...\n", prog);
+  fprintf (stderr, "Usage: %s [-cnvh] directories...\n", prog);
   fprintf (stderr, "  -c    When finding candidates for linking, compare only file contents.\n");
   fprintf (stderr, "  -n    Don't actually link anything, just report what would be done.\n");
   fprintf (stderr, "  -v    Operate in verbose mode.\n");
+  fprintf (stderr, "  -h    Show help.\n");
   exit(255);
 }
 
@@ -125,7 +126,7 @@ void rf (char *name)
     int fd, i;
     f * fp, * fp2;
     h * hp;
-    char *p, *q;
+    char *p = NULL, *q;
     char *n1, *n2;
     int cksumsize = sizeof(buf);
     unsigned int cksum;
@@ -292,7 +293,7 @@ int main(int argc, char **argv)
   d * dp;
   DIR *dh;
   struct dirent *di;
-  while ((ch = getopt (argc, argv, "cnv")) != -1) {
+  while ((ch = getopt (argc, argv, "cnvh")) != -1) {
     switch (ch) {
     case 'n':
       no_link++;
@@ -303,6 +304,7 @@ int main(int argc, char **argv)
     case 'c':
       content_only++;
       break;
+    case 'h':
     default:
       usage(argv[0]);
     }