This is the mail archive of the cygwin@cygwin.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]
Other format: [Raw text]

cygwin's system() function


Hello,

I'm having problems getting the system() function to work correctly outside
of the cygwin environment.

for example, I compile the  following file in the BASH environment using the
command

gcc systemtest.c -out systemtest.exe

int main(void)
{
 return system("notepad.exe");
}

then, while I'm in the BASH enviroment, I can run systemtest.exe, and it
will open up notepad.

however, if I try to run it from the windows environment, it doesn't do
anything. It just runs and ends. no error messages or anything.

I tried a number of different absolute paths to notepad, i.e.

"c:\\windows\\system32\\notepad.exe"
"c:/windows/systems32/notepad.exe"
"/cygdrive/c/windows/system32/notepad.exe"

system returns 127 when I run it in the windows environment, with
"notepad.exe" as the parameter, and 0 when I run it in the cygwin enviroment
with "notepad.exe" as the parameter.

It returns -1 when I run it in the windows or cygwin environment, and pass
it a null value.

anyone have any ideas how to resolve this?


here is the info from cygcheck -sysinfo

----------------------------------------------------------------------
Cygwin Win95/NT Configuration Diagnostics
Current System Time: Sat Jan 03 20:08:46 2004

Windows XP Professional Ver 5.1 Build 2600 Service Pack 1

Path: E:\Apps\cygwin\usr\local\bin
 E:\Apps\cygwin\bin
 E:\Apps\cygwin\bin
 E:\Apps\cygwin\usr\X11R6\bin
 c:\Perl\bin\
 c:\WINDOWS\system32
 c:\WINDOWS
 c:\WINDOWS\System32\Wbem
 c:\Program Files\NMapWin\bin

Output from E:\Apps\cygwin\bin\id.exe (nontsec)
UID: 500(JesusFreke) GID: 513(None)
513(None)

Output from E:\Apps\cygwin\bin\id.exe (ntsec)
UID: 500(JesusFreke) GID: 513(None)
513(None)              544(Administrators)
551(Backup Operators)  545(Users)
1005(Debugger Users)

SysDir: C:\WINDOWS\System32
WinDir: C:\WINDOWS

HOME = `E:\Apps\cygwin\home\JesusFreke'
MAKE_MODE = `unix'
PWD = `/usr/systemtest'
USER = `JesusFreke'

