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j4JC1$@$C$?$N$G$O$J$$$G$7$g$&$+!#(B
$B$7$+$7!":#2s:n@.$7$?(Bfnmatch$B%i%$%V%i%j$N@_7W$O$*@$<-$K$b$h$$$H8@$($k$b(B
$B$N$G$O$"$j$^$;$s!#(B($B$O$C$-$j8@$C$F$7$^$&$H%@%5$$$G$9!#(B) $B$3$l$K$OM}M3$,(B
$B$"$j$^$9!#[email protected]$r:n$C$F$7$^$&$H%M%?$,$J$/$J$k$+$i!"$G$O(B
$B$J$/$F!"4JC1$J$3$H$+$i$O$8$a$F!"CJ3,E*$K%9%F%C%W%"%C%W$7$F$$$C$?J}$,$o(B
$B$+$j$d$9$$$H;W$&$+$i$G$9!#(B
$B$H$$$&$o$1$G!"/$73HD%(B
$B%i%$%V%i%j$N:n@.$K$D$$$F@bL@$7$^$9!#(B
$B$=$l$G$O!"(BHappy hacking!
"Re: Concurrent Programming in Java",
[email protected]
<URL:http://www.shugo.net/news/fj.comp.oops/19970219-27.txt>
"QScheme",
Daniel Crettol
<URL:http://www.sof.ch/dan/qscheme/index-e.html>
"[ruby-dev:12197] String#fnmatch",
Akinori MUSHA
<URL:http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-dev/12197>
*1 $B8=:_$N%$%s%?%W%j%?$G$O9=J8LZ$r:F5"E*$KC)$C$F$B3HD%%i%$%V%i%j$C$F(B?
require "socket"
s = TCPSocket.new("localhost", "smtp")
$B3HD%%i%$%V%i%j$NB8:_M}M3(B
C$B%i%$%V%i%j$NMxMQ(B
$B9bB.2=(B
$B3HD%%i%$%V%i%j$N9=@.(B
$ find * -type f -print > MANIFEST
fnmatch$B3HD%%i%$%V%i%j(B
fnmatch(3)
int fnmatch(const char *pattern, const char *string, int flags);
$ man 3 fnmatch
$B@_7W(B
extconf.rb
-- List1 extconf.rb
#!/usr/bin/ruby
require "mkmf"
if have_header("fnmatch.h")
create_makefile("fnmatch")
end
fnmatch.c
-- List2 fnmatch.c
#include <fnmatch.h>
#include "ruby.h"
static VALUE f_fnmatch(VALUE self, VALUE pattern, VALUE string, VALUE flags)
{
int ret;
ret = fnmatch(STR2CSTR(pattern), STR2CSTR(string), NUM2INT(flags));
switch (ret) {
case 0:
return Qtrue;
case FNM_NOMATCH:
return Qfalse;
default:
rb_raise(rb_eRuntimeError, "error");
}
}
void Init_fnmatch()
{
rb_define_global_function("fnmatch", f_fnmatch, 3);
rb_define_global_const("FNM_NOESCAPE", INT2NUM(FNM_NOESCAPE));
rb_define_global_const("FNM_PATHNAME", INT2NUM(FNM_PATHNAME));
rb_define_global_const("FNM_PERIOD", INT2NUM(FNM_PERIOD));
}
$B%$%s%9%H!<%k(B
$ ruby extconf.rb
$ make
# make site-install
$B%5%s%W%k%W%m%0%i%`(B
-- List3 gwcp.rb
#!/usr/bin/ruby
require "fnmatch"
pattern = ARGV.shift
unless pattern
$stderr.printf("usage: %s <pattern> [files...]\n", $0)
exit 1
end
while line = gets
line.chomp!
if fnmatch(pattern, line, 0)
puts line
end
end
-- Fig1 gwcp.rb$B$N
$B:G8e$K(B
$B;29M(BURL