+int sftp_cmd_mkdir(struct sftp_command *cmd)
+{
+ char *dir;
+ int result;
+
+
+ if (cmd->nwords < 2) {
+ printf("mkdir: expects a directory\n");
+ return 0;
+ }
+
+ dir = canonify(cmd->words[1]);
+ if (!dir) {
+ printf("%s: %s\n", dir, fxp_error());
+ return 0;
+ }
+
+ result = fxp_mkdir(dir);
+ if (!result) {
+ printf("mkdir %s: %s\n", dir, fxp_error());
+ sfree(dir);
+ return 0;
+ }
+
+ sfree(dir);
+ return 0;
+
+}
+
+int sftp_cmd_rmdir(struct sftp_command *cmd)
+{
+ char *dir;
+ int result;
+
+
+ if (cmd->nwords < 2) {
+ printf("rmdir: expects a directory\n");
+ return 0;
+ }
+
+ dir = canonify(cmd->words[1]);
+ if (!dir) {
+ printf("%s: %s\n", dir, fxp_error());
+ return 0;
+ }
+
+ result = fxp_rmdir(dir);
+ if (!result) {
+ printf("rmdir %s: %s\n", dir, fxp_error());
+ sfree(dir);
+ return 0;
+ }
+
+ sfree(dir);
+ return 0;
+
+}
+
+int sftp_cmd_rm(struct sftp_command *cmd)
+{
+ char *fname;
+ int result;
+
+
+ if (cmd->nwords < 2) {
+ printf("rm: expects a filename\n");
+ return 0;
+ }
+
+ fname = canonify(cmd->words[1]);
+ if (!fname) {
+ printf("%s: %s\n", fname, fxp_error());
+ return 0;
+ }
+
+ result = fxp_rm(fname);
+ if (!result) {
+ printf("rm %s: %s\n", fname, fxp_error());
+ sfree(fname);
+ return 0;
+ }
+
+ sfree(fname);
+ return 0;
+
+}
+
+