doveadm-cmd.c revision 14af7be4aa26d55c341cd6efe32bb2add2c39830
/* Copyright (c) 2009-2016 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "istream.h"
#include "str.h"
#include "doveadm-cmd.h"
#include "doveadm.h"
#include <stdio.h>
#include <unistd.h>
#include <getopt.h>
static struct doveadm_cmd *doveadm_commands[] = {
};
static struct doveadm_cmd_ver2 *doveadm_commands_ver2[] = {
};
{
}
{
else i_unreached();
}
}
{
int i;
const struct doveadm_cmd_ver2 *cmd;
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 */
}
return NULL;
}
static const struct doveadm_cmd *
{
const struct doveadm_cmd *subcmd;
unsigned int len;
if (argc < 2)
return NULL;
return NULL;
/* more args */
return NULL;
} else {
return NULL;
}
return cmd;
}
const struct doveadm_cmd *
{
unsigned int cmd_name_len;
return cmd;
/* see if it matches a multi-word command */
return subcmd;
}
}
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*
{
for(int i = 0; i < argc; i++) {
return &(params[i]);
}
return NULL;
}
bool doveadm_cmd_param_bool(int argc, const struct doveadm_cmd_param* params, const char *name, bool* value)
{
const struct doveadm_cmd_param* param;
return TRUE;
}
return FALSE;
}
bool doveadm_cmd_param_int64(int argc, const struct doveadm_cmd_param* params, const char *name, int64_t* value)
{
const struct doveadm_cmd_param* param;
return TRUE;
}
return FALSE;
}
bool doveadm_cmd_param_str(int argc, const struct doveadm_cmd_param* params, const char *name, const char** value)
{
const struct doveadm_cmd_param* param;
return TRUE;
}
return FALSE;
}
bool doveadm_cmd_param_array(int argc, struct doveadm_cmd_param* params, const char *name, ARRAY_TYPE(const_string)** value)
{
const struct doveadm_cmd_param* param;
return TRUE;
}
return FALSE;
}
bool doveadm_cmd_param_istream(int argc, struct doveadm_cmd_param* params, const char *name, struct istream** value)
{
const struct doveadm_cmd_param* param;
return TRUE;
}
return FALSE;
}
static void
{
int i;
const char * const * cptr;
for(i=0;i<pargc;i++) {
}
}
} else {
}
}
}
}
int
{
unsigned int pargc;
const char **pargv;
return 0;
}
static void
{
const char *optp;
optp++;
if (optp[0] != '\0')
}
switch(*optp) {
default:
}
} else {
}
}
}
{
case CMD_PARAM_NONE:
case CMD_PARAM_BOOL:
case CMD_PARAM_INT64:
}
break;
case CMD_PARAM_STR:
} else {
}
break;
case CMD_PARAM_ARRAY:
break;
case CMD_PARAM_ISTREAM: {
} else {
}
}
}
}
{
const struct doveadm_cmd_ver2 *cmd;
return FALSE;
return TRUE;
}
{
struct doveadm_cmd_param *param;
const char *cptr;
unsigned int pargc;
int c,li;
// build parameters
}
switch(c) {
case 0:
break;
case '?':
case ':':
return -1;
default:
// hunt the option
for(unsigned int i = 0; i < pargc; i++) {
}
}
}
/* process positional arguments */
struct doveadm_cmd_param *ptr;
break;
}
}
if (!found) {
i_error("Extraneous arguments found");
return -1;
}
}
// FIXME: Unsure what do to with return value
// unref istreams
}
return 0;
}