public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Problem with system()
@ 2001-04-01  9:37 Piyatad Tabmanee
  0 siblings, 0 replies; 13+ messages in thread
From: Piyatad Tabmanee @ 2001-04-01  9:37 UTC (permalink / raw)
  To: cygwin

Hello,

I tried

system("command.com /c dir");

It worked fine under cygwin environment.
But when I run it from the DOS prompt, it doesn't work.
No error message or what so ever given, it just skips.

I actually want to write a CGI that runs a command line program.

Thank you.
Piyatad

I use
gcc version 2.95.2-5 19991024
cygwin1.dll 1.1.6 build date: 2000-11-21


Piyatad Tabmanee (Job)
Tel:(662)6527352
Mobile:(661)8458858
Visit my web page:
http://bangkok.com/mypage/piyatad
-----------------------------------------------
Thailand's BEST Free Email at Bangkok.com - http://mail.bangkok.com

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Problem with system()
@ 2000-07-27  8:39 Glenn.Davis
  0 siblings, 0 replies; 13+ messages in thread
From: Glenn.Davis @ 2000-07-27  8:39 UTC (permalink / raw)
  To: cygwin

THAT DID IT!
Thanks!!!!  I tried to save space on my computer, and look where it got 
me.
I even saw in the man page for system() that it uses /bin/sh.  Thats why I 
downloaded "bash".  I stupidly assumed that since you guys were using bash 
in your cygwin.bat file, that that was the program to use (and not ash).
I'm sure there is a lesson in there somewhere.
thanks,
glenn.




Chris Faylor <cgf@cygnus.com>
07/27/00 11:10 AM
Please respond to cygwin

 
        To:     Glenn.Davis@predictive.com
        cc: 
        Subject:        [cgf: Re: Problem with system()]


Sorry.  Forgot to Cc you.

cgf

----- Forwarded message from cgf -----

To: cygwin@sources.redhat.com
Subject: Re: Problem with system()
Date: Thu, 27 Jul 2000 11:09:46 -0400
Reply-To: cygwin@sources.redhat.com
Mail-Followup-To: cygwin@sources.redhat.com
In-Reply-To: < OFEB57585D.87A9F813-ON85256929.0051CAE4@predictive.com >; 
from Glenn.Davis@predictive.com on Thu, Jul 27, 2000 at 11:04:22AM -0400

On Thu, Jul 27, 2000 at 11:04:22AM -0400, Glenn.Davis@predictive.com 
wrote:
>>On Thu, Jul 27, 2000 at 09:42:19AM -0400, Glenn.Davis@predictive.com
>wrote:
>>>Chris,
>>>I guesss I should have given more info.
>>>I tried
>>>        system ("command /c dir")
>>>and yes, I am using Windows 95.
>>
>>I don't know what's wrong but I would check basic things like your PATH.
>>If you don't have a command.com in your path then system is obviously
>>not going to be able to run "command".
>
>I know I don't sound like I know what I am doing, but I did look at my
>Path.  I am able to run commands from inside bash. I even put the full
>path of the commands in the system call. I still get the same results.

It finally dawned on me that since you haven't installed the complete
cygwin package you probably don't have /bin/sh.  UNIX uses /bin/sh
to invoke programs for the system() command.  Ditto, cygwin.

That program is found in the 'ash' tar ball.

cgf

----- End forwarded message -----

--
cgf@cygnus.com                        Cygnus Solutions, a Red Hat company
http://sourceware.cygnus.com/         http://www.redhat.com/



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Problem with system()
  2000-07-27  7:53     ` Chris Faylor
@ 2000-07-27  8:20       ` Corinna Vinschen
  0 siblings, 0 replies; 13+ messages in thread
From: Corinna Vinschen @ 2000-07-27  8:20 UTC (permalink / raw)
  To: cygwin

