1 /*
2 * h_lang.c
3 * (C)1999-2011 by Marc Huber <Marc.Huber@web.de>
4 *
5 * $Id: h_lang.c,v 1.10 2015/03/14 06:11:25 marc Exp marc $
6 *
7 */
8
9 #include "headers.h"
10
11 static const char rcsid[] __attribute__ ((used)) = "$Id: h_lang.c,v 1.10 2015/03/14 06:11:25 marc Exp marc $";
12
h_lang(struct context * ctx,char * arg)13 void h_lang(struct context *ctx, char *arg)
14 {
15 char *t, **l;
16 int i;
17
18 DebugIn(DEBUG_PROC);
19
20 if (!arg)
21 arg = "EN";
22 else if ((t = strchr(arg, '-')))
23 *t = 0;
24
25 for (l = lang, i = 0; *l && strcasecmp(arg, *l); l++, i++);
26
27 if (*l) {
28 ctx->lang = i;
29 replyf(ctx, MSG_200_Language_set, *l);
30 } else
31 replyf(ctx, MSG_501_Language_not_supported, arg);
32
33 DebugOut(DEBUG_PROC);
34 }
35