~ubuntu-branches/ubuntu/hoary/scilab/hoary

« back to all changes in this revision

Viewing changes to macros/util/unix_g.sci

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2005-01-09 22:58:21 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050109225821-473xr8vhgugxxx5j
Tags: 3.0-12
changed configure.in to build scilab's own malloc.o, closes: #255869

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
// host unix_x unix_s
15
15
//!
16
16
// Copyright INRIA
17
 
[lhs,rhs]=argn(0)
18
 
if prod(size(cmd))<>1 then   error(55,1),end
19
 
 
20
 
if MSDOS then
21
 
  tmp=strsubst(TMPDIR,'/','\')+'\unix.out';
22
 
  cmd1= cmd + ' > '+ tmp;
23
 
else
24
 
  tmp=TMPDIR+'/unix.out';
25
 
  cmd1='('+cmd+')>'+ tmp +' 2>'+TMPDIR+'/unix.err;';
26
 
end 
27
 
stat=host(cmd1);
28
 
select stat
29
 
case 0 then
30
 
  rep=read(tmp,-1,1,'(a)')
31
 
  if size(rep,'*')==0 then rep=[],end
32
 
case -1 then // host failed
33
 
  disp('host does not answer...')
34
 
  rep=emptystr()
35
 
else
 
17
// Modified by Allan CORNET 2004
 
18
 
 
19
  [lhs,rhs]=argn(0)
 
20
  if prod(size(cmd))<>1 then   error(55,1),end
 
21
  
 
22
  ver=OS_Version();
 
23
 
36
24
  if MSDOS then 
37
 
        write(%io(2),'unix_g: shell error');
38
 
        rep=emptystr()
 
25
    tmp=strsubst(TMPDIR,'/','\')+'\unix.out';
 
26
    if ver == 'Windows 98' | ver == 'Windows 95' then
 
27
        cmd1= cmd + ' > '+ tmp;
 
28
    else
 
29
        tmp=TMPDIR+'\unix.out';
 
30
        cmd1=cmd +'>'+ tmp +' 2>'+TMPDIR+'\unix.err';
 
31
    end
39
32
  else 
40
 
        msg=read(TMPDIR+'/unix.err',-1,1,'(a)')
 
33
     tmp=TMPDIR+'/unix.out';
 
34
     cmd1='('+cmd+')>'+ tmp +' 2>'+TMPDIR+'/unix.err;';
 
35
  end 
 
36
  
 
37
  
 
38
  stat=host(cmd1);
 
39
  
 
40
  select stat
 
41
   case 0 then
 
42
    rep=mgetl(tmp)
 
43
    if size(rep,'*')==0 then rep=[],end
 
44
   case -1 then // host failed
 
45
    disp('host does not answer...')
 
46
    rep=emptystr()
 
47
  else
 
48
  if MSDOS then 
 
49
        if ver == 'Windows 98' | ver == 'Windows 95' then
 
50
                write(%io(2),'unix_g: shell error');
 
51
                rep=emptystr()
 
52
        else
 
53
                msg=mgetl(TMPDIR+'\unix.err')
 
54
                disp(msg(1))
 
55
                rep=emptystr()
 
56
        end
 
57
     else 
 
58
        msg=mgetl(TMPDIR+'/unix.err')
41
59
        disp(msg(1))
42
60
        rep=emptystr()
43
 
  end 
44
 
end
45
 
if MSDOS then
46
 
  host('del '+tmp);
47
 
else
48
 
  host('rm -f '+tmp);
49
 
end
 
61
     end 
 
62
  end
 
63
  if MSDOS then
 
64
        if ver == 'Windows 98' | ver == 'Windows 95' then
 
65
                host('if exist '+tmp+' del '+tmp);
 
66
        else
 
67
                host('if exist '+tmp+' del '+tmp);
 
68
                host('if exist '+TMPDIR+'\unix.err'+' del '+TMPDIR+'\unix.err');
 
69
        end
 
70
  else
 
71
     host('rm -f '+tmp);
 
72
  end
 
73
endfunction