summaryrefslogtreecommitdiff
path: root/ext/etc
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-08-13 05:37:52 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-08-13 05:37:52 +0000
commit0a64817fb80016030c03518fb9459f63c11605ea (patch)
tree3ea2e607f9ea08c56830ef7b803cd259e3d67c7f /ext/etc
parent210367ec889f5910e270d6ea2c7ddb8a8d939e61 (diff)
remove marshal/gtk/kconv
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/etc')
-rw-r--r--ext/etc/MANIFEST3
-rw-r--r--ext/etc/depend2
-rw-r--r--ext/etc/etc.c18
-rw-r--r--ext/etc/etc.txt72
-rw-r--r--ext/etc/etc.txt.jp (renamed from ext/etc/etc.doc)3
5 files changed, 85 insertions, 13 deletions
diff --git a/ext/etc/MANIFEST b/ext/etc/MANIFEST
index a0f521b..79fb1ff 100644
--- a/ext/etc/MANIFEST
+++ b/ext/etc/MANIFEST
@@ -1,5 +1,6 @@
MANIFEST
etc.c
-etc.doc
+etc.txt
+etc.txt.jp
depend
extconf.rb
diff --git a/ext/etc/depend b/ext/etc/depend
index fb3318a..ac70647 100644
--- a/ext/etc/depend
+++ b/ext/etc/depend
@@ -1 +1 @@
-etc.o : etc.c $(hdrdir)/ruby.h $(hdrdir)/config.h $(hdrdir)/defines.h
+etc.o : etc.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
diff --git a/ext/etc/etc.c b/ext/etc/etc.c
index c10680c..e5f69f9 100644
--- a/ext/etc/etc.c
+++ b/ext/etc/etc.c
@@ -125,7 +125,7 @@ static VALUE
etc_passwd(obj)
VALUE obj;
{
-#if defined(HAVE_GETPWENT)
+#ifdef HAVE_GETPWENT
struct passwd *pw;
if (rb_iterator_p()) {
@@ -136,12 +136,11 @@ etc_passwd(obj)
endpwent();
return obj;
}
- pw = getpwent();
- if (pw == 0) rb_raise(rb_eRuntimeError, "can't fetch next -- /etc/passwd");
- return setup_passwd(pw);
-#else
- return Qnil;
+ if (pw = getpwent()) {
+ return setup_passwd(pw);
+ }
#endif
+ return Qnil;
}
#ifdef HAVE_GETGRENT
@@ -214,10 +213,11 @@ etc_group(obj)
endgrent();
return obj;
}
- return setup_group(getgrent());
-#else
- return Qnil;
+ if (grp = getgrent()) {
+ return setup_group(grp);
+ }
#endif
+ return Qnil;
}
static VALUE mEtc;
diff --git a/ext/etc/etc.txt b/ext/etc/etc.txt
new file mode 100644
index 0000000..9801dc0
--- /dev/null
+++ b/ext/etc/etc.txt
@@ -0,0 +1,72 @@
+.\" etc.doc - -*- Indented-Text -*- created at: Fri Jul 14 00:47:15 JST 1995
+
+** Etc(Module)
+
+The module to retrieve information under /etc directory. Available
+only on UNIX platforms. All operations defined in this module are
+module functions, so that you can include Etc module into your class.
+
+Module Function:
+
+ getlogin
+
+ returns login name of the user. It this fails, try getpwuid().
+
+ getpwnam(name)
+
+ searches in /etc/passwd file (or equivalent database), and
+ returns password entry for the user. The return value is an
+ passwd structure, which has members described below.
+
+ struct passwd
+ name # user name(string)
+ passwd # encrypted password(string)
+ uid # user ID(integer)
+ gid # group ID(integer)
+ gecos # gecos field(string)
+ dir # home directory(string)
+ shell # login shell(string)
+ # members below are optional
+ change # password change time(integer)
+ quota # quota value(integer)
+ age # password age(integer)
+ class # user access class(string)
+ comment # comment(string)
+ expire # account expiration time(integer)
+ end
+
+ See getpwnam(3) for detail.
+
+ getpwuid([uid])
+
+ returns passwd entry for the specified user id. If uid is
+ ommitted, use the value from getuid(). See getpwuid(3) for
+ detail.
+
+ getgrgid(gid)
+
+ searches in /etc/group file (or equivalent database), and
+ returns group entry for the group id. The return value is an
+ group structure, which has members described below.
+
+ struct group
+ name # group name(string)
+ passwd # group password(string)
+ gid # group ID(integer)
+ mem # array of the group member names
+ end
+
+ See getgrgid(3) for detail.
+
+ getgrnam(name)
+
+ returns the group entry for the specified name. The return
+ value is the group structure. See getgrnam(3) for detail.
+
+ group
+
+ iterates over all group entries.
+
+ passwd
+
+ iterates over all passwd entries.
diff --git a/ext/etc/etc.doc b/ext/etc/etc.txt.jp
index 2af895c..8191f48 100644
--- a/ext/etc/etc.doc
+++ b/ext/etc/etc.txt.jp
@@ -5,8 +5,7 @@
/etcディレクトリ以下の情報を得るためのモジュール.クラスにインクルード
して使うこともできる.
-Methods:
-Single Methods:
+Module Function:
getlogin