This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Problem executing system command in Cygwin programs launched from DOS shell


     As documented below, I am having trouble getting a Cygwin-compiled program
to execute the "system" comand when launched from a DOS shell or a Win32
application.

     As you can see, the directory /h/mark/test has five files including the
latest version of cygwin1.dll.

ls -l /h/mark/test
total 326
-rwxr-xr-x   1 mark     544        629760 Feb 19 16:50 cygwin1.dll*
-rw-r--r--   1 mark     544            79 Feb 19 16:55 ms-no.c
-rwxr-xr-x   1 mark     544         17865 Feb 19 16:56 ms-no.exe*
-rw-r--r--   1 mark     544            75 Feb 19 16:55 ms.c
-rwxr-xr-x   1 mark     544         17880 Feb 19 16:48 ms.exe*

ms.c is the simple program:

main()
{
  system("/progra~1/Netscape/Netsca~1/netscp6.exe");
  exit(0);
}

compiled with the command "gcc -o ms ms.c",

./ms seemingly will execute the system command only when issued from a bash
shell.  .\ms will not execute the system command when launched from a DOS shell
while in the test directory.

     It is just the system command that seems not to work.  Other commands, like
file writing or reading work just fine.

     In contrast, programs compiled with the -mno-cygwin option do not exhibit
this behavior.  ms-no.c is the simple program:

main()
{
  system("\\progra~1\\Netscape\\Netsca~1\\netscp6.exe");
  exit(0);
}

compiled with the command "gcc -mno-cygwin -o ms-no ms-no.c".

The commands ./ms-no and .\ms-no both execute correctly when issued in the
test directory from either a bash or DOS shell respectively.

!!!!! Is this just my setup, or do others see this behavior?

The output from cygcheck -r -s -v on my system is:

Cygnus Win95/NT Configuration Diagnostics
Current System Time: Mon Feb 19 16:44:12 2001

Win9X Ver 4.90 build 73010104  

Path:	/u/local/bin/shell
	/u/local/bin/
	/u/bin
	/usr/bin
	/emacs-20.7/bin
	/msmail

SysDir: C:\WINDOWS\SYSTEM
WinDir: C:\WINDOWS

