1
by Francesco Paolo Lovergine
rules: linking manpages-posix not manpages. |
1 |
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved |
2
by Francesco Paolo Lovergine
* Alligned to linux main manpages edition. |
2 |
.TH "GETWD" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual" |
1
by Francesco Paolo Lovergine
rules: linking manpages-posix not manpages. |
3 |
.\" getwd |
4 |
.SH NAME |
|
5 |
getwd \- get the current working directory pathname (\fBLEGACY\fP) |
|
6 |
.SH SYNOPSIS |
|
7 |
.LP
|
|
8 |
\fB#include <unistd.h>
|
|
9 |
.br
|
|
10 |
.sp
|
|
11 |
char *getwd(char *\fP\fIpath_name\fP\fB); \fP |
|
12 |
\fB
|
|
13 |
.br
|
|
14 |
\fP
|
|
15 |
.SH DESCRIPTION |
|
16 |
.LP
|
|
17 |
The \fIgetwd\fP() function shall determine an absolute pathname of |
|
18 |
the current working directory of the calling process, and |
|
19 |
copy a string containing that pathname into the array pointed to by |
|
20 |
the \fIpath_name\fP argument. |
|
21 |
.LP
|
|
22 |
If the length of the pathname of the current working directory is |
|
23 |
greater than ({PATH_MAX}+1) including the null byte, |
|
24 |
\fIgetwd\fP() shall fail and return a null pointer. |
|
25 |
.SH RETURN VALUE |
|
26 |
.LP
|
|
27 |
Upon successful completion, a pointer to the string containing the |
|
28 |
absolute pathname of the current working directory shall be |
|
29 |
returned. Otherwise, \fIgetwd\fP() shall return a null pointer and |
|
30 |
the contents of the array pointed to by \fIpath_name\fP are |
|
31 |
undefined. |
|
32 |
.SH ERRORS |
|
33 |
.LP
|
|
34 |
No errors are defined. |
|
35 |
.LP
|
|
36 |
\fIThe following sections are informative.\fP |
|
37 |
.SH EXAMPLES |
|
38 |
.LP
|
|
39 |
None. |
|
40 |
.SH APPLICATION USAGE |
|
41 |
.LP
|
|
42 |
For applications portability, the \fIgetcwd\fP() function should be |
|
43 |
used to determine |
|
44 |
the current working directory instead of \fIgetwd\fP(). |
|
45 |
.SH RATIONALE |
|
46 |
.LP
|
|
47 |
Since the user cannot specify the length of the buffer passed to \fIgetwd\fP(), |
|
48 |
use of this function is discouraged. The length |
|
49 |
of a pathname described in {PATH_MAX} is file system-dependent and |
|
50 |
may vary from one mount point to another, or might even be |
|
51 |
unlimited. It is possible to overflow this buffer in such a way as |
|
52 |
to cause applications to fail, or possible system security |
|
53 |
violations. |
|
54 |
.LP
|
|
55 |
It is recommended that the \fIgetcwd\fP() function should be used |
|
56 |
to determine the |
|
57 |
current working directory. |
|
58 |
.SH FUTURE DIRECTIONS |
|
59 |
.LP
|
|
60 |
This function may be withdrawn in a future version. |
|
61 |
.SH SEE ALSO |
|
62 |
.LP
|
|
63 |
\fIgetcwd\fP() , the Base Definitions volume of IEEE\ Std\ 1003.1-2001, |
|
64 |
\fI<unistd.h>\fP |
|
65 |
.SH COPYRIGHT |
|
66 |
Portions of this text are reprinted and reproduced in electronic form |
|
67 |
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology |
|
68 |
-- Portable Operating System Interface (POSIX), The Open Group Base |
|
69 |
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of |
|
70 |
Electrical and Electronics Engineers, Inc and The Open Group. In the |
|
71 |
event of any discrepancy between this version and the original IEEE and |
|
72 |
The Open Group Standard, the original IEEE and The Open Group Standard |
|
73 |
is the referee document. The original Standard can be obtained online at |
|
74 |
http://www.opengroup.org/unix/online.html . |