int args_excert(char ***pargs, int *pargc,
			int *badarg, BIO *err, SSL_EXCERT **pexc)
	{
	char *arg = **pargs, *argn = (*pargs)[1];
	SSL_EXCERT *exc = *pexc;
	int narg = 2;
	if (!exc)
		{
		if (ssl_excert_prepend(&exc))
			*pexc = exc;
		else
			{
			BIO_printf(err, "Error initialising xcert\n");
			*badarg = 1;
			goto err;
			}
		}
	if (strcmp(arg, "-xcert") == 0)
		{
		if (!argn)
			{
			*badarg = 1;
			return 1;
			}
		if (exc->certfile && !ssl_excert_prepend(&exc))
			{
			BIO_printf(err, "Error adding xcert\n");
			*badarg = 1;
			goto err;
			}
		exc->certfile = argn;
		}
	else if (strcmp(arg,"-xkey") == 0)
		{
		if (!argn)
			{
			*badarg = 1;
			return 1;
			}
		if (exc->keyfile)
			{
			BIO_printf(err, "Key already specified\n");
			*badarg = 1;
			return 1;
			}
		exc->keyfile = argn;
		}
	else if (strcmp(arg,"-xchain") == 0)
		{
		if (!argn)
			{
			*badarg = 1;
			return 1;
			}
		if (exc->chainfile)
			{
			BIO_printf(err, "Chain already specified\n");
			*badarg = 1;
			return 1;
			}
		exc->chainfile = argn;
		}
	else if (strcmp(arg,"-xchain_build") == 0)
		{
		narg = 1;
		exc->build_chain = 1;
		}
	else if (strcmp(arg,"-xcertform") == 0)
		{
		if (!argn)
			{
			*badarg = 1;
			goto err;
			}
		exc->certform = str2fmt(argn);
		}
	else if (strcmp(arg,"-xkeyform") == 0)
		{
		if (!argn)
			{
			*badarg = 1;
			goto err;
			}
		exc->keyform = str2fmt(argn);
		}
	else
		return 0;

	(*pargs) += narg;

	if (pargc)
		*pargc -= narg;

	*pexc = exc;

	return 1;

	err:
	ERR_print_errors(err);
	ssl_excert_free(exc);
	*pexc = NULL;
	return 1;
	}
int args_excert(char ***pargs, int *pargc,
			int *badarg, BIO *err, SSL_EXCERT **pexc)
	{
	char *arg = **pargs, *argn = (*pargs)[1];
	SSL_EXCERT *exc = *pexc;
	int narg = 2;
	if (!exc)
		{
		if (ssl_excert_prepend(&exc))
			*pexc = exc;
		else
			{
			BIO_printf(err, "Error initialising xcert\n");
			*badarg = 1;
			goto err;
			}
		}
	if (strcmp(arg, "-xcert") == 0)
		{
		if (!argn)
			{
			*badarg = 1;
			return 1;
			}
		if (exc->certfile && !ssl_excert_prepend(&exc))
			{
			BIO_printf(err, "Error adding xcert\n");
			*badarg = 1;
			goto err;
			}
		exc->certfile = argn;
		}
	else if (strcmp(arg,"-xkey") == 0)
		{
		if (!argn)
			{
			*badarg = 1;
			return 1;
			}
		if (exc->keyfile)
			{
			BIO_printf(err, "Key already specified\n");
			*badarg = 1;
			return 1;
			}
		exc->keyfile = argn;
		}
	else if (strcmp(arg,"-xchain") == 0)
		{
		if (!argn)
			{
			*badarg = 1;
			return 1;
			}
		if (exc->chainfile)
			{
			BIO_printf(err, "Chain already specified\n");
			*badarg = 1;
			return 1;
			}
		exc->chainfile = argn;
		}
	else if (strcmp(arg,"-xchain_build") == 0)
		{
		narg = 1;
		exc->build_chain = 1;
		}
	else if (strcmp(arg,"-xcertform") == 0)
		{
		if (!argn)
			{
			*badarg = 1;
			goto err;
			}
		exc->certform = str2fmt(argn);
		}
	else if (strcmp(arg,"-xkeyform") == 0)
		{
		if (!argn)
			{
			*badarg = 1;
			goto err;
			}
		exc->keyform = str2fmt(argn);
		}
	else
		return 0;

	(*pargs) += narg;

	if (pargc)
		*pargc -= narg;

	*pexc = exc;

	return 1;

	err:
	ERR_print_errors(err);
	ssl_excert_free(exc);
	*pexc = NULL;
	return 1;
	}