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

* lib/mkmf.rb (have_library, find_library): configure by library

name.

* win32/win32.c (isInternalCmd): distinguish command.com and
  cmd.exe.

* win32/win32.c (make_cmdvector): a character just after wildcard
  was ignored.  [ruby-core:01518]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2003-09-05 15:00:33 +00:00
parent d833e3db01
commit 01e3a55648
3 changed files with 88 additions and 44 deletions

View file

@ -1,3 +1,16 @@
Sat Sep 6 00:00:20 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/mkmf.rb (have_library, find_library): configure by library
name.
Sat Sep 6 00:00:20 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
* win32/win32.c (isInternalCmd): distinguish command.com and
cmd.exe.
* win32/win32.c (make_cmdvector): a character just after wildcard
was ignored. [ruby-core:01518]
Fri Sep 5 20:27:08 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org> Fri Sep 5 20:27:08 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* test/ruby/test_*.rb: replace 'assert(a == b)' with assert_equal(a, b)' * test/ruby/test_*.rb: replace 'assert(a == b)' with assert_equal(a, b)'

View file

@ -456,7 +456,8 @@ end
def have_library(lib, func = nil, &b) def have_library(lib, func = nil, &b)
func = "main" if !func or func.empty? func = "main" if !func or func.empty?
checking_for "#{func}() in -l#{lib}" do lib = with_config(lib+'lib', lib)
checking_for "#{func}() in #{LIBARG%lib}" do
if COMMON_LIBS.include?(lib) if COMMON_LIBS.include?(lib)
true true
else else
@ -472,7 +473,9 @@ def have_library(lib, func = nil, &b)
end end
def find_library(lib, func, *paths, &b) def find_library(lib, func, *paths, &b)
checking_for "#{func}() in -l#{lib}" do func = "main" if !func or func.empty?
lib = with_config(lib+'lib', lib)
checking_for "#{func}() in #{LIBARG%lib}" do
libpath = $LIBPATH libpath = $LIBPATH
libs = append_library($libs, lib) libs = append_library($libs, lib)
begin begin

View file

