.TH ftp_chdir 3 "January 2004" "Feep Networks" "C Library Calls" .SH NAME ftp_chdir \- change current working directory on FTP server .SH SYNOPSIS .B #include .BI "int ftp_chdir(FTP *" ftp ", char *" dir ");" .SH VERSION This man page documents version 1.3 of \fBlibfget\fP. .SH DESCRIPTION The \fBftp_chdir\fP() function changes the current working directory on the FTP server associated with \fIftp\fP to \fIdir\fP. .SH RETURN VALUE The \fBftp_chdir\fP() function returns 0 on success, or -1 on error (and sets \fIerrno\fP). .SH ERRORS The \fBftp_chdir\fP() function fails if: .TP .B ECONNRESET The server shut down the connection. The caller is then responsible for calling \fBftp_quit\fP() with the \fBFTP_QUIT_FAST\fP flag set. .TP .B ETIMEDOUT The operation timed out. (The timeout interval can be set via the \fBFTP_OPT_IO_TIMEOUT\fP option; see the \fBftp_set_options\fP(3) man page for details.) .TP .B EINVAL Unexpected response code received from server. .TP .B EAGAIN An attempt was made to send a request to the server while the data connection is open. .TP .B EACCES The user lacks permission to change to the specified directory. .TP .B ENOENT The path specified by \fIdir\fP does not exist (but see \fBNOTES\fP below). .TP .B ENOTDIR The path specified by \fIdir\fP is not a directory (but see \fBNOTES\fP below). .PP It may also fail for any of the errors specified for the underlying \fBpoll\fP(2), \fBread\fP(2), or \fBwrite\fP(2) system calls. .SH NOTES Due to limitations in the FTP protocol, the \fBftp_chdir\fP() function cannot always tell why a CWD operation has failed. In some cases, it may set \fIerrno\fP to \fIENOENT\fP, even though the failure may be more accurately described by \fIENOTDIR\fP. .SH SEE ALSO .BR libfget (3), .BR chdir (2)