1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/etc/etc.c: Document Etc, Etc.sysconfdir, Etc.systmpdir. Patch

by mathew murphy.  [Ruby 1.9 - Bug #5396]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2011-10-03 23:33:57 +00:00
parent 6be866e262
commit 14f878aed6
2 changed files with 27 additions and 4 deletions

View file

@ -1,3 +1,8 @@
Tue Oct 4 08:33:41 2011 Eric Hodel <drbrain@segment7.net>
* ext/etc/etc.c: Document Etc, Etc.sysconfdir, Etc.systmpdir. Patch
by mathew murphy. [Ruby 1.9 - Bug #5396]
Tue Oct 4 08:21:51 2011 Eric Hodel <drbrain@segment7.net> Tue Oct 4 08:21:51 2011 Eric Hodel <drbrain@segment7.net>
* lib/shellwords.rb: Update toplevel comment with an example. Patch * lib/shellwords.rb: Update toplevel comment with an example. Patch

View file

@ -566,7 +566,9 @@ VALUE rb_w32_conv_from_wchar(const WCHAR *wstr, rb_encoding *enc);
#endif #endif
/* /*
* Returns system configuration directory. * Returns system configuration directory. This is typically "/etc", but
* is modified by the prefix used when Ruby was compiled. For example,
* if Ruby is built and installed in /usr/local, returns "/usr/local/etc".
*/ */
static VALUE static VALUE
etc_sysconfdir(VALUE obj) etc_sysconfdir(VALUE obj)
@ -579,7 +581,7 @@ etc_sysconfdir(VALUE obj)
} }
/* /*
* Returns system temporary directory. * Returns system temporary directory; typically "/tmp".
*/ */
static VALUE static VALUE
etc_systmpdir(void) etc_systmpdir(void)
@ -598,9 +600,25 @@ etc_systmpdir(void)
} }
/* /*
* The etc module provides access to information from the running OS. * The Etc module provides access to information typically stored in
* files in the /etc directory on Unix systems.
* *
* Documented by mathew <meta@pobox.com>. * The information accessible consists of the information found in the
* /etc/passwd and /etc/group files, plus information about the system's
* temporary directory (/tmp) and configuration directory (/etc).
*
* The Etc module provides a more reliable way to access information about
* the logged in user than environment variables such as $USER. For example:
*
* require 'etc'
*
* login = Etc.getlogin
* info = Etc.getpwnam(login)
* username = info.gecos.split(/,/).first
* puts "Hello #{username}, I see your login name is #{login}"
*
* Note that the methods provided by this module are not always secure.
* It should be used for informational purposes, and not for security.
*/ */
void void
Init_etc(void) Init_etc(void)