[hackers] [sbase] cp: Update program usage and manpages || sin

From: <git_AT_suckless.org>
Date: Tue, 17 Feb 2015 18:33:39 +0100 (CET)

commit b3937b4ece1914f23a04230691bc62c83168b1be
Author: sin <sin_AT_2f30.org>
Date: Tue Feb 17 16:13:45 2015 +0000

    cp: Update program usage and manpages
    
    Do not document the non-standard -r flag as it is highly discouraged.
    It is still silently accepted and treated the same as -R.

diff --git a/cp.1 b/cp.1
index 9434d18..275ff5f 100644
--- a/cp.1
+++ b/cp.1
_AT_@ -1,4 +1,4 @@
-.Dd January 30, 2015
+.Dd February 17, 2015
 .Dt CP 1
 .Os sbase
 .Sh NAME
_AT_@ -6,11 +6,11 @@
 .Nd copy files and directories
 .Sh SYNOPSIS
 .Nm
-.Op Fl Rr
-.Ar file
-.Op Ar name
-.Nm
-.Op Fl aPpRrv
+.Op Fl afpv
+.Oo
+.Fl R
+.Op Fl H | L | P
+.Oc
 .Op Ar file ...
 .Op Ar directory
 .Sh DESCRIPTION
_AT_@ -34,6 +34,14 @@ and
 .Fl r .
 .It Fl f
 If an existing destination file cannot be opened, remove it and try again.
+.It Fl p
+Preserve mode, timestamp and permissions.
+.It Fl v
+Print names of source and destination per file to stdout. In the format:
+"source \-> destination".
+.It Fl R
+Copies directories recursively. If this flag is not specified, directories
+are not copied.
 .It Fl H
 Only dereference symbolic links that are passed as command line arguments when
 recursively traversing directories.
_AT_@ -42,16 +50,6 @@ Always dereference symbolic links while recursively traversing directories
 (default).
 .It Fl P
 Don't dereference symbolic links.
-.It Fl p
-Preserve mode, timestamp and permissions.
-.It Fl R
-Equivalent to -r.
-.It Fl r
-Copies directories recursively. If this flag is not specified, directories
-are not copied.
-.It Fl v
-Print names of source and destination per file to stdout. In the format:
-"source \-> destination".
 .El
 .Sh SEE ALSO
 .Xr mv 1
diff --git a/cp.c b/cp.c
index c7be281..1026d9a 100644
--- a/cp.c
+++ b/cp.c
_AT_@ -7,7 +7,7 @@
 static void
 usage(void)
 {
- eprintf("usage: %s [-adfpRrv] source... dest\n", argv0);
+ eprintf("usage: %s [-afpv] [-R [-H | -L | -P]] source... dest\n", argv0);
 }
 
 int
_AT_@ -21,11 +21,14 @@ main(int argc, char *argv[])
                 cp_HLPflag = 'P';
                 cp_aflag = cp_pflag = cp_rflag = 1;
                 break;
+ case 'f':
+ cp_fflag = 1;
+ break;
         case 'p':
                 cp_pflag = 1;
                 break;
- case 'f':
- cp_fflag = 1;
+ case 'v':
+ cp_vflag = 1;
                 break;
         case 'r':
         case 'R':
_AT_@ -36,9 +39,6 @@ main(int argc, char *argv[])
         case 'P':
                 cp_HLPflag = ARGC();
                 break;
- case 'v':
- cp_vflag = 1;
- break;
         default:
                 usage();
         } ARGEND;
Received on Tue Feb 17 2015 - 18:33:39 CET

This archive was generated by hypermail 2.3.0 : Tue Feb 17 2015 - 18:36:12 CET