mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-21 16:32:25 +01:00
delete my last commit
Submitted by: pst, ache
This commit is contained in:
parent
8ec7a852b0
commit
d7e0e5ca0f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=14154
21
bin/cp/cp.1
21
bin/cp/cp.1
@ -47,16 +47,14 @@
|
|||||||
.Fl R
|
.Fl R
|
||||||
.Op Fl H | Fl L | Fl P
|
.Op Fl H | Fl L | Fl P
|
||||||
.Oc
|
.Oc
|
||||||
.Op Fl f | i
|
.Op Fl fip
|
||||||
.Op Fl p
|
|
||||||
.Ar source_file target_file
|
.Ar source_file target_file
|
||||||
.Nm cp
|
.Nm cp
|
||||||
.Oo
|
.Oo
|
||||||
.Fl R
|
.Fl R
|
||||||
.Op Fl H | Fl L | Fl P
|
.Op Fl H | Fl L | Fl P
|
||||||
.Oc
|
.Oc
|
||||||
.Op Fl f | i
|
.Op Fl fip
|
||||||
.Op Fl p
|
|
||||||
.Ar source_file ... target_directory
|
.Ar source_file ... target_directory
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
In the first synopsis form, the
|
In the first synopsis form, the
|
||||||
@ -107,25 +105,18 @@ For each existing destination pathname, remove it and
|
|||||||
create a new file, without prompting for confirmation
|
create a new file, without prompting for confirmation
|
||||||
regardless of its permissions.
|
regardless of its permissions.
|
||||||
(The
|
(The
|
||||||
.Fl f
|
|
||||||
option overrides any previous
|
|
||||||
.Fl i
|
.Fl i
|
||||||
options.)
|
option is ignored if the
|
||||||
|
.Fl f
|
||||||
|
option is specified.)
|
||||||
.It Fl i
|
.It Fl i
|
||||||
Causes
|
Causes
|
||||||
.Nm cp
|
.Nm cp
|
||||||
to write a prompt to the standard error output before copying a file
|
to write a prompt to the standard error output before copying a file
|
||||||
that would overwrite an existing file.
|
that would overwrite an existing file.
|
||||||
If the response from the standard input begins with the character
|
If the response from the standard input begins with the character
|
||||||
.Sq Li y
|
.Sq Li y ,
|
||||||
or
|
|
||||||
.Sq Li Y ,
|
|
||||||
the file copy is attempted.
|
the file copy is attempted.
|
||||||
(The
|
|
||||||
.Fl i
|
|
||||||
option overrides any previous
|
|
||||||
.Fl f
|
|
||||||
options.)
|
|
||||||
.It Fl p
|
.It Fl p
|
||||||
Causes
|
Causes
|
||||||
.Nm cp
|
.Nm cp
|
||||||
|
@ -86,7 +86,7 @@ static char sccsid[] = "@(#)cp.c 8.2 (Berkeley) 4/1/94";
|
|||||||
PATH_T to = { to.p_path, "" };
|
PATH_T to = { to.p_path, "" };
|
||||||
|
|
||||||
uid_t myuid;
|
uid_t myuid;
|
||||||
int Rflag, iflag, pflag, rflag, fflag;
|
int Rflag, iflag, pflag, rflag;
|
||||||
int myumask;
|
int myumask;
|
||||||
|
|
||||||
enum op { FILE_TO_FILE, FILE_TO_DIR, DIR_TO_DNE };
|
enum op { FILE_TO_FILE, FILE_TO_DIR, DIR_TO_DNE };
|
||||||
@ -105,8 +105,7 @@ main(argc, argv)
|
|||||||
char *target;
|
char *target;
|
||||||
|
|
||||||
Hflag = Lflag = Pflag = Rflag = 0;
|
Hflag = Lflag = Pflag = Rflag = 0;
|
||||||
fflag = iflag = rflag = pflag = 0;
|
while ((ch = getopt(argc, argv, "HLPRfipr")) != EOF)
|
||||||
while ((ch = getopt(argc, argv, "HLPRfipr?")) != EOF)
|
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'H':
|
case 'H':
|
||||||
Hflag = 1;
|
Hflag = 1;
|
||||||
@ -125,11 +124,9 @@ main(argc, argv)
|
|||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
iflag = 0;
|
iflag = 0;
|
||||||
fflag = 1;
|
|
||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
iflag = isatty(STDIN_FILENO);
|
iflag = isatty(fileno(stdin));
|
||||||
fflag = 0;
|
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
pflag = 1;
|
pflag = 1;
|
||||||
|
@ -42,7 +42,7 @@ typedef struct {
|
|||||||
|
|
||||||
extern PATH_T to;
|
extern PATH_T to;
|
||||||
extern uid_t myuid;
|
extern uid_t myuid;
|
||||||
extern int iflag, pflag, fflag, myumask;
|
extern int iflag, pflag, myumask;
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
|
|
||||||
|
@ -86,21 +86,12 @@ copy_file(entp, dne)
|
|||||||
checkch = ch = getchar();
|
checkch = ch = getchar();
|
||||||
while (ch != '\n' && ch != EOF)
|
while (ch != '\n' && ch != EOF)
|
||||||
ch = getchar();
|
ch = getchar();
|
||||||
if (checkch != 'y' && checkch != 'Y') {
|
if (checkch != 'y') {
|
||||||
(void)close(from_fd);
|
(void)close(from_fd);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
to_fd = open(to.p_path, O_WRONLY | O_TRUNC, 0);
|
||||||
if (fflag) {
|
|
||||||
/* remove existing destination file name,
|
|
||||||
* create a new file */
|
|
||||||
(void)unlink(to.p_path);
|
|
||||||
to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT,
|
|
||||||
fs->st_mode & ~(S_ISUID | S_ISGID));
|
|
||||||
} else
|
|
||||||
/* overwrite existing destination file name */
|
|
||||||
to_fd = open(to.p_path, O_WRONLY | O_TRUNC, 0);
|
|
||||||
} else
|
} else
|
||||||
to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT,
|
to_fd = open(to.p_path, O_WRONLY | O_TRUNC | O_CREAT,
|
||||||
fs->st_mode & ~(S_ISUID | S_ISGID));
|
fs->st_mode & ~(S_ISUID | S_ISGID));
|
||||||
@ -290,7 +281,7 @@ void
|
|||||||
usage()
|
usage()
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "%s\n%s\n",
|
(void)fprintf(stderr, "%s\n%s\n",
|
||||||
"usage: cp [-R [-H | -L | -P] [-f | -i] [-p] src target",
|
"usage: cp [-R [-H | -L | -P] [-fip] src target",
|
||||||
" cp [-R [-H | -L | -P] [-f | -i] [-p] src1 ... srcN directory");
|
" cp [-R [-H | -L | -P] [-fip] src1 ... srcN directory");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
17
bin/mv/mv.1
17
bin/mv/mv.1
@ -77,25 +77,17 @@ The following options are available:
|
|||||||
Do not prompt for confirmation before overwriting the destination
|
Do not prompt for confirmation before overwriting the destination
|
||||||
path.
|
path.
|
||||||
(The
|
(The
|
||||||
.Fl f
|
|
||||||
option overrides any previous
|
|
||||||
.Fl i
|
.Fl i
|
||||||
options.)
|
option is ignored if the
|
||||||
|
.Fl f
|
||||||
|
option is specified.)
|
||||||
.It Fl i
|
.It Fl i
|
||||||
Causes
|
Causes
|
||||||
.Nm mv
|
.Nm mv
|
||||||
to write a prompt to standard error before moving a file that would
|
to write a prompt to standard error before moving a file that would
|
||||||
overwrite an existing file.
|
overwrite an existing file.
|
||||||
If the response from the standard input begins with the character
|
If the response from the standard input begins with the character ``y'',
|
||||||
.Sq Li y
|
|
||||||
or
|
|
||||||
.Sq Li Y ,
|
|
||||||
the move is attempted.
|
the move is attempted.
|
||||||
(The
|
|
||||||
.Fl i
|
|
||||||
option overrides any previous
|
|
||||||
.Fl f
|
|
||||||
options.)
|
|
||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
It is an error for either the
|
It is an error for either the
|
||||||
@ -129,7 +121,6 @@ The
|
|||||||
utility exits 0 on success, and >0 if an error occurs.
|
utility exits 0 on success, and >0 if an error occurs.
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr cp 1 ,
|
.Xr cp 1 ,
|
||||||
.Xr rm 1 ,
|
|
||||||
.Xr symlink 7
|
.Xr symlink 7
|
||||||
.Sh STANDARDS
|
.Sh STANDARDS
|
||||||
The
|
The
|
||||||
|
19
bin/mv/mv.c
19
bin/mv/mv.c
@ -79,17 +79,13 @@ main(argc, argv)
|
|||||||
int ch;
|
int ch;
|
||||||
char path[MAXPATHLEN + 1];
|
char path[MAXPATHLEN + 1];
|
||||||
|
|
||||||
fflg = iflg = 0;
|
while ((ch = getopt(argc, argv, "-if")) != EOF)
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "-if?")) != EOF)
|
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'i':
|
case 'i':
|
||||||
iflg = isatty(STDIN_FILENO);
|
iflg = 1;
|
||||||
fflg = 0;
|
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
fflg = 1;
|
fflg = 1;
|
||||||
iflg = 0;
|
|
||||||
break;
|
break;
|
||||||
case '-': /* Undocumented; for compatibility. */
|
case '-': /* Undocumented; for compatibility. */
|
||||||
goto endarg;
|
goto endarg;
|
||||||
@ -156,13 +152,6 @@ do_move(from, to)
|
|||||||
* make sure the user wants to clobber it.
|
* make sure the user wants to clobber it.
|
||||||
*/
|
*/
|
||||||
if (!fflg && !access(to, F_OK)) {
|
if (!fflg && !access(to, F_OK)) {
|
||||||
|
|
||||||
/* prompt only if source exist */
|
|
||||||
if (lstat(from, &sb) == -1) {
|
|
||||||
warn("%s", from);
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
ask = 0;
|
ask = 0;
|
||||||
if (iflg) {
|
if (iflg) {
|
||||||
(void)fprintf(stderr, "overwrite %s? ", to);
|
(void)fprintf(stderr, "overwrite %s? ", to);
|
||||||
@ -178,7 +167,7 @@ do_move(from, to)
|
|||||||
if (ask) {
|
if (ask) {
|
||||||
if ((ch = getchar()) != EOF && ch != '\n')
|
if ((ch = getchar()) != EOF && ch != '\n')
|
||||||
while (getchar() != '\n');
|
while (getchar() != '\n');
|
||||||
if (ch != 'y' && ch != 'Y')
|
if (ch != 'y')
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -314,6 +303,6 @@ void
|
|||||||
usage()
|
usage()
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr,
|
(void)fprintf(stderr,
|
||||||
"usage: mv [-if] src target;\n or: mv [-i | -f] src1 ... srcN directory\n");
|
"usage: mv [-if] src target;\n or: mv [-if] src1 ... srcN directory\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
10
bin/rm/rm.c
10
bin/rm/rm.c
@ -30,7 +30,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: rm.c,v 1.7 1996/02/18 19:00:59 wosch Exp $
|
* $Id: rm.c,v 1.6 1995/04/13 13:35:09 ache Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
@ -81,8 +81,7 @@ main(argc, argv)
|
|||||||
{
|
{
|
||||||
int ch, rflag;
|
int ch, rflag;
|
||||||
|
|
||||||
rflag = 0;
|
Pflag = rflag = 0;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "dfiPRr")) != EOF)
|
while ((ch = getopt(argc, argv, "dfiPRr")) != EOF)
|
||||||
switch(ch) {
|
switch(ch) {
|
||||||
case 'd':
|
case 'd':
|
||||||
@ -103,6 +102,7 @@ main(argc, argv)
|
|||||||
case 'r': /* Compatibility. */
|
case 'r': /* Compatibility. */
|
||||||
rflag = 1;
|
rflag = 1;
|
||||||
break;
|
break;
|
||||||
|
case '?':
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
@ -378,7 +378,7 @@ check(path, name, sp)
|
|||||||
first = ch = getchar();
|
first = ch = getchar();
|
||||||
while (ch != '\n' && ch != EOF)
|
while (ch != '\n' && ch != EOF)
|
||||||
ch = getchar();
|
ch = getchar();
|
||||||
return (first == 'y' || first == 'Y');
|
return (first == 'y');
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ISDOT(a) ((a)[0] == '.' && (!(a)[1] || ((a)[1] == '.' && !(a)[2])))
|
#define ISDOT(a) ((a)[0] == '.' && (!(a)[1] || ((a)[1] == '.' && !(a)[2])))
|
||||||
@ -410,6 +410,6 @@ void
|
|||||||
usage()
|
usage()
|
||||||
{
|
{
|
||||||
|
|
||||||
(void)fprintf(stderr, "usage: rm [-dfiPRr] file ...\n");
|
(void)fprintf(stderr, "usage: rm [-dfiRr] file ...\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user