summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-04-18 19:35:32 -0400
committermidipix <writeonce@midipix.org>2016-04-18 19:58:54 -0400
commit13b6d8f84c98ab31309f5653fe158022ea986a23 (patch)
tree17f50a80d1898a5d211c2f7412f8575b54f6c2ef /src
parentcfec3a5fbf80271893cb7a58940ca384f09ed940 (diff)
downloadslibtool-13b6d8f84c98ab31309f5653fe158022ea986a23.tar.bz2
slibtool-13b6d8f84c98ab31309f5653fe158022ea986a23.tar.xz
library: helper functions: added slbt_copy_file.
Diffstat (limited to 'src')
-rw-r--r--src/helper/slbt_copy_file.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/helper/slbt_copy_file.c b/src/helper/slbt_copy_file.c
new file mode 100644
index 0000000..fb44dc7
--- /dev/null
+++ b/src/helper/slbt_copy_file.c
@@ -0,0 +1,38 @@
+/*******************************************************************/
+/* slibtool: a skinny libtool implementation, written in C */
+/* Copyright (C) 2016 Z. Gilboa */
+/* Released under the Standard MIT License; see COPYING.SLIBTOOL. */
+/*******************************************************************/
+
+#include <slibtool/slibtool.h>
+#include "slibtool_spawn_impl.h"
+
+int slbt_copy_file(
+ const struct slbt_driver_ctx * dctx,
+ struct slbt_exec_ctx * ectx,
+ char * src,
+ char * dst)
+{
+ char * cp[4];
+
+ /* cp argv */
+ cp[0] = "cp";
+ cp[1] = src;
+ cp[2] = dst;
+ cp[3] = 0;
+
+ /* alternate argument vector */
+ ectx->argv = cp;
+ ectx->program = "cp";
+
+ /* step output */
+ if (!(dctx->cctx->drvflags & SLBT_DRIVER_SILENT))
+ if (slbt_output_link(dctx,ectx))
+ return -1;
+
+ /* dlltool spawn */
+ if ((slbt_spawn(ectx,true) < 0) || ectx->exitcode)
+ return -1;
+
+ return 0;
+}