From 13b6d8f84c98ab31309f5653fe158022ea986a23 Mon Sep 17 00:00:00 2001 From: midipix Date: Mon, 18 Apr 2016 19:35:32 -0400 Subject: library: helper functions: added slbt_copy_file. --- src/helper/slbt_copy_file.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/helper/slbt_copy_file.c (limited to 'src/helper/slbt_copy_file.c') 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 +#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; +} -- cgit v1.2.3