/* Copyright (c) 2009-2r016 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "istream.h"
#include "str.h"
#include "net.h"
#include "doveadm.h"
#include "doveadm-cmd.h"
#include <stdio.h>
#include <unistd.h>
#include <getopt.h>
};
};
static const struct exit_code_str {
int code;
const char *str;
} exit_code_strings[] = {
{ DOVEADM_EX_UNKNOWN, "UNKNOWN" },
{ EX_TEMPFAIL, "TEMPFAIL" },
{ EX_USAGE, "USAGE" },
{ EX_NOUSER, "NOUSER" },
{ EX_NOPERM, "NOPERM" },
{ EX_PROTOCOL, "PROTOCOL" },
{ EX_DATAERR, "DATAERR" },
{ DOVEADM_EX_NOTFOUND, "NOTFOUND" }
};
{
}
return "UNKNOWN";
}
{
}
return DOVEADM_EX_UNKNOWN;
}
{
}
{
else i_unreached();
}
}
{
return cmd;
}
return NULL;
}
const struct doveadm_cmd_ver2 *
const char *const *argv[])
{
int i, k;
const char *cptr;
for(i=0;i<*argc;i++) {
}
/* cannot reuse i here because this needs be
done more than once */
/* make sure we don't overstep */
/* did not match */
/* do not accept abbreviations */
}
/* name was fully consumed */
if (*cptr == '\0') {
if (k > 1) {
*argc -= k-1;
*argv += k-1;
}
return cmd;
}
}
return NULL;
}
static bool
const char *const *_argv[])
{
if (argc < 2)
return FALSE;
return FALSE;
/* more args */
return FALSE;
} else {
return FALSE;
}
return TRUE;
}
const struct doveadm_cmd *
const char *const *argv[])
{
return cmd;
/* see if it matches a multi-word command */
return cmd;
}
}
return NULL;
}
void doveadm_cmds_init(void)
{
unsigned int i;
for (i = 0; i < N_ELEMENTS(doveadm_commands); i++)
for (i = 0; i < N_ELEMENTS(doveadm_commands_ver2); i++)
}
void doveadm_cmds_deinit(void)
{
}
static const struct doveadm_cmd_param*
const char *name)
{
}
return NULL;
}
{
return TRUE;
}
return FALSE;
}
{
return TRUE;
}
return FALSE;
}
{
return TRUE;
}
return FALSE;
}
{
return TRUE;
}
return FALSE;
}
{
unsigned int count;
/* doveadm_cmd_params_null_terminate_arrays() should have been
called, which guarantees that we're NULL-terminated */
return TRUE;
}
return FALSE;
}
{
return TRUE;
}
return FALSE;
}
{
}
}
{
}
}
}
static void
{
bool array_add_opt;
int i;
const char * const * cptr;
for(i=0;i<pargc;i++) {
/* istreams are special */
} else {
}
}
/* CMD_PARAM_BOOL is implicitly handled above */
if (array_add_opt)
}
}
}
}
if (array_count(&pargv) > 0) {
}
}
void
{
unsigned int pargc;
const char **pargv;
}
static void
{
}
}
}
{
case CMD_PARAM_BOOL:
case CMD_PARAM_INT64:
}
break;
case CMD_PARAM_IP:
}
break;
case CMD_PARAM_STR:
break;
case CMD_PARAM_ARRAY:
break;
case CMD_PARAM_ISTREAM: {
} else {
}
}
}
}
struct doveadm_cmd_context *cctx)
{
return FALSE;
return TRUE;
}
struct doveadm_cmd_context *cctx)
{
unsigned int pargc;
int c,li;
// build parameters
}
switch(c) {
case 0:
for(unsigned int i = 0; i < array_count(&pargv); i++) {
}
break;
case '?':
case ':':
return -1;
default:
// hunt the option
for(unsigned int i = 0; i < pargc; i++) {
}
}
}
/* process positional arguments */
break;
}
}
if (!found) {
i_error("Extraneous arguments found: %s",
return -1;
}
}
return 0;
}