Mail Archives: djgpp-workers/1999/05/11/14:14:43
Bonjour
> It should be easy to add a simple wrapper around _fixpath. Volunteers
> are welcome :
Here is a crude workaround.
-------------
#include <stdlib.h>
char * realpath (const char *, char *);
--------------------------------
#include <stdlib.h>
#include <limits.h>
#include <sys/stat.h>
#include <errno.h>
char * realpath (const char * file_name, char * resolved_name)
{
struct stat stbuf;
if (file_name == NULL || resolved_name == NULL)
{
errno = EINVAL;
return 0;
}
if (*file_name == '\0')
{
errno = ENOENT;
return 0;
}
if (stat(file_name, &stbuf) != 0)
return 0;
_fixpath (file_name, resolved_name);
return resolved_name;
}
--------------------------------
The big difference with _fixpath is that it actually check for
the path existence.
--
au revoir, alain
----
Aussi haut que l'on soit assis, on est toujours assis que sur son cul !!!
- Raw text -