@ -481,35 +481,62 @@ int SafeFree(char **vec, int vecc)
} }
/*
ruby -lne 'BEGIN{$cmds = Hash.new(0); $mask = 1}'
-e '$cmds[$_.downcase] |= $mask' -e '$mask <<= 1 if ARGF.eof'
-e 'END{$cmds.sort.each{|n,f|puts " \"\\#{f.to_s(8)}\" #{n.dump} + 1,"}}'
98cmd ntcmd
*/
static char *szInternalCmds[] = { static char *szInternalCmds[] = {
"append", "\2" "assoc" + 1,
"break", "\3" "break" + 1,
"call", "\3" "call" + 1,
"cd", "\3" "cd" + 1,
"chdir", "\1" "chcp" + 1,
"cls", "\3" "chdir" + 1,
"copy", "\3" "cls" + 1,
"date", "\2" "color" + 1,
"del", "\3" "copy" + 1,
"dir", "\1" "ctty" + 1,
"echo", "\3" "date" + 1,
"erase", "\3" "del" + 1,
"label", "\3" "dir" + 1,
"md", "\3" "echo" + 1,
"mkdir", "\2" "endlocal" + 1,
"path", "\3" "erase" + 1,
"pause", "\3" "exit" + 1,
"rd", "\3" "for" + 1,
"rem", "\2" "ftype" + 1,
"ren", "\3" "goto" + 1,
"rename", "\3" "if" + 1,
"rmdir", "\1" "lfnfor" + 1,
"set", "\1" "lh" + 1,
"start", "\1" "lock" + 1,
"time", "\3" "md" + 1,
"type", "\3" "mkdir" + 1,
"ver", "\2" "move" + 1,
"vol", "\3" "path" + 1,
"\3" "pause" + 1,
"\2" "popd" + 1,
"\3" "prompt" + 1,
"\2" "pushd" + 1,
"\3" "rd" + 1,
"\3" "rem" + 1,
"\3" "ren" + 1,
"\3" "rename" + 1,
"\3" "rmdir" + 1,
"\3" "set" + 1,
"\2" "setlocal" + 1,
"\3" "shift" + 1,
"\2" "start" + 1,
"\3" "time" + 1,
"\2" "title" + 1,
"\1" "truename" + 1,
"\3" "type" + 1,
"\1" "unlock" + 1,
"\3" "ver" + 1,
"\3" "verify" + 1,
"\3" "vol" + 1,
}; };
static int static int
@ -519,11 +546,16 @@ internal_match(const void *key, const void *elem)
} }
static int static int
isInternalCmd(const char *cmd) isInternalCmd(const char *cmd, const char *interp)
{ {
int i; int i, nt = 1;
char cmdname[8], *b = cmdname, c; char cmdname[9], *b = cmdname, c, **nm;
i = strlen(interp) - 11;
if ((i == 0 || i > 0 && isdirsep(interp[i])) &&
strcasecmp(interp+i, "command.com") == 0) {
nt = 0;
}
do { do {
if (!(c = *cmd++)) return 0; if (!(c = *cmd++)) return 0;
} while (isspace(c)); } while (isspace(c));
@ -542,10 +574,11 @@ isInternalCmd(const char *cmd)
return 0; return 0;
} }
*b = 0; *b = 0;
if (!bsearch(cmdname, szInternalCmds, nm = bsearch(cmdname, szInternalCmds,
sizeof(szInternalCmds) / sizeof(*szInternalCmds), sizeof(szInternalCmds) / sizeof(*szInternalCmds),
sizeof(*szInternalCmds), sizeof(*szInternalCmds),
internal_match)) internal_match);
if (!nm || !(nm[0][-1] & (nt ? 2 : 1)))
return 0; return 0;
return 1; return 1;
} }
@ -877,27 +910,23 @@ CreateChild(char *cmd, char *prog, SECURITY_ATTRIBUTES *psa, HANDLE hInput, HAND
dwCreationFlags = (NORMAL_PRIORITY_CLASS); dwCreationFlags = (NORMAL_PRIORITY_CLASS);
shell = NULL;
if (prog) { if (prog) {
shell = prog; shell = prog;
} }
else { else if (has_redirection(cmd)) {
int redir = -1; if (shell = getenv("RUBYSHELL")) {
if ((shell = getenv("RUBYSHELL")) && (redir = has_redirection(cmd))) {
char *tmp = ALLOCA_N(char, strlen(shell) + strlen(cmd) + char *tmp = ALLOCA_N(char, strlen(shell) + strlen(cmd) +
sizeof (" -c ")); sizeof (" -c "));
sprintf(tmp, "%s -c %s", shell, cmd); sprintf(tmp, "%s -c %s", shell, cmd);
cmd = tmp; cmd = tmp;
} }
else if ((shell = getenv("COMSPEC")) && else if ((shell = getenv("COMSPEC")) && isInternalCmd(cmd, shell)) {
((redir < 0 ? has_redirection(cmd) : redir) || isInternalCmd(cmd))) {
char *tmp = ALLOCA_N(char, strlen(shell) + strlen(cmd) + char *tmp = ALLOCA_N(char, strlen(shell) + strlen(cmd) +
sizeof (" /c ")); sizeof (" /c "));
sprintf(tmp, "%s /c %s", shell, cmd); sprintf(tmp, "%s /c %s", shell, cmd);
cmd = tmp; cmd = tmp;
} }
else {
shell = NULL;
}
} }
RUBY_CRITICAL({ RUBY_CRITICAL({
@ -1116,7 +1145,6 @@ make_cmdvector(const char *cmd, char ***vec)
if (quote != '\'') if (quote != '\'')
globbing++; globbing++;
ptr++;
slashes = 0; slashes = 0;
break; break;