xref: /illumos-gate/usr/src/man/man3c/getwd.3c (revision 663b59f48c396b41650fffe9e2f20a85e9710c85)
1.\"
2.\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3.\" permission to reproduce portions of its copyrighted documentation.
4.\" Original documentation from The Open Group can be obtained online at
5.\" http://www.opengroup.org/bookstore/.
6.\"
7.\" The Institute of Electrical and Electronics Engineers and The Open
8.\" Group, have given us permission to reprint portions of their
9.\" documentation.
10.\"
11.\" In the following statement, the phrase ``this text'' refers to portions
12.\" of the system documentation.
13.\"
14.\" Portions of this text are reprinted and reproduced in electronic form
15.\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16.\" Standard for Information Technology -- Portable Operating System
17.\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18.\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19.\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20.\" between these versions and the original IEEE and The Open Group
21.\" Standard, the original IEEE and The Open Group Standard is the referee
22.\" document.  The original Standard can be obtained online at
23.\" http://www.opengroup.org/unix/online.html.
24.\"
25.\" This notice shall appear on any product containing this material.
26.\"
27.\" The contents of this file are subject to the terms of the
28.\" Common Development and Distribution License (the "License").
29.\" You may not use this file except in compliance with the License.
30.\"
31.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32.\" or http://www.opensolaris.org/os/licensing.
33.\" See the License for the specific language governing permissions
34.\" and limitations under the License.
35.\"
36.\" When distributing Covered Code, include this CDDL HEADER in each
37.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38.\" If applicable, add the following below this CDDL HEADER, with the
39.\" fields enclosed by brackets "[]" replaced with your own identifying
40.\" information: Portions Copyright [yyyy] [name of copyright owner]
41.\"
42.\"
43.\" Copyright (c) 1992, X/Open Company Limited.  All Rights Reserved.
44.\" Portions Copyright (c) 2002, Sun Microsystems, Inc.  All Rights Reserved
45.\" Copyright 2015 Garrett D'Amore <garrett@damore.org>
46.\"
47.Dd Mar 30, 2015
48.Dt GETWD 3C
49.Os
50.Sh NAME
51.Nm getwd
52.Nd get current working directory pathname
53.Sh SYNOPSIS
54.In unistd.h
55.Ft "char *"
56.Fn getwd "char *path_name"
57.Sh DESCRIPTION
58The
59.Fn getwd
60function determines an absolute pathname of the current
61working directory of the calling process, and copies that pathname into the
62array pointed to by the
63.Fa path_name
64argument.
65.Lp
66If the length of the pathname of the current working directory is greater than
67.Pq Dv PATH_MAX + 1
68including the null byte,
69.Fn getwd
70fails and returns a null pointer.
71.Sh RETURN VALUES
72Upon successful completion, a pointer to the string containing the absolute
73pathname of the current working directory is returned.
74Otherwise,
75.Fn getwd
76returns a null pointer and the contents of the array pointed to by
77.Fa path_name
78are undefined.
79.Sh ERRORS
80No errors are defined.
81.Sh USAGE
82The
83.Fn getwd
84function is supplied for backwards compatibility.
85The
86.Xr getcwd 3C
87should be used instead.
88.Sh INTERFACE STABILITY
89.Sy Obsolete Standard .
90.Sh SEE ALSO
91.Xr getcwd 3C ,
92.Xr standards 7
93.Sh STANDARDS
94The
95.Fn getwd
96function is available in the following compilation environments.
97See
98.Xr standards 7 .
99.Lp
100.Bl -bullet -compact
101.It
102.St -xpg4.2
103.It
104.St -susv2
105.It
106.St -susv3
107.El
108.Lp
109It was marked obsolete in
110.St -susv3
111and removed from
112.St -p1003.1-2008 .
113