Chris Faylor wrote:
> This is the standard extension search:
> 
> suffix_info std_suffixes[] =
> {
>   suffix_info (".exe", 1), suffix_info ("", 1),
>   suffix_info (".com"), suffix_info (".cmd"),
>   suffix_info (".bat"), suffix_info (".dll"),
>   suffix_info (NULL)
> };
> 
> So, .com should be supported.  It is when I try it, anyway.

Ooops, sorry I was confused by the stat_suffixes struct: 

suffix_info stat_suffixes[] =
{
  suffix_info ("", 1),
  suffix_info (".exe", 1),
  suffix_info (NULL)
};

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                        mailto:cygwin@sources.redhat.com
Red Hat, Inc.
mailto:vinschen@cygnus.com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Problem with system()
@ 2000-07-27  8:10 Glenn.Davis
  0 siblings, 0 replies; 13+ messages in thread
From: Glenn.Davis @ 2000-07-27  8:10 UTC (permalink / raw)
  To: cygwin

I tried that as well.  I still get the same message and I am sure that I 
have my path set correctly.
thanks,
glenn davis.




Corinna Vinschen <vinschen@cygnus.com>
Sent by: corinna@nikoma.de
07/27/00 10:50 AM
Please respond to cygwin

 
        To:     cygwin@sources.redhat.com
        cc:     Glenn.Davis@predictive.com
        Subject:        Re: Problem with system()


Chris Faylor wrote:
>
> On Thu, Jul 27, 2000 at 09:42:19AM -0400, Glenn.Davis@predictive.com 
wrote:
> >Chris,
> >I guesss I should have given more info.
> >I tried
> >        system ("command /c dir")
> >and yes, I am using Windows 95.
>
> I don't know what's wrong but I would check basic things like your PATH.
> If you don't have a command.com in your path then system is obviously
> not going to be able to run "command".

You have to use "command.com /c dir" because the standard search
algorithm only finds apps which don't have an extension or which have
the ".exe" extension. ".com" isn't supported.

Corinna

--
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                        mailto:cygwin@sources.redhat.com
Red Hat, Inc.
mailto:vinschen@cygnus.com



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Problem with system()
  2000-07-27  8:03 Glenn.Davis
@ 2000-07-27  8:10 ` Chris Faylor
  0 siblings, 0 replies; 13+ messages in thread
From: Chris Faylor @ 2000-07-27  8:10 UTC (permalink / raw)
  To: cygwin

On Thu, Jul 27, 2000 at 11:04:22AM -0400, Glenn.Davis@predictive.com wrote:
>>On Thu, Jul 27, 2000 at 09:42:19AM -0400, Glenn.Davis@predictive.com 
>wrote:
>>>Chris,
>>>I guesss I should have given more info.
>>>I tried
>>>        system ("command /c dir")
>>>and yes, I am using Windows 95.
>>
>>I don't know what's wrong but I would check basic things like your PATH.
>>If you don't have a command.com in your path then system is obviously
>>not going to be able to run "command".
>
>I know I don't sound like I know what I am doing, but I did look at my 
>Path.  I am able to run commands from inside bash. I even put the full 
>path of the commands in the system call. I still get the same results.

It finally dawned on me that since you haven't installed the complete
cygwin package you probably don't have /bin/sh.  UNIX uses /bin/sh
to invoke programs for the system() command.  Ditto, cygwin.

That program is found in the 'ash' tar ball.

cgf

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Problem with system()
@ 2000-07-27  8:03 Glenn.Davis
  2000-07-27  8:10 ` Chris Faylor
  0 siblings, 1 reply; 13+ messages in thread
From: Glenn.Davis @ 2000-07-27  8:03 UTC (permalink / raw)
  To: cygwin

Chris Faylor <cgf@cygnus.com>
07/27/00 09:48 AM
Please respond to cygwin

 
        To:     cygwin@sources.redhat.com
        cc:     Glenn.Davis@predictive.com
        Subject:        Re: Problem with system()


