# Rewrite an FTP request.
rewriter ftp_request%(command: string, arg: string%)
	%{
	const int is_orig = 1;
	@WRITE@(is_orig, command);
	if ( command->Len() > 0 && arg->Len() > 0 )
		@WRITE@(is_orig, " ");
	@WRITE@(is_orig, arg);
	@WRITE@(is_orig, "\r\n");
	%}

# Rewrite an FTP reply.
rewriter ftp_reply%(code: count, msg: string, cont_resp: bool%)
	%{
	const int is_orig = 0;

	if ( code > 0 )
		{
		@WRITE@(is_orig, fmt("%03d", code));
		if ( cont_resp )
			@WRITE@(is_orig, "-");
		else
			@WRITE@(is_orig, " ");
		}
	@WRITE@(is_orig, msg);
	@WRITE@(is_orig, "\r\n");
	%}
