summaryrefslogtreecommitdiff
path: root/package/sash/src/cp.c
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2014-08-27 17:14:13 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2014-08-27 17:14:13 +0200
commit727dd67821e4581e4b61b30b79ca47c5bffc8497 (patch)
treed5be61f067a42b2633ef148f416f138e7c2f7da2 /package/sash/src/cp.c
parent683cf71a6ebccbd4f827ad4a6ac92dbbaf8f644d (diff)
parent008d0e157538e4a4c302dc79e6c28c9da615b527 (diff)
Merge branch 'master' of git+ssh://openadk.org/git/openadk
Diffstat (limited to 'package/sash/src/cp.c')
-rw-r--r--package/sash/src/cp.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/package/sash/src/cp.c b/package/sash/src/cp.c
new file mode 100644
index 000000000..11d03f74c
--- /dev/null
+++ b/package/sash/src/cp.c
@@ -0,0 +1,27 @@
+
+void
+do_cp(argc, argv)
+ char **argv;
+{
+ BOOL dirflag;
+ char *srcname;
+ char *destname;
+ char *lastarg;
+
+ lastarg = argv[argc - 1];
+
+ dirflag = isadir(lastarg);
+
+ if ((argc > 3) && !dirflag) {
+ fprintf(stderr, "%s: not a directory\n", lastarg);
+ return;
+ }
+
+ while (argc-- > 2) {
+ destname = lastarg;
+ if (dirflag)
+ destname = buildname(destname, srcname);
+
+ (void) copyfile(*++argv, destname, FALSE);
+ }
+}