mu/src/mu-cmd-mkdir.c

58 lines
1.4 KiB
C
Raw Normal View History

/*
2010-08-20 20:07:36 +02:00
** Copyright (C) 2008-2010 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
** Free Software Foundation; either version 3, or (at your option) any
** later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software Foundation,
** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**
*/
2010-08-20 20:07:36 +02:00
#include "config.h"
2010-08-20 20:07:36 +02:00
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
2010-08-20 20:07:36 +02:00
#include "mu-maildir.h"
#include "mu-cmd.h"
2010-08-20 20:07:36 +02:00
#include "mu-util.h"
2010-08-20 20:07:36 +02:00
gboolean
mu_cmd_mkdir (MuConfigOptions *opts)
{
int i;
g_return_val_if_fail (opts, FALSE);
g_return_val_if_fail (mu_cmd_equals (opts, "mkdir"), FALSE);
2010-08-20 20:07:36 +02:00
if (!opts->params[1]) {
2010-11-30 08:02:29 +01:00
g_warning (
2010-08-20 20:07:36 +02:00
"usage: mu mkdir [-u,--mode=<mode>] "
2010-11-30 08:02:29 +01:00
"<dir> [more dirs]");
2010-08-20 20:07:36 +02:00
return FALSE;
}
i = 1;
while (opts->params[i]) {
if (!mu_maildir_mkdir (opts->params[i], opts->dirmode,
2010-08-20 20:07:36 +02:00
FALSE))
return FALSE;
++i;
}
2010-08-20 20:07:36 +02:00
return TRUE;
}