Skip to content
Snippets Groups Projects
Commit a9a46bd8 authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

Added async_cp().

Rev: lib/modules/Stdio.pmod/module.pmod:1.66
parent 61a96106
Branches
Tags
No related merge requests found
// $Id: module.pmod,v 1.65 1999/10/05 05:33:44 hubbe Exp $ // $Id: module.pmod,v 1.66 1999/10/14 21:37:30 grubba Exp $
import String; import String;
...@@ -753,6 +753,27 @@ int cp(string from, string to) ...@@ -753,6 +753,27 @@ int cp(string from, string to)
} }
#endif #endif
static void call_cp_cb(int len,
function(int, mixed ...:void) cb, mixed ... args)
{
// FIXME: Check that the lengths are the same?
cb(0, @args);
}
void async_cp(string from, string to,
function(int, mixed...:void) cb, mixed ... args)
{
object from_file = File();
object to_file = File();
if ((!(from_file->open(from, "r"))) ||
(!(to_file->open(to, "wct")))) {
call_out(cb, 0, 0, @args);
return;
}
sendfile(0, from_file, 0, -1, 0, to, call_cp_cb, cb, @args);
}
/* /*
* Asynchronous sending of files. * Asynchronous sending of files.
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment