Added missing file (again).
[uftps.git] / change_dir.c
blobbc2252281762306e9e4430b7dc00fd83e2431cba
1 /*
2 * User FTP Server, Share folders over FTP without being root.
3 * Copyright (C) 2008 Isaac Jurado
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 2 of the License, or (at your option) any later
8 * version.
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
20 #include "uftps.h"
21 #include <stddef.h>
24 void change_dir (void)
26 int len;
28 if (SS.arg == NULL)
30 reply_c("501 Argument required.\r\n");
31 return;
34 len = apply_path(SS.arg, SS.cwd, SS.cwd_len);
35 if (len == -1)
37 reply_c("552 Path overflow.\r\n");
38 fatal("Path overflow in CWD");
41 SS.cwd_len = len;
42 reply_c("250 Directory changed.\r\n");
43 debug("Directory changed to '%s'", SS.cwd);