# HG changeset patch # User John W. Eaton # Date 1290758296 18000 # Node ID 4ecc7bc5bc8306931fa9c96e13e85af06599df7d # Parent 6e8393b09d03f1c117f9626757008d7e4df6679a search PATH from environment for programs, not EXEC_PATH diff -r 6e8393b09d03 -r 4ecc7bc5bc83 scripts/ChangeLog --- a/scripts/ChangeLog Fri Nov 26 02:45:24 2010 -0500 +++ b/scripts/ChangeLog Fri Nov 26 02:58:16 2010 -0500 @@ -1,3 +1,15 @@ +2010-11-26 John W. Eaton + + * pkg/pkg.m: Append directories to EXEC_PATH instead of + prepending them. Use pathsep instead of ":". + + * miscellaneous/copyfile.m, miscellaneous/movefile.m, + miscellaneous/ls_command.m, plot/__print_parse_opts__.m: + Search PATH for programs, not EXEC_PATH. + + * plot/print.m: Refer to PATH, not EXEC_PATH in error messages. + * plot/__print_parse_opts__.m: Likewise. + 2010-11-25 Kai Habel * (plot/uimenu.m): Simplify code, add further check. diff -r 6e8393b09d03 -r 4ecc7bc5bc83 scripts/miscellaneous/copyfile.m --- a/scripts/miscellaneous/copyfile.m Fri Nov 26 02:45:24 2010 -0500 +++ b/scripts/miscellaneous/copyfile.m Fri Nov 26 02:58:16 2010 -0500 @@ -40,7 +40,8 @@ ## 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"))) + if (ispc () && ! isunix () + && isempty (file_in_path (getenv ("PATH"), "cp.exe"))) ## Windows. cmd = "cmd /C xcopy /E"; cmd_force_flag = "/Y"; @@ -93,7 +94,8 @@ f1(1) = []; endwhile - if (ispc () && ! isunix () && ! isempty (file_in_path (EXEC_PATH, "cp.exe"))) + if (ispc () && ! isunix () + && ! isempty (file_in_path (getenv ("PATH"), "cp.exe"))) p1 = strrep (p1, "\\", "/"); p2 = strrep (p2, "\\", "/"); endif @@ -107,7 +109,8 @@ endif endwhile else - if (ispc () && ! isunix () && ! isempty (file_in_path (EXEC_PATH, "cp.exe"))) + if (ispc () && ! isunix () + && ! isempty (file_in_path (getenv ("PATH"), "cp.exe"))) p1 = strrep (p1, "\\", "/"); p2 = strrep (p2, "\\", "/"); endif diff -r 6e8393b09d03 -r 4ecc7bc5bc83 scripts/miscellaneous/ls_command.m --- a/scripts/miscellaneous/ls_command.m Fri Nov 26 02:45:24 2010 -0500 +++ b/scripts/miscellaneous/ls_command.m Fri Nov 26 02:58:16 2010 -0500 @@ -32,7 +32,8 @@ if (isempty (__ls_command__)) ## FIXME -- ispc and isunix both return true for Cygwin. Should they? - if (ispc () && ! isunix () && isempty (file_in_path (EXEC_PATH, "ls"))) + if (ispc () && ! isunix () + && isempty (file_in_path (getenv ("PATH"), "ls"))) __ls_command__ = "cmd /C dir /D"; else __ls_command__ = "ls -C"; diff -r 6e8393b09d03 -r 4ecc7bc5bc83 scripts/miscellaneous/movefile.m --- a/scripts/miscellaneous/movefile.m Fri Nov 26 02:45:24 2010 -0500 +++ b/scripts/miscellaneous/movefile.m Fri Nov 26 02:58:16 2010 -0500 @@ -39,7 +39,8 @@ ## 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, "mv.exe"))) + if (ispc () && ! isunix () + && isempty (file_in_path (getenv ("PATH"), "mv.exe"))) ## Windows. cmd = "cmd /C move"; cmd_force_flag = "/Y"; @@ -92,7 +93,8 @@ f1(1) = []; endwhile - if (ispc () && ! isunix () && ! isempty (file_in_path (EXEC_PATH, "cp.exe"))) + if (ispc () && ! isunix () + && ! isempty (file_in_path (getenv ("PATH"), "cp.exe"))) p1 = strrep (p1, "\\", "/"); p2 = strrep (p2, "\\", "/"); endif @@ -105,7 +107,8 @@ endif endwhile else - if (ispc () && ! isunix () && ! isempty (file_in_path (EXEC_PATH, "cp.exe"))) + if (ispc () && ! isunix () + && ! isempty (file_in_path (getenv_path ("PATH"), "cp.exe"))) p1 = strrep (p1, "\\", "/"); p2 = strrep (p2, "\\", "/"); endif diff -r 6e8393b09d03 -r 4ecc7bc5bc83 scripts/pkg/pkg.m --- a/scripts/pkg/pkg.m Fri Nov 26 02:45:24 2010 -0500 +++ b/scripts/pkg/pkg.m Fri Nov 26 02:58:16 2010 -0500 @@ -2295,13 +2295,13 @@ ndir = installed_pkgs_lst{i}.dir; dirs{end+1} = ndir; if (exist (fullfile (dirs{end}, "bin"), "dir")) - execpath = cstrcat (fullfile (dirs{end}, "bin"), ":", execpath); + execpath = cstrcat (execpath, pathsep (), fullfile (dirs{end}, "bin")); endif tmpdir = getarchdir (installed_pkgs_lst{i}); if (exist (tmpdir, "dir")) dirs{end + 1} = tmpdir; if (exist (fullfile (dirs{end}, "bin"), "dir")) - execpath = cstrcat (fullfile (dirs{end}, "bin"), ":", execpath); + execpath = cstrcat (execpath, pathsep (), fullfile (dirs{end}, "bin")); endif endif endfor diff -r 6e8393b09d03 -r 4ecc7bc5bc83 scripts/plot/__print_parse_opts__.m --- a/scripts/plot/__print_parse_opts__.m Fri Nov 26 02:45:24 2010 -0500 +++ b/scripts/plot/__print_parse_opts__.m Fri Nov 26 02:58:16 2010 -0500 @@ -120,7 +120,7 @@ elseif (strncmp (arg, "-PSTOEDIT:", 9)) arg_st.pstoedit_binary = arg{10:end}; elseif ((length (arg) > 2) && arg(1:2) == "-G") - arg_st.ghostscript.binary = file_in_path (EXEC_PATH, arg(3:end)); + arg_st.ghostscript.binary = file_in_path (getenv ("PATH"), arg(3:end)); if (isempty (arg_st.ghostscript.binary)) error ("print: Ghostscript binary ""%s"" could not be located", arg(3:end)) @@ -261,7 +261,7 @@ endif else arg_st.append_to_file = false; - warning ("print.m: appended output requires ghostscript to be installed.") + warning ("print.m: appended output requires ghostscript to be installed") endif else warning ("print.m: appended output is not supported for device '%s'", @@ -344,16 +344,16 @@ if (warn_on_missing_binary) if (isempty (arg_st.ghostscript.binary)) - warning ("print:missinggs", "print.m: Ghostscript binary is not available.") + warning ("print:missinggs", "print.m: Ghostscript binary is not available") endif if (isempty (arg_st.epstool_binary)) - warning ("print:missinggs", "print.m: epstool binary is not available.") + warning ("print:missinggs", "print.m: epstool binary is not available") endif if (isempty (arg_st.fig2dev_binary)) - warning ("print:missinggs", "print.m: fig2dev binary is not available.") + warning ("print:missinggs", "print.m: fig2dev binary is not available") endif if (isempty (arg_st.pstoedit_binary)) - warning ("print:missinggs", "print.m: pstoedit binary is not available.") + warning ("print:missinggs", "print.m: pstoedit binary is not available") endif warn_on_missing_binary = false; endif @@ -431,11 +431,12 @@ if (isempty (ghostscript_binary)) GSC = getenv ("GSC"); - if (exist (GSC, "file") || (! isempty (GSC) && file_in_path (EXEC_PATH, GSC))) + if (exist (GSC, "file") + || (! isempty (GSC) && file_in_path (getenv ("PATH"), GSC))) gs_binaries = {GSC}; elseif (! isempty (GSC) && warn_on_bad_gsc) warning ("print:badgscenv", - "print.m: GSC environment variable not set properly.") + "print.m: GSC environment variable not set properly") warn_on_bad_gsc = false; gs_binaries = {}; else @@ -451,11 +452,11 @@ n = 0; while (n < numel (gs_binaries) && isempty (ghostscript_binary)) n = n + 1; - ghostscript_binary = file_in_path (EXEC_PATH, gs_binaries{n}); + ghostscript_binary = file_in_path (getenv ("PATH"), gs_binaries{n}); endwhile if (warn_on_no_ghostscript && isempty (ghostscript_binary)) warning ("print:noghostscript", - "print.m: ghostscript not found in EXEC_PATH.") + "print.m: ghostscript not found in PATH") warn_on_no_ghostscript = false; endif endif @@ -485,11 +486,11 @@ n = 0; while (n < numel (binaries) && isempty (data.(binary).bin)) n = n + 1; - data.(binary).bin = file_in_path (EXEC_PATH, binaries{n}); + data.(binary).bin = file_in_path (getenv ("PATH"), binaries{n}); endwhile if (isempty (data.(binary).bin) && data.(binary).warn_on_absence) warning (sprintf ("print:no%s", binary), - "print.m: '%s' not found in EXEC_PATH", binary) + "print.m: '%s' not found in PATH", binary) data.(binary).warn_on_absence = false; endif endif @@ -570,7 +571,7 @@ value = value * 72 / 25.4; case "normalized" error ("print:customnormalized", - "print.m: papersize=='' and paperunits='normalized' may not be combined.") + "print.m: papersize=='' and paperunits='normalized' may not be combined") endswitch endfunction diff -r 6e8393b09d03 -r 4ecc7bc5bc83 scripts/plot/print.m --- a/scripts/plot/print.m Fri Nov 26 02:45:24 2010 -0500 +++ b/scripts/plot/print.m Fri Nov 26 02:58:16 2010 -0500 @@ -262,7 +262,7 @@ opts.epstool_cmd = @epstool; if (! isfigure (opts.figure)) - error ("print: no figure to print.") + error ("print: no figure to print") endif orig_figure = get (0, "currentfigure"); @@ -382,7 +382,7 @@ for n = 1:numel(opts.unlink) [status, output] = unlink (opts.unlink{n}); if (status != 0) - warning ("print.m: %s, '%s'.", output, opts.unlink{n}) + warning ("print.m: %s, '%s'", output, opts.unlink{n}) endif endfor end_unwind_protect @@ -440,7 +440,7 @@ if (! isempty (opts.preview) && opts.tight_flag) warning ("print:previewandtight", - "print.m: eps preview may not be combined with -tight.") + "print.m: eps preview may not be combined with -tight") endif if (! isempty (opts.preview) || opts.tight_flag) if (! isempty (opts.epstool_binary)) @@ -488,7 +488,7 @@ if (! isempty (cleanup)) if (pipeout && dos_shell) error ("print:epstoolpipe", - "print.m: cannot pipe output of 'epstool' for DOS shell.") + "print.m: cannot pipe output of 'epstool' for DOS shell") elseif (pipeout) cmd = sprintf ("( %s %s )", cmd, cleanup); else @@ -496,7 +496,7 @@ endif endif elseif (isempty (opts.epstool_binary)) - error ("print:noepstool", "print.m: 'epstool' not found in EXEC_PATH.") + error ("print:noepstool", "print.m: 'epstool' not found in PATH") endif else if (pipein && pipeout) @@ -543,7 +543,7 @@ cmd = sprintf ("%s -L %s 2> /dev/null", opts.fig2dev_binary, devopt); endif elseif (isempty (opts.fig2dev_binary)) - error ("print:nofig2dev", "print.m: 'fig2dev' not found in EXEC_PATH.") + error ("print:nofig2dev", "print.m: 'fig2dev' not found in PATH") endif if (opts.debug) fprintf ("fig2dev command: '%s'\n", cmd) @@ -597,7 +597,7 @@ cmd = sprintf ("%s -P %s", cmd, opts.printer); endif elseif (isempty (opts.lpr_binary)) - error ("print:nolpr", "print.m: 'lpr' not found in EXEC_PATH.") + error ("print:nolpr", "print.m: 'lpr' not found in PATH") endif if (opts.debug) fprintf ("lpr command: '%s'\n", cmd) @@ -617,7 +617,7 @@ cmd = sprintf ("%s -f %s 2> /dev/null", opts.pstoedit_binary, devopt); endif elseif (isempty (opts.pstoedit_binary)) - error ("print:nopstoedit", "print.m: 'pstoedit' not found in EXEC_PATH.") + error ("print:nopstoedit", "print.m: 'pstoedit' not found in PATH") endif if (opts.debug) fprintf ("pstoedit command: '%s'\n", cmd)