Created
October 29, 2012 18:06
-
-
Save hosiawak/3975329 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef HAVE_GETGRENT | |
static VALUE | |
setup_group(grp) | |
struct group *grp; | |
{ | |
VALUE mem; | |
char **tbl; | |
mem = rb_ary_new(); | |
tbl = grp->gr_mem; | |
while (*tbl) { | |
rb_ary_push(mem, safe_setup_str(*tbl)); | |
tbl++; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def mem | |
ptr = self[:gr_mem].read_pointer | |
ary = [] | |
2.times do |x| | |
unless ptr.null? | |
s = ptr.read_string | |
ary << s | |
end | |
ptr.address = ptr.address + s.length + 1 | |
end | |
ary | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment