summaryrefslogtreecommitdiff
path: root/ext/etc/etc.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-12 15:16:00 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-12 15:16:00 +0000
commit1e4b2f9bd1be777b980563c78647a649f9c4ffe4 (patch)
treec6ff0fe68228804d54a1d9b2462c6622693f44ac /ext/etc/etc.c
parent3033b3ae2f2f7eb89d9b512a7c83017f6356881c (diff)
etc.c: Etc namespace
* ext/etc/etc.c (Init_etc): move Passwd and Group under Etc namespace as primary names. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/etc/etc.c')
-rw-r--r--ext/etc/etc.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/ext/etc/etc.c b/ext/etc/etc.c
index a511baf..6fd453e 100644
--- a/ext/etc/etc.c
+++ b/ext/etc/etc.c
@@ -137,7 +137,7 @@ setup_passwd(struct passwd *pwd)
* === Example:
*
* Etc.getpwuid(0)
- * #=> #<struct Struct::Passwd name="root", passwd="x", uid=0, gid=0, gecos="root",dir="/root", shell="/bin/bash">
+ * #=> #<struct Etc::Passwd name="root", passwd="x", uid=0, gid=0, gecos="root",dir="/root", shell="/bin/bash">
*/
static VALUE
etc_getpwuid(int argc, VALUE *argv, VALUE obj)
@@ -175,7 +175,7 @@ etc_getpwuid(int argc, VALUE *argv, VALUE obj)
* === Example:
*
* Etc.getpwnam('root')
- * #=> #<struct Struct::Passwd name="root", passwd="x", uid=0, gid=0, gecos="root",dir="/root", shell="/bin/bash">
+ * #=> #<struct Etc::Passwd name="root", passwd="x", uid=0, gid=0, gecos="root",dir="/root", shell="/bin/bash">
*/
static VALUE
etc_getpwnam(VALUE obj, VALUE nam)
@@ -380,7 +380,7 @@ setup_group(struct group *grp)
* === Example:
*
* Etc.getgrgid(100)
- * #=> #<struct Struct::Group name="users", passwd="x", gid=100, mem=["meta", "root"]>
+ * #=> #<struct Etc::Group name="users", passwd="x", gid=100, mem=["meta", "root"]>
*
*/
static VALUE
@@ -419,7 +419,7 @@ etc_getgrgid(int argc, VALUE *argv, VALUE obj)
* === Example:
*
* Etc.getgrnam('users')
- * #=> #<struct Struct::Group name="users", passwd="x", gid=100, mem=["meta", "root"]>
+ * #=> #<struct Etc::Group name="users", passwd="x", gid=100, mem=["meta", "root"]>
*
*/
static VALUE
@@ -678,7 +678,7 @@ Init_etc(void)
rb_define_module_function(mEtc, "sysconfdir", etc_sysconfdir, 0);
rb_define_module_function(mEtc, "systmpdir", etc_systmpdir, 0);
- sPasswd = rb_struct_define("Passwd",
+ sPasswd = rb_struct_define(NULL,
"name", "passwd", "uid", "gid",
#ifdef HAVE_ST_PW_GECOS
"gecos",
@@ -743,11 +743,13 @@ Init_etc(void)
* account expiration time(integer) must be compiled with +HAVE_ST_PW_EXPIRE+
*/
rb_define_const(mEtc, "Passwd", sPasswd);
+ rb_set_class_path(sPasswd, mEtc, "Passwd");
+ rb_define_const(rb_cStruct, "Passwd", sPasswd); /* deprecated name */
rb_extend_object(sPasswd, rb_mEnumerable);
rb_define_singleton_method(sPasswd, "each", etc_each_passwd, 0);
#ifdef HAVE_GETGRENT
- sGroup = rb_struct_define("Group", "name",
+ sGroup = rb_struct_define(NULL, "name",
#ifdef HAVE_ST_GR_PASSWD
"passwd",
#endif
@@ -775,6 +777,8 @@ Init_etc(void)
* members of the group.
*/
rb_define_const(mEtc, "Group", sGroup);
+ rb_set_class_path(sPasswd, mEtc, "Group");
+ rb_define_const(rb_cStruct, "Group", sGroup); /* deprecated name */
rb_extend_object(sGroup, rb_mEnumerable);
rb_define_singleton_method(sGroup, "each", etc_each_group, 0);
#endif