Updated the german translation
[gnupg.git] / g10 / helptext.c
blobbf818fa43ccc32295e527133c7726b9c95b07803
1 /* helptext.c - English help texts
2 * Copyright (C) 1998, 1999, 2000, 2001, 2002,
3 * 2004, 2007 Free Software Foundation, Inc.
5 * This file is part of GnuPG.
7 * GnuPG is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
12 * GnuPG is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, see <http://www.gnu.org/licenses/>.
21 #include <config.h>
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <string.h>
26 #include "gpg.h"
27 #include "util.h"
28 #include "ttyio.h"
29 #include "main.h"
30 #include "i18n.h"
35 /* Helper to get the help through the configurable GnuPG help
36 system. */
37 static char *
38 get_help_from_file (const char *keyword)
40 char *key, *result;
42 key = xtrymalloc (4 + strlen (keyword) + 1);
43 if (key)
45 strcpy (stpcpy (key, "gpg."), keyword);
46 result = gnupg_get_help_string (key, 0);
47 xfree (key);
48 if (result && !is_native_utf8 ())
50 char *tmp = utf8_to_native (result, strlen (result), -1);
51 if (tmp)
53 xfree (result);
54 result = tmp;
58 else
59 result = NULL;
60 return result;
64 void
65 display_online_help( const char *keyword )
67 char *result;
68 int need_final_lf = 1;
70 tty_kill_prompt();
71 if ( !keyword )
72 tty_printf (_("No help available") );
73 else if ( (result = get_help_from_file (keyword)) )
75 tty_printf ("%s", result);
76 if (*result && result[strlen (result)-1] == '\n')
77 need_final_lf = 0;
78 xfree (result);
80 else
82 tty_printf (_("No help available for `%s'"), keyword );
84 if (need_final_lf)
85 tty_printf("\n");