This is the mail archive of the cygwin 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]

argv[0] drops extension?


$ uname -a
CYGWIN_NT-5.1 fordpc 1.5.12(0.116/4/2) 2004-09-16 11:17 i686 unknown
unknown Cygwin

$ cat argv.c
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int
main(int argc, char *argv[])
{
    printf("argv[0]: %s\n", argv[0]);

    if (open(argv[0], O_RDONLY|O_BINARY) < 0)
        perror("open");

    return 0;
}

$ gcc -o argv.exe -g -O2 argv.c

$ ./argv
argv[0]: ./argv
open: No such file or directory

$ ./argv.exe
argv[0]: ./argv
open: No such file or directory

Is this expected behavior?  Thanks.

-- 
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
the best safety device in any aircraft is a well-trained pilot...

--
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]