>On Thu, Jul 27, 2000 at 09:42:19AM -0400, Glenn.Davis@predictive.com 
wrote:
>>Chris,
>>I guesss I should have given more info.
>>I tried
>>        system ("command /c dir")
>>and yes, I am using Windows 95.
>
>I don't know what's wrong but I would check basic things like your PATH.
>If you don't have a command.com in your path then system is obviously
>not going to be able to run "command".

I know I don't sound like I know what I am doing, but I did look at my 
Path.  I am able to run commands from inside bash. I even put the full 
path of the commands in the system call. I still get the same results.

>>In fact I tried a whole bunch of commands that are cygwin commands.
>>Whatever I do, the system call returns a 127.
>
>"File not found".

thanks.

>
>>I couldn't find what a 127 meant, if anything.
>>Anyway, is it possible that I can be missing a dll. Or is there only the
>>one that I need?
>>I only installed the base amount of software:
>>        gcc-2_95_2-2.tar.gz
>>        cygwin-1.1.2.tar.gz
>>        binutils-20000625.tar.gz
>>        bash-2_04_1.tar.gz
>>I thought that should be enough but maybe not.
>>Also, since I am only getting the digest version of this mailing list,
>>can you cc: me directly?
>
>I don't know what cygwin commands you could be running if you only
>installed "the base amount of software".  Certainly you couldn't run
>'ls' if you didn't install it.

You are right, I did not realize that the binutils did not have a set of 
commands. It turns out that I was running commands that came with an old 
version of the MKS toolkit that I had in my path. So I installed some 
other cygwin utils.  I tried to run size and ps among others. However, I 
just realized, shouldn't I be able to run any command whether it was a 
cygwin command or not as long as it was in my path? 

>
>>Also, since I am only getting the digest version of this mailing list, 
can
>>you cc: me directly?
>
>Sure, as long as you stop Cc'ing me directly.  I read the cygwin mailing
>list.  There is no reason to get two copies.

sorry about cc'ing you directly. Won't happen again.

>
>cgf

Thanks for all of your suggestions. This is driving me crazy!!
glenn davis.

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Problem with system()
  2000-07-27  7:50   ` Corinna Vinschen
@ 2000-07-27  7:53     ` Chris Faylor
  2000-07-27  8:20       ` Corinna Vinschen
  0 siblings, 1 reply; 13+ messages in thread
From: Chris Faylor @ 2000-07-27  7:53 UTC (permalink / raw)
  To: cygwin

On Thu, Jul 27, 2000 at 04:50:04PM +0200, Corinna Vinschen wrote:
>Chris Faylor wrote:
>> 
>> On Thu, Jul 27, 2000 at 09:42:19AM -0400, Glenn.Davis@predictive.com wrote:
>> >Chris,
>> >I guesss I should have given more info.
>> >I tried
>> >        system ("command /c dir")
>> >and yes, I am using Windows 95.
>> 
>> I don't know what's wrong but I would check basic things like your PATH.
>> If you don't have a command.com in your path then system is obviously
>> not going to be able to run "command".
>
>You have to use "command.com /c dir" because the standard search
>algorithm only finds apps which don't have an extension or which have
>the ".exe" extension. ".com" isn't supported.

This is the standard extension search:

suffix_info std_suffixes[] =
{
  suffix_info (".exe", 1), suffix_info ("", 1),
  suffix_info (".com"), suffix_info (".cmd"),
  suffix_info (".bat"), suffix_info (".dll"),
  suffix_info (NULL)
};

So, .com should be supported.  It is when I try it, anyway.

cgf

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Problem with system()
  2000-07-27  6:48 ` Chris Faylor
@ 2000-07-27  7:50   ` Corinna Vinschen
  2000-07-27  7:53     ` Chris Faylor
  0 siblings, 1 reply; 13+ messages in thread
From: Corinna Vinschen @ 2000-07-27  7:50 UTC (permalink / raw)
  To: cygwin; +Cc: Glenn.Davis

