GrafX2 2.9.3227
The ultimate 256-color painting program
realpath.c File Reference
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>
+ Include dependency graph for realpath.c:

Functions

char * Realpath (const char *_path)
 Makes an absolute filename, resolving symbolic links etc. More...
 

Function Documentation

◆ Realpath()

char * Realpath ( const char *  _path)

Makes an absolute filename, resolving symbolic links etc.

Parameters
_pathInput path
Returns
real path, to be free()'d

POSIX 2004 states : If resolved_name is a null pointer, the behavior of realpath() is implementation-defined.

but POSIX 2008 : If resolved_name is a null pointer, the generated pathname shall be stored as a null-terminated string in a buffer allocated as if by a call to malloc().

So we assume all platforms now support passing NULL. If you find a platform where this is not the case, please add a new implementation with ifdef's.

References GFX2_malloc, NULL, and PATH_MAX.

Referenced by Analyze_command_line(), Calculate_relative_path(), Extract_path(), For_each_file(), Load_INI(), and Test_Realpath().