* Removing the same file from two consoles
@ 2003-09-11 15:25 Alex Vinokur
2003-09-11 15:32 ` Christopher Faylor
0 siblings, 1 reply; 3+ messages in thread
From: Alex Vinokur @ 2003-09-11 15:25 UTC (permalink / raw)
To: cygwin
Here is some program which was invocated on two consoles.
The program behavior is different on
* Cygwin, DJGPP on the one hand
and
* Mingw on the other hand
environments.
Which is right/correct/preferable?
========= C-code : BEGIN =========
/* File t.c */
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <assert.h>
int main(int argc, char** argv)
{
int rc;
char ch;
FILE* fp;
int i;
assert (argc > 1);
printf ("Command line : ");
for (i = 0; i < argc; i++) printf ("%s ", argv[i]);
printf ("\n");
errno = 0;
rc = access (argv[1], F_OK);
printf ("access : rc = %d; errno = %u (%s)\n", rc, errno, strerror(errno));
errno = 0;
rc = remove (argv[1]);
printf ("remove : rc = %d; errno = %u (%s)\n", rc, errno, strerror(errno));
fp = fopen (argv[1], "w");
printf ("fopen : %s\n", (fp ? "OK" : "FAILURE"));
printf ("Enter any key : ");
scanf ("%c", &ch);
errno = 0;
rc = access (argv[1], F_OK);
printf ("access : rc = %d; errno = %u (%s)\n", rc, errno, strerror(errno));
printf ("Thanks. Bye\n");
return 0;
}
========= C-code : END ===========
######### Run via Cygwin : BEGIN #########
=========================================
Windows 2000
CYGWIN_NT-5.0 1.3.22(0.78/3/2)
GNU gcc version 3.2 20020927 (prerelease)
=========================================
====================================
Step 0. Compiling and getting status
====================================
------ Console-0 ------
$ gcc t.c -o progc
-----------------------
=================================================
Step 1. removing and fopening a file on Console-1
=================================================
------ Console-1 ------
$ progc foo
Command line : progc foo
access : rc = -1; errno = 2 (No such file or directory)
remove : rc = -1; errno = 2 (No such file or directory)
fopen : OK
Enter any key :
-----------------------
========================================================
Step 2. removing and fopening the same file on Console-2
========================================================
------ Console-2 ------
$ progc foo
Command line : progc foo
access : rc = 0; errno = 0 (No error)
remove : rc = 0; errno = 0 (No error)
fopen : FAILURE
Enter any key :
-----------------------
======================================
Step 3. Entering some key on Console-2
======================================
------ Console-2 ------
----- continuation ----
Enter any key : a
access : rc = -1; errno = 13 (Permission denied)
Thanks. Bye
-----------------------
======================================
Step 4. Entering some key on Console-1
======================================
------ Console-1 ------
----- continuation ----
Enter any key : b
access : rc = -1; errno = 2 (No such file or directory)
Thanks. Bye
-----------------------
######### Run via Cygwin : END ###########
######### Run via Mingw : BEGIN #########
====================
Windows 2000
MinGW 2.0.0.-2
GNU gcc version 3.2
===================
====================================
Step 0. Compiling and getting status
====================================
------ Console-0 ------
$ gcc t.c -o progm
-----------------------
=================================================
Step 1. removing and fopening a file on Console-1
=================================================
------ Console-1 ------
$ progm foo
Command line : progm.exe foo
access : rc = -1; errno = 2 (No such file or directory)
remove : rc = -1; errno = 2 (No such file or directory)
fopen : OK
Enter any key :
-----------------------
========================================================
Step 2. removing and fopening the same file on Console-2
========================================================
------ Console-2 ------
$ progm foo
Command line : progm.exe foo
access : rc = 0; errno = 0 (No error)
remove : rc = -1; errno = 13 (Permission denied)
fopen : OK
Enter any key :
-----------------------
======================================
Step 3. Entering some key on Console-2
======================================
------ Console-2 ------
----- continuation ----
Enter any key : a
access : rc = 0; errno = 0 (No error)
Thanks. Bye
-----------------------
======================================
Step 4. Entering some key on Console-1
======================================
------ Console-1 ------
----- continuation ----
Enter any key : b
access : rc = 0; errno = 0 (No error)
Thanks. Bye
-----------------------
######### Run via Mingw : END ###########
=====================================
Alex Vinokur
mailto:alexvn@connect.to
http://mathforum.org/library/view/10978.html
=====================================
--
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/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Removing the same file from two consoles
2003-09-11 15:25 Removing the same file from two consoles Alex Vinokur
@ 2003-09-11 15:32 ` Christopher Faylor
2003-09-11 15:50 ` Alex Vinokur
0 siblings, 1 reply; 3+ messages in thread
From: Christopher Faylor @ 2003-09-11 15:32 UTC (permalink / raw)
To: cygwin
On Thu, Sep 11, 2003 at 06:22:58PM +0300, Alex Vinokur wrote:
>Here is some program which was invocated on two consoles.
>
>
>The program behavior is different on
> * Cygwin, DJGPP on the one hand
> and
> * Mingw on the other hand
> environments.
>
>
>Which is right/correct/preferable?
Cygwin's of course.
You may get a different answer if you ask this question in the mingw
mailing list, though.
cgf
--
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/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Removing the same file from two consoles
2003-09-11 15:32 ` Christopher Faylor
@ 2003-09-11 15:50 ` Alex Vinokur
0 siblings, 0 replies; 3+ messages in thread
From: Alex Vinokur @ 2003-09-11 15:50 UTC (permalink / raw)
To: cygwin
"Christopher Faylor" <cgf-rcm@cygwin.com> wrote in message news:20030911153224.GC5796@redhat.com...
> On Thu, Sep 11, 2003 at 06:22:58PM +0300, Alex Vinokur wrote:
> >Here is some program which was invocated on two consoles.
> >
> >
> >The program behavior is different on
> > * Cygwin, DJGPP on the one hand
> > and
> > * Mingw on the other hand
> > environments.
> >
> >
> >Which is right/correct/preferable?
>
> Cygwin's of course.
>
> You may get a different answer if you ask this question in the mingw
> mailing list, though.
>
> cgf
>
Is there any UNIX-related standard/convention about this topic?
--
=====================================
Alex Vinokur
mailto:alexvn@connect.to
http://mathforum.org/library/view/10978.html
=====================================
--
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/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-09-11 15:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-11 15:25 Removing the same file from two consoles Alex Vinokur
2003-09-11 15:32 ` Christopher Faylor
2003-09-11 15:50 ` Alex Vinokur
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).