Mercurial > hg > octave-lojdl
changeset 1111:2a36b558ab55
[project @ 1995-02-15 04:01:38 by jwe]
author | jwe |
---|---|
date | Wed, 15 Feb 1995 04:03:31 +0000 |
parents | 456368d90bc7 |
children | b326ac82dc9f |
files | src/dirfns.cc src/sysdep.cc |
diffstat | 2 files changed, 37 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/dirfns.cc +++ b/src/dirfns.cc @@ -73,6 +73,7 @@ #include "procstream.h" #include "tree-const.h" #include "oct-obj.h" +#include "sysdep.h" #include "octave.h" #include "dirfns.h" #include "pager.h" @@ -302,7 +303,7 @@ char *directory; the_current_working_directory = new char [MAXPATHLEN]; - directory = getcwd (the_current_working_directory, MAXPATHLEN); + directory = octave_getcwd (the_current_working_directory, MAXPATHLEN); if (! directory) { message (for_whom, the_current_working_directory); @@ -344,7 +345,7 @@ } } - if (chdir (t) < 0) + if (octave_chdir (t) < 0) { delete [] t; return 0; @@ -358,7 +359,7 @@ } else { - if (chdir (newdir) < 0) + if (octave_chdir (newdir) < 0) return 0; else return 1; @@ -470,7 +471,7 @@ if (verbatim_pwd) { char *buffer = new char [MAXPATHLEN]; - directory = getcwd (buffer, MAXPATHLEN); + directory = octave_getcwd (buffer, MAXPATHLEN); if (!directory) {
--- a/src/sysdep.cc +++ b/src/sysdep.cc @@ -363,6 +363,38 @@ return c; } +char * +octave_getcwd (const char *buf, int len) +{ +#if defined (EMX) + return _getcwd2 (buf, len); +#else + return getcwd (buf, len); +#endif +} + +int +octave_chdir (const char *path) +{ +#if defined (EMX) + int retval = -1; + + if (strlen (path) == 2 && path[1] == ':') + { + char *upper_case_dir_name = strupr (path); + _chdrive (upper_case_dir_name[0]); + if (_getdrive () == upper_case_dir_name[0]) + retval = _chdir2 ("/"); + } + else + retval = _chdir2 (path); + + return retval; +#else + return chdir (path); +#endif +} + DEFUN ("clc", Fclc, Sclc, 0, 0, "clc (): clear screen") {