Amiga Developer Site by i n n o i d e a | MorphOS | Amiga Developers | Compilers | Documents | Dev-HardFile v1.11 for UAE / real Amiga - readme - shot) | Unique/All Visitors: 77257/570053
Search manual for function in the   
GeekGadgets/realpath
NAME 

realpath - return the canonicalized absolute pathname

SYNOPSIS 


#include <limits.h> 
#include <stdlib.h> 


char *realpath(const char *path, char *resolved_path);

DESCRIPTION 

realpath 
expands all symbolic links and resolves references
to
'/./', '/../'
and extra 
'/' 
characters in the null terminated string named by 
path 
and stores the canonicalized absolute pathname in the buffer of size
PATH_MAX 
named by
resolved_path.
The resulting path will have no symbolic link,
'/./' 
or
'/../' 
components.

RETURN VALUE 

If there is no error, it returns a pointer to the
resolved_path.

Otherwise it returns a NULL pointer, and the contents
of the array
resolved_path 
are undefined. The global variable
errno 
is set to indicate the error. 

ERRORS 

EACCES 
Read or sear.h permission was denied for a component of the path prefix.
EINVAL 
Either
path 
or
resolved_path 
is NULL. (In libc5 this would just cause a segfault.)
EIO 
An I/O error occurred while reading from the file system.
ELOOP 
Too many symbolic links were encountered in translating the pathname.
ENAMETOOLONG 
A component of a path name exceeded 
NAME_MAX 
characters, or an entire path name exceeded 
PATH_MAX 
characters.
ENOENT 
The named file does not exist.
ENOTDIR 
A component of the path prefix is not a directory.

BUGS 

The libc4 and libc5 implementation contains a buffer overflow
(fixed in libc-5.4.13).
Thus, suid programs like mount need a private version.


The length of the output buffer should have been an additional
parameter, especially since
pathconf(3)
warns that the result of
pathconf() 
may be huge and unsuitable for mallocing memory.

HISTORY 

The
realpath 
function first appeared in BSD 4.4, contributed by Jan-Simon Pendry.
In Linux this function appears in libc 4.5.21.

CONFORMING TO 

In BSD 4.4 and Solaris the limit on the pathname length is MAXPATHLEN
(found in <sys/param.h>). The SUSv2 prescribes PATH_MAX and
NAME_MAX, as found in <limits.h> or provided by the
pathconf() 
function. A typical source fragment would be



#ifdef PATH_MAX
  path_max = PATH_MAX;
#else
  path_max = pathconf (path, _PC_PATH_MAX);
  if (path_max <= 0)
    path_max = 4096;
#endif



The BSD 4.4, Linux and SUSv2 versions always return an absolute
path name. Solaris may return a relative path name when the
path 
argument is relative.
The prototype of
realpath 
is given in <unistd.h> in libc4 and libc5,
but in <stdlib.h> everywhere else.

SEE ALSO 

readlink(2),
getcwd(3),
pathconf(3),
sysconf(3)


20030613153526 - LouiSe - for (GeekGadgets/realpath)
Example #1 is a realpath() implementation for AmigaOS/MorphOS
Geekgadgets environment...
20040301100209 - LouiSe - for (GeekGadgets/realpath)
#include <stdio.h>
#include <string.h>
#include <sys/syslimits.h>

int main(int atgc, char *argv[])
{
  char buff[PATH_MAX];

  printf("realpath: [%s]->[%s]",argv[1],realpath(argv[1],buff));

  return(0);
}
20040301131355 - LouiSe - for (GeekGadgets/realpath)
Example #2 is a simple realpath() implementation...

Logo by Emeric/SH
GeekGadgets/realpath

Example #1 Download / View
Example #2 Download / View
Example #3 Download / View

Functions with "r":
radix.h
radix_protos.h
raise
rand
random
ranlib.h
raw_cb.h
raw_cb_protos.h
raw_ip_protos.h
raw_usrreq_protos.h
rcmd
rcs.h
re_comp
re_exec
read
readdir
readlink
readv
realloc
realpath
reboot
recno
recv
recvfrom
recvmsg
reg.h
regcomp
regerror
regex
regex.h
regexec
regexp.h
regfree
register
registerrpc
remove
remque
rename
res_comp.c
res_debug.c
res_init
res_init.c
res_mkquery
res_mkquery.c
res_query
res_query.c
res_querydomain
res_search
res_send
res_send.c
resolv.h
resolv_extras.h
resolver
resource.h
return
rewind
rewinddir
rex.x
rindex
rint
rintf
rintl
rmdir
rnusers.x
round
roundf
roundl
route.h
routed.h
routing
rpc
rpc.h
rpc_msg.h
rpcv2.h
rquota.x
rresvport
rstat.c
rstat.x
rstat_proc.c
rtnetlink
rtsock_protos.h
ruserok
rwhod.h

Last 15 uploaded Examples:

20071229151342 AmiSSL/X509_STORE_CTX_cleanup
20070708011052 GeekGadgets/getlogin
20060705053954 AmigaOS/OpenWorkbenchObjectA
20050801035639 SDL/SDL_Surface
20050727092732 BlitzBasic/LSL
20050718102843 SDL/SDL_WarpMouse
20050718072844 GeekGadgets/fread
20050714051528 SDL/SDL_ActiveEvent
20050714051514 SDL/SDL_ActiveEvent
20050701171401 GeekGadgets/errno
20050701171347 GeekGadgets/errno
20050627101951 SDL/SDL_FreeSurface
20050623152729 GeekGadgets/fork
20050619153102 GeekGadgets/tcdrain
20050615182849 AmigaOS/OpenScreen

Last 25 posts:

20050613235812 SDL/SDL_SetGammaRamp
20050526065000 AmiTCP/unistd.h
20050413041558 AmiSSL/X509_STORE_set_default_paths
20050409155750 AmigaDOS/Status
20050129230614 MUI/Calendar.mcc
20050128185620 GeekGadgets/hstrerror
20041126154558 BlitzBasic/LoadBank
20041123170704 GeekGadgets/gcvt
20041105222909 AmigaOS/CheckSignal
20040712190839 SDL/SDL_SetVideoMode
20040627090529 SDL/SDL_Init
20040519133228 GeekGadgets/fork
20040407124555 AmigaOS/AllocMem
20040403101120 GeekGadgets/inet_ntoa
20040327172814 GeekGadgets/random
20040327172714 GeekGadgets/srandom
20040313211937 BlitzBasic/ANALYZEDISK
20040303135237 GeekGadgets/mktemp
20040301131355 GeekGadgets/realpath
20040301123615 GeekGadgets/gcvt
20040301114000 GeekGadgets/htonl
20040301100209 GeekGadgets/realpath
20040229095437 GeekGadgets/time
20040211132618 GeekGadgets/getpid
20040209102818 AmigaOS/OpenWindow




Amiga.sf
AMIGIFT

Locations of visitors to this page

Page took 0.669777 seconds to load.