Use `-r' to scan registry

a:  fd           N/A    N/A
c:  hd  NTFS   94993Mb  10% CP CS UN PA FC
d:  hd  NTFS   95778Mb  88% CP CS UN PA FC     Huge Partition of -=|DOOM|=-
e:  hd  NTFS   74292Mb  56% CP CS UN PA FC     Fast Bugger
f:  cd  CDFS      42Mb 100%    CS UN           X2289A0
g:  cd           N/A    N/A
h:  cd  CDFS     615Mb 100%    CS UN           MSDVVSD3

E:\Apps\cygwin      /          system  binmode
E:\Apps\cygwin\bin  /usr/bin   system  binmode
E:\Apps\cygwin\lib  /usr/lib   system  binmode
.                   /cygdrive  system  binmode,cygdrive

Not Found: awk
Found: E:\Apps\cygwin\bin\bash.exe
Found: E:\Apps\cygwin\bin\cat.exe
Found: E:\Apps\cygwin\bin\cp.exe
Found: E:\Apps\cygwin\bin\cpp.exe
Found: E:\Apps\cygwin\bin\find.exe
Found: E:\Apps\cygwin\bin\gcc.exe
Found: E:\Apps\cygwin\bin\gdb.exe
Found: E:\Apps\cygwin\bin\grep.exe
Found: E:\Apps\cygwin\bin\ld.exe
Found: E:\Apps\cygwin\bin\ls.exe
Found: E:\Apps\cygwin\bin\make.exe
Found: E:\Apps\cygwin\bin\mv.exe
Found: E:\Apps\cygwin\bin\rm.exe
Found: E:\Apps\cygwin\bin\sed.exe
Found: E:\Apps\cygwin\bin\sh.exe
Found: E:\Apps\cygwin\bin\tar.exe

  949k 2003/09/20 C:\WINDOWS\System32\cygwin1.dll
    Cygwin DLL version info:
        DLL version: 1.5.5
        DLL epoch: 19
        DLL bad signal mask: 19005
        DLL old termios: 5
        DLL malloc env: 28
        API major: 0
        API minor: 94
        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: Sat Sep 20 16:31:15 EDT 2003
        CVS tag: cr-0x9b
        Shared id: cygwin1S3

   61k 2003/08/09 E:\Apps\cygwin\bin\cygbz2-1.dll
   14k 2003/08/10 E:\Apps\cygwin\bin\cygcharset-1.dll
   22k 2003/10/17 E:\Apps\cygwin\bin\cygcygipc-2.dll
  132k 2003/07/12 E:\Apps\cygwin\bin\cygexpat-0.dll
   35k 2002/01/09 E:\Apps\cygwin\bin\cygform6.dll
  361k 2003/10/25 E:\Apps\cygwin\bin\cygfreetype-6.dll
   28k 2003/07/20 E:\Apps\cygwin\bin\cyggdbm-3.dll
   30k 2003/08/11 E:\Apps\cygwin\bin\cyggdbm-4.dll
   19k 2003/03/22 E:\Apps\cygwin\bin\cyggdbm.dll
   15k 2003/07/20 E:\Apps\cygwin\bin\cyggdbm_compat-3.dll
   15k 2003/08/11 E:\Apps\cygwin\bin\cyggdbm_compat-4.dll
   69k 2003/08/10 E:\Apps\cygwin\bin\cyggettextlib-0-12-1.dll
   12k 2003/08/10 E:\Apps\cygwin\bin\cyggettextpo-0.dll
  134k 2003/08/10 E:\Apps\cygwin\bin\cyggettextsrc-0-12-1.dll
   17k 2001/06/28 E:\Apps\cygwin\bin\cyghistory4.dll
   29k 2003/08/10 E:\Apps\cygwin\bin\cyghistory5.dll
  958k 2003/08/10 E:\Apps\cygwin\bin\cygiconv-2.dll
   22k 2001/12/13 E:\Apps\cygwin\bin\cygintl-1.dll
   37k 2003/08/10 E:\Apps\cygwin\bin\cygintl-2.dll
   21k 2001/06/20 E:\Apps\cygwin\bin\cygintl.dll
   20k 2002/01/09 E:\Apps\cygwin\bin\cygmenu6.dll
  175k 2002/01/09 E:\Apps\cygwin\bin\cygncurses++6.dll
  202k 2002/01/09 E:\Apps\cygwin\bin\cygncurses6.dll
   12k 2002/01/09 E:\Apps\cygwin\bin\cygpanel6.dll
   62k 2003/12/11 E:\Apps\cygwin\bin\cygpcre-0.dll
   63k 2003/04/11 E:\Apps\cygwin\bin\cygpcre.dll
    9k 2003/12/11 E:\Apps\cygwin\bin\cygpcreposix-0.dll
   61k 2003/04/11 E:\Apps\cygwin\bin\cygpcreposix.dll
   22k 2002/06/09 E:\Apps\cygwin\bin\cygpopt-0.dll
  108k 2001/06/28 E:\Apps\cygwin\bin\cygreadline4.dll
  148k 2003/08/10 E:\Apps\cygwin\bin\cygreadline5.dll
   60k 2003/08/09 E:\Apps\cygwin\bin\cygz.dll
  949k 2003/09/20 E:\Apps\cygwin\bin\cygwin1.dll
    Cygwin DLL version info:
        DLL version: 1.5.5
        DLL epoch: 19
        DLL bad signal mask: 19005
        DLL old termios: 5
        DLL malloc env: 28
        API major: 0
        API minor: 94
        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: Sat Sep 20 16:31:15 EDT 2003
        CVS tag: cr-0x9b
        Shared id: cygwin1S3


Cygwin Package Information
Package              Version
ash                  20031007-1
astyle               1.15.3-3
autoconf             2.59-1
autoconf-devel       2.59-1
autoconf-stable      2.13-5
automake             1.7.9-1
automake-devel       1.7.9-1
automake-stable      1.4p6-2
base-files           2.6-1
base-passwd          1.1-1
bash                 2.05b-16
binutils             20030901-1
bzip2                1.0.2-5
ccache               2.2-1
cmake                1.8.2-1
cygipc               2.02-1
cygwin               1.5.5-1
diffutils            2.8.4-1
editrights           1.01-1
ELFIO                1.0.0-1
expat                1.95.6-2
fileutils            4.1-2
findutils            4.1.7-4
gcc                  3.3.1-3
gcc-g++              3.3.1-3
gcc-mingw            20030911-4
gcc-mingw-core       20031020-1
gcc-mingw-g++        20031020-1
gdb                  20030919-1
gdbm                 1.8.3-7
gettext              0.12.1-3
gettext-devel        0.12.1-3
grep                 2.5-1
gzip                 1.3.5-1
libbz2_1             1.0.2-5
libcharset1          1.9.1-3
libfreetype2-devel   2.1.5-1
libfreetype26        2.1.5-1
libgdbm              1.8.0-5
libgdbm-devel        1.8.3-7
libgdbm3             1.8.3-3
libgdbm4             1.8.3-7
libgettextpo0        0.12.1-3
libiconv             1.9.1-3
libiconv2            1.9.1-3
libintl              0.10.38-3
libintl1             0.10.40-1
libintl2             0.12.1-3
libncurses6          5.2-8
libpcre              4.1-1
libpcre0             4.5-1
libpopt0             1.6.4-4
libreadline4         4.1-2
libreadline5         4.3-5
libtool              1.5b-1
libtool-devel        1.5-3
libtool-stable       1.4.3-2
login                1.9-7
make                 3.80-1
man                  1.5k-1
mktemp               1.5-3
nasm                 0.98.38-1
pcre                 4.5-1
pcre-doc             4.5-1
pkgconfig            0.15.0-4
procmail             3.22-8
readline             4.3-5
sed                  4.0.8-1
sh-utils             2.0.15-4
tar                  1.13.25-5
tcltk                20030901-1
termcap              20021106-2
terminfo             5.3_20030726-1
texinfo              4.2-4
textutils            2.0.21-1
w32api               2.4-1
which                1.5-2
zlib                 1.1.4-4
Use -h to see help about each section
----------------------------------------------------------





thanks,
JesusFreke




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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