Chris Faylor wrote:
> 
> On Thu, Jul 27, 2000 at 09:42:19AM -0400, Glenn.Davis@predictive.com wrote:
> >Chris,
> >I guesss I should have given more info.
> >I tried
> >        system ("command /c dir")
> >and yes, I am using Windows 95.
> 
> I don't know what's wrong but I would check basic things like your PATH.
> If you don't have a command.com in your path then system is obviously
> not going to be able to run "command".

You have to use "command.com /c dir" because the standard search
algorithm only finds apps which don't have an extension or which have
the ".exe" extension. ".com" isn't supported.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                        mailto:cygwin@sources.redhat.com
Red Hat, Inc.
mailto:vinschen@cygnus.com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Problem with system()
@ 2000-07-27  7:35 Glenn.Davis
  0 siblings, 0 replies; 13+ messages in thread
From: Glenn.Davis @ 2000-07-27  7:35 UTC (permalink / raw)
  To: cygwin

I guess I never told you that I was using "gcc" to do all of this.
When I do the similar thing in Perl it works just fine.
thanks,
glenn davis.




Chris Faylor <cgf@cygnus.com>
07/27/00 09:48 AM
Please respond to cygwin

 
        To:     cygwin@sources.redhat.com
        cc:     Glenn.Davis@predictive.com
        Subject:        Re: Problem with system()


On Thu, Jul 27, 2000 at 09:42:19AM -0400, Glenn.Davis@predictive.com 
wrote:
>Chris,
>I guesss I should have given more info.
>I tried
>        system ("command /c dir")
>and yes, I am using Windows 95.

I don't know what's wrong but I would check basic things like your PATH.
If you don't have a command.com in your path then system is obviously
not going to be able to run "command".

>In fact I tried a whole bunch of commands that are cygwin commands.
>Whatever I do, the system call returns a 127.

"File not found".

>I couldn't find what a 127 meant, if anything.
>Anyway, is it possible that I can be missing a dll. Or is there only the
>one that I need?
>I only installed the base amount of software:
>        gcc-2_95_2-2.tar.gz
>        cygwin-1.1.2.tar.gz
>        binutils-20000625.tar.gz
>        bash-2_04_1.tar.gz
>I thought that should be enough but maybe not.
>Also, since I am only getting the digest version of this mailing list,
>can you cc: me directly?

I don't know what cygwin commands you could be running if you only
installed "the base amount of software".  Certainly you couldn't run
'ls' if you didn't install it.

>Also, since I am only getting the digest version of this mailing list, 
can
>you cc: me directly?

Sure, as long as you stop Cc'ing me directly.  I read the cygwin mailing
list.  There is no reason to get two copies.

cgf



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Problem with system()
  2000-07-27  6:41 Glenn.Davis
@ 2000-07-27  6:48 ` Chris Faylor
  2000-07-27  7:50   ` Corinna Vinschen
  0 siblings, 1 reply; 13+ messages in thread
From: Chris Faylor @ 2000-07-27  6:48 UTC (permalink / raw)
  To: cygwin; +Cc: Glenn.Davis

On Thu, Jul 27, 2000 at 09:42:19AM -0400, Glenn.Davis@predictive.com wrote:
>Chris,
>I guesss I should have given more info.
>I tried 
>        system ("command /c dir") 
>and yes, I am using Windows 95.

I don't know what's wrong but I would check basic things like your PATH.
If you don't have a command.com in your path then system is obviously
not going to be able to run "command".

>In fact I tried a whole bunch of commands that are cygwin commands.
>Whatever I do, the system call returns a 127.

"File not found".

>I couldn't find what a 127 meant, if anything.
>Anyway, is it possible that I can be missing a dll. Or is there only the 
>one that I need?
>I only installed the base amount of software:
>        gcc-2_95_2-2.tar.gz
>        cygwin-1.1.2.tar.gz
>        binutils-20000625.tar.gz
>        bash-2_04_1.tar.gz
>I thought that should be enough but maybe not.
>Also, since I am only getting the digest version of this mailing list,
>can you cc: me directly?

