[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
MSVC compiler support [patch 32]: ls
From: |
John W. Eaton |
Subject: |
MSVC compiler support [patch 32]: ls |
Date: |
Fri, 27 Oct 2006 14:04:38 -0400 |
On 17-Oct-2006, Michael Goffioul wrote:
| Implement "ls" using "cmd /C dir"
| Index: src/dirfns.cc
| ===================================================================
| RCS file: /cvs/octave/src/dirfns.cc,v
| retrieving revision 1.105
| diff -p -c -r1.105 dirfns.cc
| *** src/dirfns.cc 1 Sep 2006 18:00:02 -0000 1.105
| --- src/dirfns.cc 17 Oct 2006 11:07:42 -0000
| *************** from system to system.\n\
| *** 179,185 ****
| --- 179,189 ----
|
| std::ostringstream ls_buf;
|
| + #ifdef _MSC_VER
| + ls_buf << "cmd /C dir ";
| + #else
| ls_buf << "ls -C ";
| + #endif
| for (int i = 1; i < argc; i++)
| ls_buf << file_ops::tilde_expand (argv[i]) << " ";
|
I decided to make ls a script file function instead of a built-in
function, and to let the user specify the command to use with a
separate new function called ls_command. For example,
old_cmd = ls_command ("/my/ls");
returns the previous command in old_cmd and sets the internal variable
to "/my/ls" and
curr_cmd = ls_command ();
returns the current command to use. The default value is set by this
code:
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")))
__ls_command__ = "cmd /C dir /w";
else
__ls_command__ = "ls -C";
endif
endif
Is it OK to use /w? As I recall, that is the switch that causes DIR
to print output in columns. I think we should do that to match the
way output is displayed by "ls -C".
Is it reasonable to check EXEC_PATH to see whether we have a real ls
command available? That way, I won't be annoyed if I start up the
Windows version of Octave and type "ls -l" (assuming I have ls in my
PATH, I think this should work).
Thanks,
jwe
- Re: MSVC compiler support [patch 27]: OCTAVE_HOME, (continued)
- MSVC compiler support [patch 29]: Backslash in path, Michael Goffioul, 2006/10/17
- MSVC compiler support [patch 29]: Backslash in path, John W. Eaton, 2006/10/27
- MSVC compiler support [patch 30]: Help MSVC with templates, Michael Goffioul, 2006/10/17
- MSVC compiler support [patch 30]: Help MSVC with templates, John W. Eaton, 2006/10/26
- MSVC compiler support [patch 31]: CHAR_BIT, Michael Goffioul, 2006/10/17
- MSVC compiler support [patch 31]: CHAR_BIT, John W. Eaton, 2006/10/17
- MSVC compiler support [patch 32]: ls, Michael Goffioul, 2006/10/17
- MSVC compiler support [patch 32]: ls,
John W. Eaton <=
- Re: MSVC compiler support [patch 32]: ls, Michael Goffioul, 2006/10/27
- Re: MSVC compiler support [patch 32]: ls, John W. Eaton, 2006/10/27
- MSVC compiler support [patch 33]: Help, Michael Goffioul, 2006/10/17
- MSVC compiler support [patch 33]: Help, John W. Eaton, 2006/10/25
- MSVC compiler support [patch 34]: sepchar and load_path, Michael Goffioul, 2006/10/17
- MSVC compiler support [patch 34]: sepchar and load_path, John W. Eaton, 2006/10/27
- MSVC compiler support [patch 35]: default history file, Michael Goffioul, 2006/10/17
- MSVC compiler support [patch 35]: default history file, John W. Eaton, 2006/10/25
- Re: MSVC compiler support [patch 35]: default history file, Michael Goffioul, 2006/10/26
- MSVC compiler support [patch 36]: abs of long, Michael Goffioul, 2006/10/17