Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

getwd(2) [plan9 man page]

GETWD(2)							System Calls Manual							  GETWD(2)

NAME
getwd - get current directory SYNOPSIS
#include <u.h> #include <libc.h> char* getwd(char *buf, int size) DESCRIPTION
Getwd fills buf with a null-terminated string representing the current directory and returns buf. Getwd places no more than size bytes in the buffer provided. SOURCE
/sys/src/libc/9sys/getwd.c SEE ALSO
pwd(1) DIAGNOSTICS
On error, zero is returned and buf is filled with a diagnostic message. Errstr(2) may be consulted for more information. BUGS
Because mounts and binds (see bind(2)) may produce multiple names for a directory, getwd might not return the path by which the directory was reached. GETWD(2)

Check Out this Related Man Page

GETWD(P)						     POSIX Programmer's Manual							  GETWD(P)

NAME
getwd - get the current working directory pathname (LEGACY) SYNOPSIS
#include <unistd.h> char *getwd(char *path_name); DESCRIPTION
The getwd() function shall determine an absolute pathname of the current working directory of the calling process, and copy a string con- taining that pathname into the array pointed to by the path_name argument. If the length of the pathname of the current working directory is greater than ({PATH_MAX}+1) including the null byte, getwd() shall fail and return a null pointer. RETURN VALUE
Upon successful completion, a pointer to the string containing the absolute pathname of the current working directory shall be returned. Otherwise, getwd() shall return a null pointer and the contents of the array pointed to by path_name are undefined. ERRORS
No errors are defined. The following sections are informative. EXAMPLES
None. APPLICATION USAGE
For applications portability, the getcwd() function should be used to determine the current working directory instead of getwd(). RATIONALE
Since the user cannot specify the length of the buffer passed to getwd(), use of this function is discouraged. The length of a pathname described in {PATH_MAX} is file system-dependent and may vary from one mount point to another, or might even be unlimited. It is possible to overflow this buffer in such a way as to cause applications to fail, or possible system security violations. It is recommended that the getcwd() function should be used to determine the current working directory. FUTURE DIRECTIONS
This function may be withdrawn in a future version. SEE ALSO
getcwd() , the Base Definitions volume of IEEE Std 1003.1-2001, <unistd.h> COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . IEEE
/The Open Group 2003 GETWD(P)
Man Page

6 More Discussions You Might Find Interesting

1. Solaris

Samba 3.0.22 on Solaris9

Hello all, I have successfully installed samba 3.0.22 on my sol 9 e250 machine. I created my share but when i try to get to my share from my windows machine, it prompts me for my username and passwd, i enter it and it just comes back prompting me for my username and passwd agai,. Has anyone been... (8 Replies)
Discussion started by: Gegestic
8 Replies

2. Solaris

Need help in building gcc on solaris.

We are moving from old solaris to new version of solaris. I have copied the gcc compiler installed on old server to new solaris server. But just copying didn't work. So I am trying to build it on the new server. The server version is sailfish@st-kvar02 -> uname -a SunOS st-kvar02 5.10... (7 Replies)
Discussion started by: nalina.hv
7 Replies

3. Programming

Help

Hi, i have a question is there any way to store a system call (like pwd, or the path of a working directory) to a variable using C?? or is there another way that i can obtain the PATH??, and how can i use the same var to do a cd or make a file. thank you in advance!! (1 Reply)
Discussion started by: kyubiii
1 Replies

4. UNIX for Dummies Questions & Answers

Tar Help

Hi Unix Gurus, I would like to seek some advises regarding tar. I've received this error: tar: The getwd subroutine failed. Cannot open the parent directory. when i try to tar some files in the directory. Is this something to do with the file permission of the parent... (8 Replies)
Discussion started by: lweegp
8 Replies

5. Red Hat

Minicom with VMWare ESX Server

Hello! I have an ESX Server up and running. Now I want to connect a serial device to the COM Port. For that I need the minicom program. When I try "configure - make - make all" I get some errors. Can someone please explain to me, what the problems are: # ./configure checking for a... (3 Replies)
Discussion started by: Kickbit
3 Replies

6. Solaris

solaris samba configuration without wins service from authentication window server/Active directory

Hi All, We are using solaris samba server for our company project to provide access to code to our development team.Recently our ICT has disabled wins service on Active directory due which user are not able to connect to samba share and they are getting error "No logon server available" as samba... (2 Replies)
Discussion started by: sahil_shine
2 Replies