delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/09/17/18:00:49

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Fri, 17 Sep 2004 17:00:39 -0500
From: Brian Ford <ford AT vss DOT fsi DOT com>
Reply-To: cygwin AT cygwin DOT com
To: cygwin AT cygwin DOT com
Subject: argv[0] drops extension?
Message-ID: <Pine.CYG.4.58.0409171656400.1788@fordpc.vss.fsi.com>
MIME-Version: 1.0
X-IsSubscribed: yes

$ 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019