X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/1f2f436a38f7ae2d39a943ad2898d8fed4ed2e58..aa54d2fad3d9038b43475aa93c76795c5141a993:/gen/FreeBSD/dirname.3?ds=sidebyside diff --git a/gen/FreeBSD/dirname.3 b/gen/FreeBSD/dirname.3 index 43a1853..9c9d7f1 100644 --- a/gen/FreeBSD/dirname.3 +++ b/gen/FreeBSD/dirname.3 @@ -25,7 +25,13 @@ .Sh SYNOPSIS .In libgen.h .Ft char * -.Fn dirname "const char *path" +.Fo dirname +.Fa "char *path" +.Fc +.Ft char * +.Fo dirname_r +.Fa "const char *path" "char *dname" +.Fc .Sh DESCRIPTION The .Fn dirname @@ -53,13 +59,27 @@ function returns a pointer to internal storage space allocated on the first call that will be overwritten by subsequent calls. +.Fn dirname_r +is therefore preferred for threaded applications. .Pp Other vendor implementations of .Fn dirname may modify the contents of the string passed to .Fn dirname ; -this should be taken into account when writing code which calls this function -if portability is desired. +if portability is desired, +this should be taken into account when writing code which calls this function. +.Sh LEGACY SYNOPSIS +.Fd #include +.Pp +.Ft char * +.br +.Fo dirname +.Fa "const char *path" +.Fc ; +.Pp +In legacy mode, +.Fa path +will not be changed. .Sh RETURN VALUES On successful completion, .Fn dirname @@ -78,11 +98,16 @@ The following error codes may be set in .It Bq Er ENAMETOOLONG The path component to be returned was larger than .Dv MAXPATHLEN . +.It Bq Er ENOMEM +The static buffer used for storing the path in +.Fn dirname +could not be allocated. .El .Sh SEE ALSO .Xr basename 1 , .Xr dirname 1 , -.Xr basename 3 +.Xr basename 3 , +.Xr compat 5 .Sh STANDARDS The .Fn dirname @@ -95,5 +120,8 @@ function first appeared in .Ox 2.2 and .Fx 4.2 . +The +.Fn dirname_r +function first appeared in OS X 10.12. .Sh AUTHORS .An "Todd C. Miller"