directory listing questions (in xmaxima)



Hello,
  I am trying to get directory listing of files displayed to the screen 
in xmaxima.
 For instance, how can one display the current directory to the xmaxima 
console.

 I am working in unix (fedora, but that does not matter).

In command line maxima, one can type 
   system("pwd")
 and get the working directory output to the command line.

If xmaxima is started from a terminal, then the output goes to the 
terminal window.   I would like it to go to the xmaxima window (many 
times I have so many terminals that I have to scroll through them to 
find the original console window.

A similar issue concerns the problem of looking up *.mac files to load 
into a seesion.  One can use the <Alt-b> keys to get a listing of all 
files in the current directory, but suppose one wants the output of 
something like
   "ls L*.mac"

Below I have some routines which do solve the above problems in many 
cases, but they are strange, making use of the system command to write 
to temporary files, read the contents into variables, and then remove 
the temporary files.  I think that there must be a better way. 

 Also, I have not idea how to do these things in a Win-XP environment.  

Any ideas would be appreciated.

TIA
-sen

P.S. I am including the routines I wrote in case anyone is willing to 
make comments for improvement, etc.

pwd():= block([s, st],system("pwd > tmp_file"), s:
openr(tmp_file), st: readline(s), close(s), system("rm -rf tmp_file"),
return(st))$

pwd_usg: prt("pwd() returns the current directory as a list");

ls(string):=
  block([s1: string, s2, list],
  s2: string(printf(false, "~{~a~}", [string, "> tmp_ls"])),
  system(eval_string(s2)),
  list: read_list("tmp_ls"),
  system("rm -f tmp_ls"),
  return(list) 
       )$

ls_usg: prt("ls(string) gives a list whose output is that of the system 
command: ls 'string' ");

ls_noext(string):=
  block([s1: string, s2, list, list_2],
  s2: string(printf(false, "~{~a~}", [string, "> tmp_ls"])),
  system(eval_string(s2)), list: read_list("tmp_ls"),
  system("rm -f tmp_ls"),
  if (length(list) > 3 and list[3]=list[6]) then
    (list_2: makelist(list[3*(i-1)+1],i,1,length(list)/3), return(list_2))
    else return(list)  
       )$

ls_noext_usg: prt("ls_no_est(string) gives a list whose output is the 
system command:
ls 'string.ext'  with the extension '.ext' removed.  If there is no
extention 'ext' it gives an error. ");
 




Here is the problem. 
  Consider the unix comm