From: Alain Magloire Message-Id: <199905121431.KAA24819@mccoy2.ECE.McGill.CA> Subject: Re: realpath() To: eliz AT is DOT elta DOT co DOT il (Eli Zaretskii) Date: Wed, 12 May 1999 10:31:50 -0400 (EDT) Cc: djgpp-workers AT delorie DOT com In-Reply-To: from "Eli Zaretskii" at May 12, 99 10:03:11 am X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk Bonjour > > if (stat(file_name, &stbuf) != 0) > > return 0; > > `stat' is too expensive for this. Use `__file_exist' or `access' > instead. (I think `access' is a better alternative for > Unix-compatibility functions, since it doesn't fail for root > directories and devices.) I'm not sure about __file_exist, since, according to reference on www.delorie.com/djgpp/doc/libc it does not seem to set the errno appropriately. realpath() is use to kill two birds with one stone. Canonize the path and checking for accessibility of the file. I agree, access() will do nicely to. #include ... if (access(file_name, R_OK) != 0) return NULL; ... -- au revoir, alain ---- Aussi haut que l'on soit assis, on est toujours assis que sur son cul !!!