/*
 * Copyright (c) 2005 Sendmail, Inc. and its suppliers.
 *	All rights reserved.
 *
 * By using this file, you agree to the terms and conditions set
 * forth in the LICENSE file which can be found at the top level of
 * the sendmail distribution.
 */

#include "sm/generic.h"
SM_RCSID("@(#)$Id: t-pmilter.c,v 1.6 2007/02/13 03:58:18 ca Exp $")
#include "sm/error.h"
#include "sm/assert.h"
#include "sm/types.h"
#include "t-pmilter.h"

#if MTA_USE_PMILTER

/*
**  SM_GETSTAGE -- translate stage char into array index
**
**	Parameters:
**		arg -- stage (textual description)
**
**	Returns:
**		>=0: stage
**		<0 on error
*/

int
sm_getstage(char arg)
{
	int stage;

	switch (optarg[0])
	{
	  case 'c':
		stage = SM_STAGE_NSEID;
		break;
	  case 'h':
	  case 'e':
		stage = SM_STAGE_HELO;
		break;
	  case 'm':
		stage = SM_STAGE_MAIL;
		break;
	  case 'r':
		stage = SM_STAGE_RCPT;
		break;
	  case 'D':
		stage = SM_STAGE_RSAD;
		break;
	  case 'd':
		stage = SM_STAGE_DATA;
		break;
	  case 'B':
		stage = SM_STAGE_MSG;
		break;
	  case 'b':
		stage = SM_STAGE_DOT;
		break;
	  case 'R':
		stage = SM_STAGE_RPLC_MSG;
		break;
	  default:
		stage = -1;
		break;
	}
	return stage;
}

#endif /* MTA_USE_PMILTER */


syntax highlighted by Code2HTML, v. 0.9.1