Index: scripts/pkg/pkg.m =================================================================== RCS file: /cvs/octave/scripts/pkg/pkg.m,v retrieving revision 1.43 diff -c -r1.43 pkg.m *** scripts/pkg/pkg.m 14 May 2007 13:56:34 -0000 1.43 --- scripts/pkg/pkg.m 18 May 2007 21:00:49 -0000 *************** *** 659,666 **** src = fullfile (packdir, "src"); ## configure if (exist (fullfile (src, "configure"), "file")) ! [status, output] = system (strcat ("cd ", src, "; ./configure --prefix=", ! desc.dir)); if (verbose) printf("%s", output); endif --- 659,670 ---- src = fullfile (packdir, "src"); ## configure if (exist (fullfile (src, "configure"), "file")) ! [status, output] = shell (strcat ("cd ", src, "; ./configure --prefix=\"", ! desc.dir, "\"", ! " CC=", octave_config_info ("CC"), ! " CXX=", octave_config_info ("CXX"), ! " AR=", octave_config_info ("AR"), ! " RANLIB=", octave_config_info ("RANLIB"))); if (verbose) printf("%s", output); endif *************** *** 672,679 **** ## make if (exist (fullfile (src, "Makefile"), "file")) ! [status, output] = system (strcat ("export INSTALLDIR=", desc.dir, ! "; make -C ", src)); if (verbose) printf("%s", output); endif --- 676,683 ---- ## make if (exist (fullfile (src, "Makefile"), "file")) ! [status, output] = shell (strcat ("export INSTALLDIR=\"", desc.dir, ! "\"; make -C ", src)); if (verbose) printf("%s", output); endif *************** *** 953,959 **** endfunction function out = issuperuser () ! out = strcmp (getenv("USER"), "root"); endfunction ## This function makes sure the package contains the --- 957,967 ---- endfunction function out = issuperuser () ! if (ispc () && ! isunix ()) ! out = 1; ! else ! out = strcmp (getenv("USER"), "root"); ! endif endfunction ## This function makes sure the package contains the *************** *** 1239,1247 **** endif ## Now check if the package is loaded ! tmppath = path(); for i = 1:length (installed_packages) ! if (regexp (tmppath, installed_packages{i}.dir)) installed_packages{i}.loaded = true; else installed_packages{i}.loaded = false; --- 1247,1255 ---- endif ## Now check if the package is loaded ! tmppath = strrep (path(), "\\", "/"); for i = 1:length (installed_packages) ! if (regexp (tmppath, strrep (installed_packages{i}.dir, "\\", "/"))) installed_packages{i}.loaded = true; else installed_packages{i}.loaded = false; *************** *** 1484,1486 **** --- 1492,1520 ---- octave_config_info("api_version")]; arch = _arch; endfunction + + function [status, output] = shell (cmd) + + persistent have_sh; + + cmd = strrep (cmd, "\\", "/"); + disp (cmd); + if (ispc () && ! isunix ()) + if (isempty(have_sh)) + if (system("sh.exe -c \"exit\"")) + have_sh = false; + else + have_sh = true; + endif + endif + if (have_sh) + [status, output] = system (["sh.exe -c \"", cmd, "\""]); + else + error ("Can not find the command shell") + endif + else + [status, output] = system (cmd); + endif + disp(output); + + endfunction Index: scripts/miscellaneous/copyfile.m =================================================================== RCS file: /cvs/octave/scripts/miscellaneous/copyfile.m,v retrieving revision 1.6 diff -c -r1.6 copyfile.m *** scripts/miscellaneous/copyfile.m 8 Mar 2007 19:40:01 -0000 1.6 --- scripts/miscellaneous/copyfile.m 18 May 2007 21:00:49 -0000 *************** *** 40,46 **** ## FIXME -- maybe use the same method as in ls to allow users control ## over the command that is executed. ! if (ispc () && ! isunix () && isempty (file_in_path (EXEC_PATH, "cp"))) ## Windows. cmd = "cmd /C xcopy /E"; cmd_force_flag = "/Y"; --- 40,46 ---- ## FIXME -- maybe use the same method as in ls to allow users control ## over the command that is executed. ! if (ispc () && ! isunix () && isempty (file_in_path (EXEC_PATH, "cp.exe"))) ## Windows. cmd = "cmd /C xcopy /E"; cmd_force_flag = "/Y"; *************** *** 73,78 **** --- 73,83 ---- f1 = sprintf ("\"%s\" ", f1{:}); f2 = tilde_expand (f2); + + if (ispc () && ! isunix () && ! isempty (file_in_path (EXEC_PATH, "cp.exe"))) + f1 = strrep (f1, "\\", "/"); + f2 = strrep (f2, "\\", "/"); + endif ## Copy the files. [err, msg] = system (sprintf ("%s %s \"%s\"", cmd, f1, f2));