1 /*
2  * h_quit.c
3  *
4  * (C)1998-2011 by Marc Huber <Marc.Huber@web.de>
5  * All rights reserved.
6  *
7  * $Id: h_quit.c,v 1.10 2015/03/14 06:11:26 marc Exp marc $
8  *
9  */
10 
11 #include "headers.h"
12 
13 static const char rcsid[] __attribute__ ((used)) = "$Id: h_quit.c,v 1.10 2015/03/14 06:11:26 marc Exp marc $";
14 
h_quit(struct context * ctx,char * arg)15 void h_quit(struct context *ctx, char *arg __attribute__ ((unused)))
16 {
17     DebugIn(DEBUG_COMMAND);
18     io_clr_cb_i(ctx->io, ctx->cfn);
19     /* ignore pending pasv connections */
20     if (ctx->dfn > -1 && io_get_cb_i(ctx->io, ctx->dfn) == (void *) accept_data)
21 	cleanup_data(ctx, ctx->dfn);
22     if (ctx->dfn > -1)
23 	reply(ctx, MSG_221_Control);
24     file2control(ctx, "221", ctx->goodbye);
25     reply(ctx, MSG_221_Goodbye);
26     DebugOut(DEBUG_COMMAND);
27 }
28