PWD = `/h/mark'
USER = `mark'
HOME = `/h/mark'

PROMPT = `$p$g'
COMSPEC = `C:\WINDOWS\COMMAND.COM'
!C: = `C:\Cygwin\1.1.8\bin'
CMDLINE = `bash --rcfile C:/bin/.bashrc.mark'
HOSTNAME = `INSPIRON'
INSTALL_EXE = `announce'
REALNAME = `Mark Schoenberg'
WINDIR = `C:\WINDOWS'
MANPATH = `/usr/man:/u/man'
WINBOOTDIR = `C:\WINDOWS'
PS1 = `\[\033]0;\w\007
\033[32m\]\u@\h \[\033[33m\w\033[0m\]
$ '
LESS = `-EM'
MACHTYPE = `i686-pc-cygwin'
OLDPWD = `/usr/bin'
TEMP = `/WINDOWS/TEMP'
MV_EXE = `announce'
SHLVL = `1'
LOGNAME = `mark'
SHELL = `/bin/sh'
HOSTTYPE = `i686'
OSTYPE = `cygwin'
TERM = `cygwin'
_ = `/usr/bin/cygcheck'
TZ = `EST5EDT4,M4.1.0/2,M10.5.0/2'

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu\Programs\Cygnus Solutions
  (default) = (unsupported type)
HKEY_CURRENT_USER\Software\Cygnus Solutions
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2
  (default) = `/cygdrive'
  cygdrive flags = 0x00000022
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\Program Options
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/bin
  (default) = `C:/Cygwin/1.1.8/bin'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/lib
  (default) = `C:/Cygwin/1.1.8/lib'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/
  (default) = `C:'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr
  (default) = `C:\Cygwin\1.1.8\usr'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/etc
  (default) = `C:\Cygwin\1.1.8\etc'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\Program Options

a:  fd           N/A    N/A                    
c:  hd  FAT32   9580Mb  18% CP    UN           INSPIRON
d:  cd           N/A    N/A                    

C:\Cygwin\1.1.8\bin  /usr/bin  system  binmode
C:\Cygwin\1.1.8\etc  /etc     system  binmode
C:\Cygwin\1.1.8\lib  /usr/lib  system  binmode
C:\Cygwin\1.1.8\usr  /usr     system  binmode
C:    /        system  binmode

Found: C:\Cygwin\1.1.8\bin\bash.exe
Found: \bin\bash.exe
Warning: C:\Cygwin\1.1.8\bin\bash.exe hides \bin\bash.exe
Found: C:\Cygwin\1.1.8\bin\cat.exe
Found: C:\Cygwin\1.1.8\bin\cpp.exe
Found: C:\Cygwin\1.1.8\bin\find.exe
Found: C:\Cygwin\1.1.8\bin\gcc.exe
Found: C:\Cygwin\1.1.8\bin\gdb.exe
Found: C:\Cygwin\1.1.8\bin\ld.exe
Found: C:\u\bin\ls.exe
Found: C:\Cygwin\1.1.8\bin\ls.exe
Warning: C:\u\bin\ls.exe hides C:\Cygwin\1.1.8\bin\ls.exe
Found: C:\Cygwin\1.1.8\bin\make.exe
Found: C:\Cygwin\1.1.8\bin\sh.exe
Found: \bin\sh.exe
Warning: C:\Cygwin\1.1.8\bin\sh.exe hides \bin\sh.exe

   56k 2000/12/03 C:\Cygwin\1.1.8\bin\cygbz21.0.dll - os=4.0 img=1.0 sys=4.0
                  "cygbz21.0.dll" v0.0 ts=2000/11/20 18:53
   81k 2000/12/05 C:\Cygwin\1.1.8\bin\cygitcl30.dll - os=4.0 img=1.0 sys=4.0
                  "cygitcl30.dll" v0.0 ts=2000/11/25 20:43
   35k 2000/12/05 C:\Cygwin\1.1.8\bin\cygitk30.dll - os=4.0 img=1.0 sys=4.0
                  "cygitk30.dll" v0.0 ts=2000/11/25 20:43
  390k 2000/12/05 C:\Cygwin\1.1.8\bin\cygtcl80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtcl80.dll" v0.0 ts=2000/11/25 20:39
    5k 2000/12/05 C:\Cygwin\1.1.8\bin\cygtclpip80.dll - os=4.0 img=1.0 sys=4.0
   10k 2000/12/05 C:\Cygwin\1.1.8\bin\cygtclreg80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtclreg80.dll" v0.0 ts=2000/11/25 20:39
  623k 2000/12/05 C:\Cygwin\1.1.8\bin\cygtk80.dll - os=4.0 img=1.0 sys=4.0
                  "cygtk80.dll" v0.0 ts=2000/11/25 20:43
   18k 2000/10/23 C:\Cygwin\1.1.8\bin\cyggdbm.dll - os=4.0 img=1.0 sys=4.0
                  "cyggdbm.dll" v0.0 ts=2000/10/22 22:26
   14k 2000/10/23 C:\Cygwin\1.1.8\bin\cygintl.dll - os=4.0 img=1.0 sys=4.0
                  "cygintl.dll" v0.0 ts=2000/10/23 15:02
   45k 2000/10/22 C:\Cygwin\1.1.8\bin\cygjbig1.dll - os=4.0 img=1.0 sys=4.0
                  "cygjbig1.dll" v0.0 ts=2000/10/22 19:06
  119k 2000/10/23 C:\Cygwin\1.1.8\bin\cygjpeg6b.dll - os=4.0 img=1.0 sys=4.0
                  "cygjpeg6b.dll" v0.0 ts=2000/10/22 20:58
   82k 2001/01/21 C:\Cygwin\1.1.8\bin\cygform5.dll - os=4.0 img=1.0 sys=4.0
                  "cygform5.dll" v0.0 ts=2001/1/21 15:39
   53k 2001/01/21 C:\Cygwin\1.1.8\bin\cygmenu5.dll - os=4.0 img=1.0 sys=4.0
                  "cygmenu5.dll" v0.0 ts=2001/1/21 15:39
  414k 2001/01/21 C:\Cygwin\1.1.8\bin\cygncurses++5.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses++5.dll" v0.0 ts=2001/1/21 15:40
  299k 2001/01/21 C:\Cygwin\1.1.8\bin\cygncurses5.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses5.dll" v0.0 ts=2001/1/21 15:38
   34k 2001/01/21 C:\Cygwin\1.1.8\bin\cygpanel5.dll - os=4.0 img=1.0 sys=4.0
                  "cygpanel5.dll" v0.0 ts=2001/1/21 15:38
  163k 2001/02/03 C:\Cygwin\1.1.8\bin\cygpng2.dll - os=4.0 img=1.0 sys=4.0
                  "cygpng2.dll" v0.0 ts=2001/2/3 16:21
   17k 2001/01/07 C:\Cygwin\1.1.8\bin\cyghistory4.dll - os=4.0 img=1.0 sys=4.0
                  "cyghistory4.dll" v0.0 ts=2001/1/6 23:34
  108k 2001/01/07 C:\Cygwin\1.1.8\bin\cygreadline4.dll - os=4.0 img=1.0 sys=4.0
                  "cygreadline4.dll" v0.0 ts=2001/1/6 23:34
  243k 2000/10/23 C:\Cygwin\1.1.8\bin\cygtiff3.dll - os=4.0 img=1.0 sys=4.0
                  "cygtiff3.dll" v0.0 ts=2000/10/22 21:14
   41k 2000/11/20 C:\Cygwin\1.1.8\bin\cygXpm-noX4.dll - os=4.0 img=1.0 sys=4.0
                  "cygXpm-noX4.dll" v0.0 ts=2000/11/19 21:41
   45k 2000/11/20 C:\Cygwin\1.1.8\bin\cygXpm-X4.dll - os=4.0 img=1.0 sys=4.0
                  "cygXpm-X4.dll" v0.0 ts=2000/11/19 21:45
   49k 2001/02/03 C:\Cygwin\1.1.8\bin\cygz.dll - os=4.0 img=1.0 sys=4.0
                  "cygz.dll" v0.0 ts=2001/2/3 15:35
  615k 2001/01/31 C:\Cygwin\1.1.8\bin\cygwin1.dll - os=4.0 img=1.0 sys=4.0
                  "cygwin1.dll" v0.0 ts=2001/1/31 10:08
    Cygwin DLL version info:
        dll major: 1001
        dll minor: 8
        dll epoch: 19
        dll bad signal mask: 19005
        dll old termios: 5
        dll malloc env: 28
        api major: 0
        api minor: 34
        shared data: 3
        dll identifier: cygwin1
        mount registry: 2
        cygnus registry name: Cygnus Solutions
        cygwin registry name: Cygwin
        program options name: Program Options
        cygwin mount registry name: mounts v2
        cygdrive flags: cygdrive flags
        cygdrive prefix: cygdrive prefix
        cygdrive default prefix: 
        build date: Wed Jan 31 10:08:38 EST 2001
        shared id: cygwin1S3

  615k 2001/02/19 C:\msmail\cygwin1.dll - os=4.0 img=1.0 sys=4.0
                  "cygwin1.dll" v0.0 ts=2001/1/31 10:08
    Cygwin DLL version info:
        dll major: 1001
        dll minor: 8
        dll epoch: 19
        dll bad signal mask: 19005
        dll old termios: 5
        dll malloc env: 28
        api major: 0
        api minor: 34
        shared data: 3
        dll identifier: cygwin1
        mount registry: 2
        cygnus registry name: Cygnus Solutions
        cygwin registry name: Cygwin
        program options name: Program Options
        cygwin mount registry name: mounts v2
        cygdrive flags: cygdrive flags
        cygdrive prefix: cygdrive prefix
        cygdrive default prefix: 
        build date: Wed Jan 31 10:08:38 EST 2001
        shared id: cygwin1S3

Use -h to see help about each section


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]