Index: edit.m =================================================================== RCS file: /cvsroot/octave/octave-forge/main/miscellaneous/edit.m,v retrieving revision 1.18 diff -u -r1.18 edit.m --- edit.m 22 Mar 2006 17:50:47 -0000 1.18 +++ edit.m 29 Mar 2006 04:51:06 -0000 @@ -79,7 +79,7 @@ function ret = edit(file,state) ## pick up globals or default them persistent FUNCTION = struct ("EDITOR", [ EDITOR, " %s" ], - "HOME", [ getenv("HOME"), "/octave" ], + "HOME", [ getenv("HOME"), filesep, "octave" ], "AUTHOR", getpwuid(getuid).gecos, "EMAIL", [], "LICENSE", "GPL"); @@ -110,7 +110,8 @@ ## start the editor without a file if no file is given if nargin < 1 - system(['cd "',FUNCTION.HOME,'" ; ',sprintf(FUNCTION.EDITOR,"")]); + system([sprintf("cd '%s'", FUNCTION.HOME); ... + sprintf("'%s'", FUNCTION.EDITOR)]); return endif @@ -136,23 +137,23 @@ fclose(fid); else from = path; - path = [ FUNCTION.HOME, from(rindex(from,"/"):length(from)) ] ; + path = [ FUNCTION.HOME, from(rindex(from, filesep):length(from)) ] ; system (sprintf("cp '%s' '%s'", from, path)); endif - system(sprintf(FUNCTION.EDITOR, ["'", path, "'"])); + system(sprintf("'%s' '%s'", FUNCTION.EDITOR, path)); return endif ## if editing something other than a m-file or an oct-file, just ## edit it. - path = [ FUNCTION.HOME, "/", file ]; + path = [ FUNCTION.HOME, filesep, file ]; idx = rindex(file,'.'); name = file(1:idx-1); ext = file(idx+1:length(file)); switch (ext) case { "cc", "m" } 0; otherwise - system(sprintf(FUNCTION.EDITOR, ["'", path, "'"])); + system(sprintf("'%s' '%s'", FUNCTION.EDITOR, path)); return; endswitch @@ -163,7 +164,7 @@ if (isempty(FUNCTION.EMAIL)) host=getenv("HOSTNAME"); if isempty(host), - [status, host] = system("uname -n"); + host = system("uname -n"); # trim newline from end of hostname if !isempty(host) host = host(1:length(host)-1); endif endif @@ -291,6 +292,6 @@ fclose(fid); ## Finally we are ready to edit it! - system(sprintf(FUNCTION.EDITOR, ["'", path, "'"])); + system(sprintf("'%s' '%s'", FUNCTION.EDITOR, path)); endfunction