Internationalization and localization tools


File and Path Function

char *realpath(const char *restrict name, char *restrict resolved);

Internationalization (I18n) Function Overview

A call to realpath where the resolved parameter is NULL behaves exactly like canonicalize_file_name. The function allocates a buffer for the file name and returns a pointer to it. If resolved is not NULL it points to a buffer into which the result is copied. It is the caller's responsibility to allocate a buffer which is large enough. On systems which define PATH_MAX, this means the buffer must be large enough for a pathname of this size. For systems without limitations on the pathname length, realpath should only be called with NULL for the second parameter, to avoid buffer overruns by ensuring that a sufficiently-sized buffer is allocated.

In the case of an error, NULL is returned and the global errno variable is set with the error value.

I18n Issues

Ensure that if buffer is not NULL, it is large enough to hold the resulting single-byte or multibyte character string. See Locale-Sensitive Length Functions for a discussion on multibyte character sizes.

On ANSI UTF-16 platforms, use a conversion function to convert the wide-character string to a multibyte-character string and then call realpath.

See Pathnames for a discussion of path and filename considerations in an internationalized application.

Recommended Replacements*

*If you're already using the recommended function, see I18n Issues for other reasons why Globalyzer is detecting the function.

File and Path Functions

 

Lingoport internationalization and localization services and software