166492cf0SYuri Pankov.\" 266492cf0SYuri Pankov.\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for 366492cf0SYuri Pankov.\" permission to reproduce portions of its copyrighted documentation. 466492cf0SYuri Pankov.\" Original documentation from The Open Group can be obtained online at 5c10c16deSRichard Lowe.\" http://www.opengroup.org/bookstore/. 666492cf0SYuri Pankov.\" 766492cf0SYuri Pankov.\" The Institute of Electrical and Electronics Engineers and The Open 866492cf0SYuri Pankov.\" Group, have given us permission to reprint portions of their 966492cf0SYuri Pankov.\" documentation. 1066492cf0SYuri Pankov.\" 1166492cf0SYuri Pankov.\" In the following statement, the phrase ``this text'' refers to portions 1266492cf0SYuri Pankov.\" of the system documentation. 1366492cf0SYuri Pankov.\" 1466492cf0SYuri Pankov.\" Portions of this text are reprinted and reproduced in electronic form 1566492cf0SYuri Pankov.\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition, 1666492cf0SYuri Pankov.\" Standard for Information Technology -- Portable Operating System 1766492cf0SYuri Pankov.\" Interface (POSIX), The Open Group Base Specifications Issue 6, 1866492cf0SYuri Pankov.\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics 1966492cf0SYuri Pankov.\" Engineers, Inc and The Open Group. In the event of any discrepancy 2066492cf0SYuri Pankov.\" between these versions and the original IEEE and The Open Group 2166492cf0SYuri Pankov.\" Standard, the original IEEE and The Open Group Standard is the referee 2266492cf0SYuri Pankov.\" document. The original Standard can be obtained online at 2366492cf0SYuri Pankov.\" http://www.opengroup.org/unix/online.html. 2466492cf0SYuri Pankov.\" 25c10c16deSRichard Lowe.\" This notice shall appear on any product containing this material. 2666492cf0SYuri Pankov.\" 2766492cf0SYuri Pankov.\" The contents of this file are subject to the terms of the 2866492cf0SYuri Pankov.\" Common Development and Distribution License (the "License"). 2966492cf0SYuri Pankov.\" You may not use this file except in compliance with the License. 3066492cf0SYuri Pankov.\" 3166492cf0SYuri Pankov.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 3266492cf0SYuri Pankov.\" or http://www.opensolaris.org/os/licensing. 3366492cf0SYuri Pankov.\" See the License for the specific language governing permissions 3466492cf0SYuri Pankov.\" and limitations under the License. 3566492cf0SYuri Pankov.\" 3666492cf0SYuri Pankov.\" When distributing Covered Code, include this CDDL HEADER in each 3766492cf0SYuri Pankov.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. 3866492cf0SYuri Pankov.\" If applicable, add the following below this CDDL HEADER, with the 3966492cf0SYuri Pankov.\" fields enclosed by brackets "[]" replaced with your own identifying 4066492cf0SYuri Pankov.\" information: Portions Copyright [yyyy] [name of copyright owner] 4166492cf0SYuri Pankov.\" 4266492cf0SYuri Pankov.\" 4366492cf0SYuri Pankov.\" Copyright (c) 1992, X/Open Company Limited. All Rights Reserved. 4466492cf0SYuri Pankov.\" Portions Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved 4566492cf0SYuri Pankov.\" Copyright 2015 Garrett D'Amore <garrett@damore.org> 4666492cf0SYuri 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 , 92*bbf21555SRichard Lowe.Xr standards 7 93aaec9ca2SGarrett D'Amore.Sh STANDARDS 94aaec9ca2SGarrett D'AmoreThe 95aaec9ca2SGarrett D'Amore.Fn getwd 9672d3dbb9SYuri Pankovfunction is available in the following compilation environments. 9772d3dbb9SYuri PankovSee 98*bbf21555SRichard Lowe.Xr standards 7 . 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