summaryrefslogtreecommitdiff
path: root/rb/src/IceRuby/Communicator.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2006-08-01 16:28:49 +0000
committerMark Spruiell <mes@zeroc.com>2006-08-01 16:28:49 +0000
commitff5f9d7729ef657e7da32dec79161a5f4090a0ed (patch)
tree94422a50c72213a922f04b0ad594bb709b297b74 /rb/src/IceRuby/Communicator.cpp
parentworkaround for VC6 bug (diff)
downloadice-ff5f9d7729ef657e7da32dec79161a5f4090a0ed.tar.bz2
ice-ff5f9d7729ef657e7da32dec79161a5f4090a0ed.tar.xz
ice-ff5f9d7729ef657e7da32dec79161a5f4090a0ed.zip
insert program name into argument vector
Diffstat (limited to 'rb/src/IceRuby/Communicator.cpp')
-rw-r--r--rb/src/IceRuby/Communicator.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/rb/src/IceRuby/Communicator.cpp b/rb/src/IceRuby/Communicator.cpp
index 2b7e2dc9b63..fb6d0cc1226 100644
--- a/rb/src/IceRuby/Communicator.cpp
+++ b/rb/src/IceRuby/Communicator.cpp
@@ -123,6 +123,13 @@ IceRuby_initialize(int argc, VALUE* argv, VALUE self)
}
}
+ //
+ // Insert the program name (stored in the Ruby global variable $0) as the first
+ // element of the sequence.
+ //
+ VALUE progName = callRuby(rb_gv_get, "$0");
+ seq.insert(seq.begin(), getString(progName));
+
data.properties = Ice::createProperties(seq, data.properties);
//
@@ -177,7 +184,10 @@ IceRuby_initialize(int argc, VALUE* argv, VALUE self)
{
callRuby(rb_ary_clear, args);
- for(i = 0; i < ac; ++i)
+ //
+ // We start at index 1 in order to skip the element that we inserted earlier.
+ //
+ for(i = 1; i < ac; ++i)
{
VALUE str = createString(av[i]);
callRuby(rb_ary_push, args, str);