I don't know what cygwin commands you could be running if you only
installed "the base amount of software".  Certainly you couldn't run
'ls' if you didn't install it.

>Also, since I am only getting the digest version of this mailing list, can
>you cc: me directly?

Sure, as long as you stop Cc'ing me directly.  I read the cygwin mailing
list.  There is no reason to get two copies.

cgf

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Problem with system()
@ 2000-07-27  6:41 Glenn.Davis
  2000-07-27  6:48 ` Chris Faylor
  0 siblings, 1 reply; 13+ messages in thread
From: Glenn.Davis @ 2000-07-27  6:41 UTC (permalink / raw)
  To: cygwin; +Cc: cgf

Chris,
I guesss I should have given more info.
I tried 
        system ("command /c dir") 
and yes, I am using Windows 95.
In fact I tried a whole bunch of commands that are cygwin commands.
Whatever I do, the system call returns a 127.
I couldn't find what a 127 meant, if anything.
Anyway, is it possible that I can be missing a dll. Or is there only the 
one that I need?
I only installed the base amount of software:
        gcc-2_95_2-2.tar.gz
        cygwin-1.1.2.tar.gz
        binutils-20000625.tar.gz
        bash-2_04_1.tar.gz
I thought that should be enough but maybe not.
Also, since I am only getting the digest version of this mailing list, can 
you cc: me directly?
thanks,
glenn davis.

On Wed, Jul 26, 2000 at 03:56:42PM -0400, Glenn.Davis@predictive.com 
wrote:
>Hi,
>I am trying to run a simple program that just uses the system() call, but
>I can't get it to work.
>the call I am using is system("dir");
>
>Am I doing something wrong?

"dir" is not a cygwin command.  It's a function of your command shell.

You probably want to do one of:

- system ("ls");                /* The cygwin way */

- system ("command /c dir");    /* Windows 95 */

- system ("cmd /c dir");        /* Windows NT */

cgf


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Problem with system()
  2000-07-26 12:55 Glenn.Davis
@ 2000-07-26 13:01 ` Chris Faylor
  0 siblings, 0 replies; 13+ messages in thread
From: Chris Faylor @ 2000-07-26 13:01 UTC (permalink / raw)
  To: cygwin

On Wed, Jul 26, 2000 at 03:56:42PM -0400, Glenn.Davis@predictive.com wrote:
>Hi,
>I am trying to run a simple program that just uses the system() call, but 
>I can't get it to work.
>the call I am using is system("dir");
>
>Am I doing something wrong?

"dir" is not a cygwin command.  It's a function of your command shell.

You probably want to do one of:

- system ("ls");		/* The cygwin way */

- system ("command /c dir");	/* Windows 95 */

- system ("cmd /c dir");	/* Windows NT */

cgf

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Problem with system()
@ 2000-07-26 12:55 Glenn.Davis
  2000-07-26 13:01 ` Chris Faylor
  0 siblings, 1 reply; 13+ messages in thread
From: Glenn.Davis @ 2000-07-26 12:55 UTC (permalink / raw)
  To: cygwin

Hi,
I am trying to run a simple program that just uses the system() call, but 
I can't get it to work.
the call I am using is system("dir");

Am I doing something wrong?

Thanks for any help.
glenn davis.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2001-04-01  9:37 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-01  9:37 Problem with system() Piyatad Tabmanee
  -- strict thread matches above, loose matches on Subject: below --
2000-07-27  8:39 Glenn.Davis
2000-07-27  8:10 Glenn.Davis
2000-07-27  8:03 Glenn.Davis
2000-07-27  8:10 ` Chris Faylor
2000-07-27  7:35 Glenn.Davis
2000-07-27  6:41 Glenn.Davis
2000-07-27  6:48 ` Chris Faylor
2000-07-27  7:50   ` Corinna Vinschen
2000-07-27  7:53     ` Chris Faylor
2000-07-27  8:20       ` Corinna Vinschen
2000-07-26 12:55 Glenn.Davis
2000-07-26 13:01 ` Chris Faylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).