[seed: 4/6] Add os.write
- From: Robert Carr <racarr src gnome org>
- To: svn-commits-list gnome org
- Subject: [seed: 4/6] Add os.write
- Date: Wed, 15 Apr 2009 12:45:58 -0400 (EDT)
commit f4ae29de47abfff57bc7897d0c76252082a29e82
Author: Robert Carr <racarr mireia (none)>
Date: Wed Apr 15 12:40:27 2009 -0400
Add os.write
---
modules/os/os.c | 27 ++++++++++++++++++++++++++-
1 files changed, 26 insertions(+), 1 deletions(-)
diff --git a/modules/os/os.c b/modules/os/os.c
index d1272cd..b0cde10 100644
--- a/modules/os/os.c
+++ b/modules/os/os.c
@@ -853,6 +853,30 @@ seed_os_read (SeedContext ctx,
return ret;
}
+SeedValue
+seed_os_write (SeedContext ctx,
+ SeedObject function,
+ SeedObject this_object,
+ size_t argument_count,
+ const SeedValue arguments[],
+ SeedException * exception)
+{
+ SeedValue ret;
+ gint fd, nw;
+ gchar *buf;
+
+ if (argument_count != 2)
+ {
+ EXPECTED_EXCEPTION ("os.write", "2 arguments");
+ }
+ fd = seed_value_to_int (ctx, arguments[0], exception);
+ buf = seed_value_to_string (ctx, arguments[1], exception);
+
+ nw = write (fd, buf, strlen (buf));
+
+ return seed_value_from_int (ctx, nw, exception);q
+}
+
seed_static_function os_funcs[] = {
{"chdir", seed_os_chdir, 0},
{"fchdir", seed_os_fchdir, 0},
@@ -891,7 +915,8 @@ seed_static_function os_funcs[] = {
{"lseek", seed_os_lseek, 0},
{"openpty", seed_os_openpty, 0},
{"pipe", seed_os_pipe, 0},
- {"read", seed_os_read, 0}
+ {"read", seed_os_read, 0},
+ {"write", seed_os_write, 0}
};
#define OS_DEFINE_ENUM(name, value) \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]