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