summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-11-25 03:31:19 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-11-25 03:31:19 +0000
commitce8859c5563493a94f57d3b630e7b9c1d3cd656f (patch)
treeeefe3446c88ef90ff4d3578ae925b4e69d762822 /ext
parent75ff8fdb16fa0a733512e61350c9844ea530ad35 (diff)
*** empty log message ***
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1dev@344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/curses/curses.c8
-rw-r--r--ext/curses/extconf.rb2
-rw-r--r--ext/etc/etc.c22
-rw-r--r--ext/extmk.rb.in72
-rw-r--r--ext/md5/md5init.c4
-rw-r--r--ext/socket/socket.c7
6 files changed, 68 insertions, 47 deletions
diff --git a/ext/curses/curses.c b/ext/curses/curses.c
index edf677ad8e..3d3991373a 100644
--- a/ext/curses/curses.c
+++ b/ext/curses/curses.c
@@ -155,12 +155,16 @@ curses_refresh(obj)
return Qnil;
}
-/* def refresh */
+/* def doupdate */
static VALUE
curses_doupdate(obj)
VALUE obj;
{
+#ifdef HAVE_DOUPDATE
doupdate();
+#else
+ refresh();
+#endif
return Qnil;
}
@@ -252,7 +256,9 @@ static VALUE
curses_flash(obj)
VALUE obj;
{
+#ifdef HAVE_FLASH
flash();
+#endif
return Qnil;
}
diff --git a/ext/curses/extconf.rb b/ext/curses/extconf.rb
index 720bccb8d2..244c9085c4 100644
--- a/ext/curses/extconf.rb
+++ b/ext/curses/extconf.rb
@@ -15,7 +15,7 @@ else
end
if make then
- for f in ["isendwin", "ungetch", "beep"]
+ for f in ["isendwin", "ungetch", "beep", "doupdate", "flash"]
have_func(f)
end
create_makefile("curses")
diff --git a/ext/etc/etc.c b/ext/etc/etc.c
index e2c8de4d80..c10680c7d3 100644
--- a/ext/etc/etc.c
+++ b/ext/etc/etc.c
@@ -37,7 +37,7 @@ etc_getlogin(obj)
#endif
if (login)
- return rb_str_new2(login);
+ return rb_tainted_str_new2(login);
return Qnil;
}
@@ -48,15 +48,15 @@ setup_passwd(pwd)
{
if (pwd == 0) rb_sys_fail("/etc/passwd");
return rb_struct_new(sPasswd,
- rb_str_new2(pwd->pw_name),
- rb_str_new2(pwd->pw_passwd),
+ rb_tainted_str_new2(pwd->pw_name),
+ rb_tainted_str_new2(pwd->pw_passwd),
INT2FIX(pwd->pw_uid),
INT2FIX(pwd->pw_gid),
#ifdef PW_GECOS
- rb_str_new2(pwd->pw_gecos),
+ rb_tainted_str_new2(pwd->pw_gecos),
#endif
- rb_str_new2(pwd->pw_dir),
- rb_str_new2(pwd->pw_shell),
+ rb_tainted_str_new2(pwd->pw_dir),
+ rb_tainted_str_new2(pwd->pw_shell),
#ifdef PW_CHANGE
INT2FIX(pwd->pw_change),
#endif
@@ -67,10 +67,10 @@ setup_passwd(pwd)
INT2FIX(pwd->pw_age),
#endif
#ifdef PW_CLASS
- rb_str_new2(pwd->pw_class),
+ rb_tainted_str_new2(pwd->pw_class),
#endif
#ifdef PW_COMMENT
- rb_str_new2(pwd->pw_comment),
+ rb_tainted_str_new2(pwd->pw_comment),
#endif
#ifdef PW_EXPIRE
INT2FIX(pwd->pw_expire),
@@ -155,12 +155,12 @@ setup_group(grp)
mem = rb_ary_new();
tbl = grp->gr_mem;
while (*tbl) {
- rb_ary_push(mem, rb_str_new2(*tbl));
+ rb_ary_push(mem, rb_tainted_str_new2(*tbl));
tbl++;
}
return rb_struct_new(sGroup,
- rb_str_new2(grp->gr_name),
- rb_str_new2(grp->gr_passwd),
+ rb_tainted_str_new2(grp->gr_name),
+ rb_tainted_str_new2(grp->gr_passwd),
INT2FIX(grp->gr_gid),
mem);
}
diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in
index e8dc56604f..b60951538d 100644
--- a/ext/extmk.rb.in
+++ b/ext/extmk.rb.in
@@ -1,13 +1,14 @@
#! /usr/local/bin/ruby
$".push 'mkmf.rb' #"
-load '../lib/find.rb'
+load '@top_srcdir@/lib/find.rb'
if ARGV[0] == 'static'
$force_static = TRUE
ARGV.shift
elsif ARGV[0] == 'install'
$install = TRUE
+ $destdir = ARGV[1] || ''
ARGV.shift
elsif ARGV[0] == 'clean'
$clean = TRUE
@@ -20,8 +21,16 @@ $cache_mod = FALSE;
$lib_cache = {}
$func_cache = {}
$hdr_cache = {}
-$topdir = "@top_srcdir@"
-if $topdir !~ "^/"
+$top_srcdir = "@top_srcdir@"
+if $top_srcdir !~ "^/"
+ # get absolute path
+ save = Dir.pwd
+ Dir.chdir $top_srcdir
+ $top_srcdir = Dir.pwd
+ Dir.chdir save
+end
+$topdir = ".."
+if $topdir !~ "^/"
# get absolute path
save = Dir.pwd
Dir.chdir $topdir
@@ -63,8 +72,8 @@ CFLAGS = "@CFLAGS@".gsub(/-c..-stack=[0-9]+ */, '')
else
CFLAGS = "@CFLAGS@"
end
-LINK = "@CC@ -o conftest -I#{$topdir} -I@includedir@ " + CFLAGS + " %s @LDFLAGS@ %s conftest.c @LIBS@ %s"
-CPP = "@CPP@ @CPPFLAGS@ -I#{$topdir} -I@includedir@ " + CFLAGS + " %s conftest.c"
+LINK = "@CC@ -o conftest -I#{$topdir} -I#{$top_srcdir} -I@includedir@ " + CFLAGS + " %s @LDFLAGS@ %s conftest.c @LIBS@ %s"
+CPP = "@CPP@ @CPPFLAGS@ -I#{$topdir} -I#{$top_srcdir} -I@includedir@ " + CFLAGS + " %s conftest.c"
if /win32|djgpp|mingw32|m68k-human/i =~ PLATFORM
$null = open("nul", "w")
@@ -105,10 +114,10 @@ def install_rb(mfile)
end
for f in dir
next if f == "."
- mfile.printf "\t@test -d $(libdir)/%s || mkdir $(libdir)/%s\n", f, f
+ mfile.printf "\t@test -d $(DESTDIR)$(pkglibdir)/%s || mkdir $(DESTDIR)$(pkglibdir)/%s\n", f, f
end
for f in path
- mfile.printf "\t$(INSTALL_DATA) lib/%s $(libdir)/%s\n", f, f
+ mfile.printf "\t$(INSTALL_DATA) lib/%s $(DESTDIR)$(pkglibdir)/%s\n", f, f
end
end
@@ -255,7 +264,7 @@ def create_makefile(target)
$DLDFLAGS = $DLDFLAGS + " -L" + $topdir
end
- $srcdir = $topdir + "/ext/" + target
+ $srcdir = $top_srcdir + "/ext/" + target
mfile = open("Makefile", "w")
mfile.printf "\
SHELL = /bin/sh
@@ -270,7 +279,7 @@ hdrdir = #{$topdir}
CC = @CC@
prefix = @prefix@
-CFLAGS = %s -I#{$topdir} -I@includedir@ %s #$CFLAGS %s
+CFLAGS = %s -I#{$topdir} -I#{$top_srcdir} -I@includedir@ %s #$CFLAGS %s
DLDFLAGS = #$DLDFLAGS #$LDFLAGS
LDSHARED = @LDSHARED@
", if $static then "" else "@CCDLFLAGS@" end, CFLAGS, $defs.join(" ")
@@ -282,8 +291,9 @@ RUBY_INSTALL_NAME = `t='$(program_transform_name)'; echo ruby | sed $$t`
prefix = @prefix@
exec_prefix = @exec_prefix@
-libdir = @libdir@/$(RUBY_INSTALL_NAME)
-archdir = $(libdir)/@arch@
+libdir = @libdir@
+pkglibdir = $(libdir)/$(RUBY_INSTALL_NAME)
+archdir = $(pkglibdir)/@arch@
@SET_MAKE@
#### End of system configuration section. ####
@@ -294,7 +304,7 @@ archdir = $(libdir)/@arch@
mfile.printf "OBJS = "
if !$objs then
$objs = []
- for f in Dir["#{$topdir}/ext/#{target}/*.{c,cc}"]
+ for f in Dir["#{$top_srcdir}/ext/#{$mdir}/*.{c,cc}"]
f = File.basename(f)
f.sub!(/\.(c|cc)$/, ".o")
$objs.push f
@@ -313,7 +323,7 @@ binsuffix = @binsuffix@
all: $(TARGET)
-clean:; @rm -f *.o *.so *.sl
+clean:; @rm -f *.o *.a *.so *.sl
@rm -f Makefile extconf.h conftest.*
@rm -f core ruby$(binsuffix) *~
@@ -324,12 +334,13 @@ realclean: clean
mfile.printf "\
install:
- @test -d $(libdir) || mkdir $(libdir)
- @test -d $(archdir) || mkdir $(archdir)
+ @test -d $(DESTDIR)$(libdir) || mkdir $(DESTDIR)$(libdir)
+ @test -d $(DESTDIR)$(pkglibdir) || mkdir $(DESTDIR)$(pkglibdir)
+ @test -d $(DESTDIR)$(archdir) || mkdir $(DESTDIR)$(archdir)
"
if !$static
mfile.printf "\
- $(INSTALL) $(TARGET) $(archdir)/$(TARGET)
+ $(INSTALL) $(TARGET) $(DESTDIR)$(archdir)/$(TARGET)
"
end
install_rb(mfile)
@@ -339,7 +350,7 @@ install:
mfile.printf "\
$(TARGET): $(OBJS)
@AR@ cru $(TARGET) $(OBJS)
- @-@RANLIB@ $(LIBRUBY) 2> /dev/null || true
+ @-@RANLIB@ $(TARGET) 2> /dev/null || true
"
elsif "@DLEXT@" != "o"
mfile.printf "\
@@ -405,17 +416,18 @@ def extmake(target)
$LDFLAGS = nil
begin
- system "mkdir " + target unless File.directory?(target)
+ system "mkdir", target unless File.directory?(target)
Dir.chdir target
+ $mdir = target
if $static_ext.size > 0 ||
!File.exist?("./Makefile") ||
- older("./Makefile", "#{$topdir}/ext/@setup@") ||
+ older("./Makefile", "#{$top_srcdir}/ext/@setup@") ||
older("./Makefile", "../extmk.rb") ||
- older("./Makefile", "#{$topdir}/ext/#{target}/extconf.rb")
+ older("./Makefile", "#{$top_srcdir}/ext/#{target}/extconf.rb")
then
$defs = []
- if File.exist?("#{$topdir}/ext/#{target}/extconf.rb")
- load "#{$topdir}/ext/#{target}/extconf.rb"
+ if File.exist?("#{$top_srcdir}/ext/#{target}/extconf.rb")
+ load "#{$top_srcdir}/ext/#{target}/extconf.rb"
else
create_makefile(target);
end
@@ -425,7 +437,7 @@ def extmake(target)
$extlist.push [$static,target]
end
if $install
- system "make install"
+ system "make install DESTDIR=#{$destdir}"
elsif $clean
system "make clean"
else
@@ -445,7 +457,7 @@ end
# get static-link modules
$static_ext = {}
-for setup in ["@setup@", "#{$topdir}/ext/@setup@"]
+for setup in ["@setup@", "#{$top_srcdir}/ext/@setup@"]
if File.file? setup
f = open(setup)
while f.gets()
@@ -463,7 +475,7 @@ for setup in ["@setup@", "#{$topdir}/ext/@setup@"]
end
end
-for d in Dir["#{$topdir}/ext/*"]
+for d in Dir["#{$top_srcdir}/ext/*"]
File.directory?(d) || next
File.file?(d + "/MANIFEST") || next
@@ -511,7 +523,7 @@ if $extlist.size > 0
end
end
- if older("extinit.c", "#{$topdir}/ext/@setup@")
+ if older("extinit.c", "#{$top_srcdir}/ext/@setup@")
f = open("extinit.c", "w")
f.printf "void Init_ext() {\n"
f.printf $extinit
@@ -526,11 +538,15 @@ if $extlist.size > 0
Dir.chdir ".."
- if older("ruby@binsuffix@", "#{$topdir}/ext/@setup@") or older("ruby@binsuffix@", "miniruby@binsuffix@")
+ if older("ruby@binsuffix@", "#{$top_srcdir}/ext/@setup@") or older("ruby@binsuffix@", "miniruby@binsuffix@")
`rm -f ruby@binsuffix@`
end
- $extobjs = "ext/extinit.o " + $extobjs
+ if $extobjs
+ $extobjs = "ext/extinit.o " + $extobjs
+ else
+ $extobjs = "ext/extinit.o "
+ end
if PLATFORM =~ /m68k-human|beos/
$extlibs.gsub!("-L/usr/local/lib", "") if $extlibs
end
diff --git a/ext/md5/md5init.c b/ext/md5/md5init.c
index 956264608b..a825f96d47 100644
--- a/ext/md5/md5init.c
+++ b/ext/md5/md5init.c
@@ -53,7 +53,7 @@ md5_clone(obj)
MD5_CTX *md5, *md5_new;
Data_Get_Struct(obj, MD5_CTX, md5);
- obj = Data_Make_Struct(CLASS_OF(obj), MD5_CTX, 0, 0, md5_new);
+ obj = Data_Make_Struct(CLASS_OF(obj), MD5_CTX, 0, free, md5_new);
*md5_new = *md5;
return obj;
@@ -72,7 +72,7 @@ md5_new(argc, argv, class)
rb_scan_args(argc, argv, "01", &arg);
if (!NIL_P(arg)) Check_Type(arg, T_STRING);
- obj = Data_Make_Struct(class, MD5_CTX, 0, 0, md5);
+ obj = Data_Make_Struct(class, MD5_CTX, 0, free, md5);
MD5Init(md5);
if (!NIL_P(arg)) {
md5_update(obj, arg);
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 9dbd51fc4f..e9bdbc9e8c 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -378,7 +378,7 @@ s_recv(sock, argc, argv, from)
}
rb_sys_fail("recvfrom(2)");
}
- rb_str_taint(str);
+ rb_obj_taint(str);
switch (from) {
case RECV_RECV:
return (VALUE)str;
@@ -588,9 +588,7 @@ open_inet(class, h, serv, type)
host = RSTRING(h)->ptr;
hostent = gethostbyname(host);
if (hostent == NULL) {
- inet_aton(host, &sockaddr.sin_addr);
- hostaddr = sockaddr.sin_addr.s_addr;
- if (hostaddr == -1) {
+ if (!inet_aton(host, &sockaddr.sin_addr)) {
if (type == INET_SERVER && !strlen(host))
hostaddr = INADDR_ANY;
else {
@@ -602,6 +600,7 @@ open_inet(class, h, serv, type)
#endif
}
}
+ hostaddr = sockaddr.sin_addr.s_addr;
_hostent.h_addr_list = (char **)hostaddrPtr;
_hostent.h_addr_list[0] = (char *)&hostaddr;
_hostent.h_addr_list[1] = NULL;