summaryrefslogtreecommitdiffstats
path: root/g10
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>1998-11-27 12:42:49 +0100
committerWerner Koch <wk@gnupg.org>1998-11-27 12:42:49 +0100
commita7d13c0d80dafb2530531defa9ba993a92148f3c (patch)
treeb71a9f392b69fe05ee033b3d12628d49c4149125 /g10
parent*** empty log message *** (diff)
downloadgnupg2-a7d13c0d80dafb2530531defa9ba993a92148f3c.tar.xz
gnupg2-a7d13c0d80dafb2530531defa9ba993a92148f3c.zip
See ChangeLog: Fri Nov 27 12:39:29 CET 1998 Werner Koch
Diffstat (limited to 'g10')
-rw-r--r--g10/ChangeLog7
-rw-r--r--g10/Makefile.am3
-rw-r--r--g10/delkey.c6
-rw-r--r--g10/helptext.c214
-rw-r--r--g10/keyedit.c16
-rw-r--r--g10/keygen.c22
-rw-r--r--g10/main.h3
-rw-r--r--g10/openfile.c2
-rw-r--r--g10/passphrase.c4
-rw-r--r--g10/pkclist.c10
-rw-r--r--g10/plaintext.c4
-rw-r--r--g10/revoke.c2
-rw-r--r--g10/status.c31
13 files changed, 262 insertions, 62 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog
index 8e0cc8574..c4e5da1ec 100644
--- a/g10/ChangeLog
+++ b/g10/ChangeLog
@@ -1,3 +1,10 @@
+Fri Nov 27 12:39:29 CET 1998 Werner Koch <wk@isil.d.shuttle.de>
+
+
+ * status.c (display_help): Removed.
+ * helptext.c: New and removed the N_() from all cpr_gets.
+
+
Fri Nov 20 16:54:52 1998 Werner Koch (wk@isil.d.shuttle.de)
* g10.c (main): New option --not-dash-escaped
diff --git a/g10/Makefile.am b/g10/Makefile.am
index 02e3ee525..5920365af 100644
--- a/g10/Makefile.am
+++ b/g10/Makefile.am
@@ -55,7 +55,8 @@ common_source = \
revoke.c \
keylist.c \
sig-check.c \
- signal.c
+ signal.c \
+ helptext.c
gpg_SOURCES = g10.c \
$(common_source) \
diff --git a/g10/delkey.c b/g10/delkey.c
index b84a8bfd7..08648b84b 100644
--- a/g10/delkey.c
+++ b/g10/delkey.c
@@ -128,8 +128,8 @@ delete_key( const char *username, int secret )
m_free(p);
tty_printf("\n\n");
- yes = cpr_get_answer_is_yes( secret? N_("delete_key.secret.okay")
- : N_("delete_key.okay"),
+ yes = cpr_get_answer_is_yes( secret? "delete_key.secret.okay"
+ : "delete_key.okay",
_("Delete this key from the keyring? "));
if( !cpr_enabled() && secret && yes ) {
/* I think it is not required to check a passphrase; if
@@ -137,7 +137,7 @@ delete_key( const char *username, int secret )
* (and has no backup) - it is up him to read some very
* basic texts about security.
*/
- yes = cpr_get_answer_is_yes(N_("delete_key.secret.okay"),
+ yes = cpr_get_answer_is_yes("delete_key.secret.okay",
_("This is a secret key! - really delete? "));
}
if( yes )
diff --git a/g10/helptext.c b/g10/helptext.c
new file mode 100644
index 000000000..6c9b981e0
--- /dev/null
+++ b/g10/helptext.c
@@ -0,0 +1,214 @@
+/* helptext.c - English help texts
+ * Copyright (C) 1998 Free Software Foundation, Inc.
+ *
+ * This file is part of GnuPG.
+ *
+ * GnuPG is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * GnuPG is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#include <config.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "util.h"
+#include "ttyio.h"
+#include "main.h"
+#include "i18n.h"
+
+
+/****************
+ * These helptexts are used for the "online" help feature. We use
+ * a key consisting of words and dots. Because the lookup is only
+ * done in an interactive mode on a user request (when she enters a "?"
+ * as response to a prompt) we can use a simple search through the list.
+ * Translators should use the key as msgid, this is to keep the msgid short
+ * and to allow for easy changing of the helptexts.
+ */
+
+
+static struct helptexts { const char *key; const char *help; } helptexts[] = {
+
+/* begin of list */
+
+{ N_("edit_ownertrust.value"),
+"It's up to you to assign a value here; this value will never be exported\n"
+"to any 3rd party. We need it to implement the web-of-trust; it has nothing\n"
+"to do with the (implicitly created) web-of-certificates."
+},
+
+{ N_("revoked_key.override"),
+"If you want to use this revoked key anyway, answer \"yes\"."
+},
+
+{ N_("untrusted_key.override"),
+"If you want to use this untrusted key anyway, answer \"yes\"."
+},
+
+{ N_("pklist.user_id.enter"),
+"Enter the user id of the addresse to whom you want to send the message."
+},
+
+{ N_("keygen.algo"),
+"Select the algorithm to use.\n"
+"DSA (aka DSS) is the digital signature algorithm which can only be used\n"
+"for signatures. This is the suggested algorithm because verification of\n"
+"DSA signatures are much faster than those of ElGamal\n"
+"ElGamal is a algorithm which can be used for signatures and encryption.\n"
+"OpenPGP distunguishs between two flavors of this algorithms: a encrypt only\n"
+"and a sign+encrypt; actually it is the same, but some parameters must be\n"
+"selected in a special way to create a safe key for signatures: this program\n"
+"does this but other OpenPGP implemenations are not required to understand\n"
+"the signature+encryption flavor.\n"
+"The first (primary) key must always be a key which is capable of signing;\n"
+"this is the reason why the ecrytion only ElGamal key is disabled in this.\n"
+"You should not select the \"ElGamal in a v3 packet\", because that key is\n"
+"not compatible to other OpenPGP implementations."
+},
+
+{ N_("keygen.size"),
+ ""
+},
+
+{ N_("keygen.size.huge.okay"),
+ ""
+},
+
+
+{ N_("keygen.size.large.okay"),
+ ""
+},
+
+
+{ N_("keygen.valid"),
+ ""
+},
+
+{ N_("keygen.valid.okay"),
+ ""
+},
+
+
+{ N_("keygen.name"),
+ ""
+},
+
+
+{ N_("keygen.email"),
+ ""
+},
+
+{ N_("keygen.comment"),
+ ""
+},
+
+
+{ N_("keygen.userid.cmd"),
+ ""
+"N to change the name.\n"
+"C to change the comment.\n"
+"E to change the email address.\n"
+"O to continue with key generation.\n"
+"Q to to quit the key generation."
+},
+
+{ N_("keygen.sub.okay"),
+ "Answer \"yes\" (or just \"y\") if it is okay to generate the sub key."
+},
+
+{ N_("sign_uid.okay"),
+ ""
+},
+
+
+{ N_("change_passwd.empty.okay"),
+ ""
+},
+
+
+{ N_("keyedit.cmd"),
+ "Please enter \"help\" to see the list of commands."
+},
+
+{ N_("keyedit.save.okay"),
+ ""
+},
+
+
+{ N_("keyedit.cancel.okay"),
+ ""
+},
+
+{ N_("keyedit.sign_all.okay"),
+ ""
+},
+
+{ N_("keyedit.remove.uid.okay"),
+ ""
+},
+
+{ N_("keyedit.remove.subkey.okay"),
+ ""
+},
+
+{ N_("passphrase.enter"),
+ ""
+"Please enter the passhrase; this is a secret sentence \n"
+" Blurb, blurb,.... "
+},
+
+
+{ N_("passphrase.repeat"),
+ "Please repeat the last passphrase, so you are sure what you typed in."
+},
+
+{ N_("detached_signature.filename"),
+ ""
+},
+
+{ N_("openfile.overwrite.okay"),
+ ""
+},
+
+/* end of list */
+{ NULL, NULL } };
+
+
+void
+display_online_help( const char *keyword )
+{
+
+ tty_kill_prompt();
+ if( !keyword )
+ tty_printf(_("No help available") );
+ else {
+ const char *p = _(keyword);
+
+ if( strcmp( p, keyword ) )
+ tty_printf("%s", p );
+ else {
+ int i;
+
+ for(i=0; (p=helptexts[i].key) && strcmp( p, keyword ); i++ )
+ ;
+ if( !p || !*helptexts[i].help )
+ tty_printf(_("No help available for '%s'"), keyword );
+ else
+ tty_printf("%s", helptexts[i].help );
+ }
+ }
+ tty_printf("\n");
+}
+
+
diff --git a/g10/keyedit.c b/g10/keyedit.c
index 8ed316793..f940b9e27 100644
--- a/g10/keyedit.c
+++ b/g10/keyedit.c
@@ -279,7 +279,7 @@ sign_uids( KBNODE keyblock, STRLIST locusr, int *ret_modified )
m_free(p); p = NULL;
tty_printf("\"\n\n");
- if( !cpr_get_answer_is_yes(N_("sign_uid.okay"), _("Really sign? ")) )
+ if( !cpr_get_answer_is_yes("sign_uid.okay", _("Really sign? ")) )
continue;;
/* now we can sign the user ids */
reloop: /* (must use this, because we are modifing the list) */
@@ -392,7 +392,7 @@ change_passphrase( KBNODE keyblock )
rc = 0;
tty_printf(_( "You don't want a passphrase -"
" this is probably a *bad* idea!\n\n"));
- if( cpr_get_answer_is_yes(N_("change_passwd.empty.okay"),
+ if( cpr_get_answer_is_yes("change_passwd.empty.okay",
_("Do you really want to do this? ")))
changed++;
break;
@@ -587,7 +587,7 @@ keyedit_menu( const char *username, STRLIST locusr, STRLIST commands )
have_commands = 0;
}
if( !have_commands ) {
- answer = cpr_get(N_("keyedit.cmd"), _("Command> "));
+ answer = cpr_get("keyedit.cmd", _("Command> "));
cpr_kill_prompt();
}
trim_spaces(answer);
@@ -635,10 +635,10 @@ keyedit_menu( const char *username, STRLIST locusr, STRLIST commands )
goto leave;
if( !modified && !sec_modified )
goto leave;
- if( !cpr_get_answer_is_yes(N_("keyedit.save.okay"),
+ if( !cpr_get_answer_is_yes("keyedit.save.okay",
_("Save changes? ")) ) {
if( cpr_enabled()
- || cpr_get_answer_is_yes(N_("keyedit.cancel.okay"),
+ || cpr_get_answer_is_yes("keyedit.cancel.okay",
_("Quit without saving? ")) )
goto leave;
break;
@@ -697,7 +697,7 @@ keyedit_menu( const char *username, STRLIST locusr, STRLIST commands )
case cmdSIGN: /* sign (only the public key) */
if( count_uids(keyblock) > 1 && !count_selected_uids(keyblock) ) {
- if( !cpr_get_answer_is_yes(N_("keyedit.sign_all.okay"),
+ if( !cpr_get_answer_is_yes("keyedit.sign_all.okay",
_("Really sign all user ids? ")) ) {
tty_printf(_("Hint: Select the user ids to sign\n"));
break;
@@ -739,7 +739,7 @@ keyedit_menu( const char *username, STRLIST locusr, STRLIST commands )
else if( count_uids(keyblock) - n1 < 1 )
tty_printf(_("You can't delete the last user id!\n"));
else if( cpr_get_answer_is_yes(
- N_("keyedit.remove.uid.okay"),
+ "keyedit.remove.uid.okay",
n1 > 1? _("Really remove all selected user ids? ")
: _("Really remove this user id? ")
) ) {
@@ -766,7 +766,7 @@ keyedit_menu( const char *username, STRLIST locusr, STRLIST commands )
if( !(n1=count_selected_keys( keyblock )) )
tty_printf(_("You must select at least one key.\n"));
else if( sec_keyblock && !cpr_get_answer_is_yes(
- N_("keyedit.remove.subkey.okay"),
+ "keyedit.remove.subkey.okay",
n1 > 1?
_("Do you really want to delete the selected keys? "):
_("Do you really want to delete this key? ")
diff --git a/g10/keygen.c b/g10/keygen.c
index 34f4d97d1..fc64d496e 100644
--- a/g10/keygen.c
+++ b/g10/keygen.c
@@ -396,7 +396,7 @@ ask_algo( int *ret_v4, int addmode )
*ret_v4 = 1;
for(;;) {
- answer = cpr_get(N_("keygen.algo"),_("Your selection? "));
+ answer = cpr_get("keygen.algo",_("Your selection? "));
cpr_kill_prompt();
algo = *answer? atoi(answer): 1;
m_free(answer);
@@ -440,7 +440,7 @@ ask_keysize( int algo )
" highest suggested keysize is 2048 bits\n"),
pubkey_algo_to_string(algo) );
for(;;) {
- answer = cpr_get(N_("keygen.size"),
+ answer = cpr_get("keygen.size",
_("What keysize do you want? (1024) "));
cpr_kill_prompt();
nbits = *answer? atoi(answer): 1024;
@@ -453,7 +453,7 @@ ask_keysize( int algo )
tty_printf(
_("Keysizes larger than 2048 are not suggested because\n"
"computations take REALLY long!\n"));
- if( cpr_get_answer_is_yes(N_("keygen.size.huge.okay"),_(
+ if( cpr_get_answer_is_yes("keygen.size.huge.okay",_(
"Are you sure that you want this keysize? ")) ) {
tty_printf(_("Okay, but keep in mind that your monitor "
"and keyboard radiation is also very vulnerable "
@@ -462,7 +462,7 @@ ask_keysize( int algo )
}
}
else if( nbits > 1536 && !cpr_enabled() ) {
- if( cpr_get_answer_is_yes(N_("keygen.size.large.okay"),_(
+ if( cpr_get_answer_is_yes("keygen.size.large.okay",_(
"Do you really need such a large keysize? ")) )
break;
}
@@ -504,7 +504,7 @@ ask_expire_interval()
int mult;
m_free(answer);
- answer = cpr_get(N_("keygen.valid"),_("Key is valid for? (0) "));
+ answer = cpr_get("keygen.valid",_("Key is valid for? (0) "));
cpr_kill_prompt();
trim_spaces(answer);
if( !*answer )
@@ -531,7 +531,7 @@ ask_expire_interval()
}
if( !cpr_enabled()
- && cpr_get_answer_is_yes(N_("keygen.valid.okay"),
+ && cpr_get_answer_is_yes("keygen.valid.okay",
_("Is this correct (y/n)? ")) )
break;
}
@@ -585,7 +585,7 @@ ask_user_id( int mode )
if( !aname ) {
for(;;) {
m_free(aname);
- aname = cpr_get(N_("keygen.name"),_("Real name: "));
+ aname = cpr_get("keygen.name",_("Real name: "));
trim_spaces(aname);
cpr_kill_prompt();
if( strpbrk( aname, "<([])>" ) )
@@ -601,7 +601,7 @@ ask_user_id( int mode )
if( !amail ) {
for(;;) {
m_free(amail);
- amail = cpr_get(N_("keygen.email"),_("Email address: "));
+ amail = cpr_get("keygen.email",_("Email address: "));
trim_spaces(amail);
strlwr(amail);
cpr_kill_prompt();
@@ -621,7 +621,7 @@ ask_user_id( int mode )
if( !acomment ) {
for(;;) {
m_free(acomment);
- acomment = cpr_get(N_("keygen.comment"),_("Comment: "));
+ acomment = cpr_get("keygen.comment",_("Comment: "));
trim_spaces(acomment);
cpr_kill_prompt();
if( !*acomment )
@@ -659,7 +659,7 @@ ask_user_id( int mode )
answer[1] = 0;
}
else {
- answer = cpr_get(N_("keygen.userid.cmd"),_(
+ answer = cpr_get("keygen.userid.cmd",_(
"Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? "));
cpr_kill_prompt();
}
@@ -997,7 +997,7 @@ generate_subkeypair( KBNODE pub_keyblock, KBNODE sec_keyblock )
assert(algo);
nbits = ask_keysize( algo );
expire = ask_expire_interval();
- if( !cpr_enabled() && !cpr_get_answer_is_yes(N_("keygen.sub.okay"),
+ if( !cpr_enabled() && !cpr_get_answer_is_yes("keygen.sub.okay",
_("Really create? ") ) )
goto leave;
diff --git a/g10/main.h b/g10/main.h
index 746a94dc2..424cc8d9a 100644
--- a/g10/main.h
+++ b/g10/main.h
@@ -56,6 +56,9 @@ u16 checksum_mpi( MPI a );
u16 checksum_mpi_counted_nbits( MPI a );
u32 buffer_to_u32( const byte *buffer );
+/*-- helptext.c --*/
+void display_online_help( const char *keyword );
+
/*-- encode.c --*/
int encode_symmetric( const char *filename );
int encode_store( const char *filename );
diff --git a/g10/openfile.c b/g10/openfile.c
index 0dff81bac..a6d24ed38 100644
--- a/g10/openfile.c
+++ b/g10/openfile.c
@@ -56,7 +56,7 @@ overwrite_filep( const char *fname )
return 0; /* do not overwrite */
tty_printf(_("File '%s' exists. "), fname);
- if( cpr_get_answer_is_yes(N_("openfile.overwrite.okay"),
+ if( cpr_get_answer_is_yes("openfile.overwrite.okay",
_("Overwrite (y/N)? ")) )
return 1;
return 0;
diff --git a/g10/passphrase.c b/g10/passphrase.c
index a6901b114..6a85f8a6a 100644
--- a/g10/passphrase.c
+++ b/g10/passphrase.c
@@ -171,10 +171,10 @@ passphrase_to_dek( u32 *keyid, int cipher_algo, STRING2KEY *s2k, int mode )
else if( opt.batch )
log_fatal("Can't query password in batchmode\n");
else {
- pw = cpr_get_hidden(N_("passphrase.enter"), _("Enter passphrase: ") );
+ pw = cpr_get_hidden("passphrase.enter", _("Enter passphrase: ") );
tty_kill_prompt();
if( mode == 2 && !cpr_enabled() ) {
- char *pw2 = cpr_get_hidden(N_("passphrase.repeat"),
+ char *pw2 = cpr_get_hidden("passphrase.repeat",
_("Repeat passphrase: ") );
tty_kill_prompt();
if( strcmp(pw, pw2) ) {
diff --git a/g10/pkclist.c b/g10/pkclist.c
index d313b8be4..b117dcc1e 100644
--- a/g10/pkclist.c
+++ b/g10/pkclist.c
@@ -146,7 +146,7 @@ edit_ownertrust( ulong lid, int mode )
if( strlen(ans) != 4 )
BUG();
- p = cpr_get(N_("edit_ownertrust.value"),_("Your decision? "));
+ p = cpr_get("edit_ownertrust.value",_("Your decision? "));
trim_spaces(p);
cpr_kill_prompt();
if( *p && p[1] )
@@ -240,7 +240,7 @@ do_we_trust( PKT_public_key *pk, int trustlevel )
if( opt.batch )
return 0;
- if( !cpr_get_answer_is_yes(N_("revoked_key.override"),
+ if( !cpr_get_answer_is_yes("revoked_key.override",
_("Use this key anyway? ")) )
return 0;
}
@@ -331,8 +331,8 @@ do_we_trust_pre( PKT_public_key *pk, int trustlevel )
"If you *really* know what you are doing, you may answer\n"
"the next question with yes\n\n") );
- if( cpr_get_answer_is_yes(N_("untrusted_key.override"),
- _("Use this key anyway? ")) )
+ if( cpr_get_answer_is_yes("untrusted_key.override",
+ _("Use this key anyway? ")) )
rc = 1;
}
else if( opt.always_trust && !rc ) {
@@ -478,7 +478,7 @@ build_pk_list( STRLIST remusr, PK_LIST *ret_pk_list, unsigned usage )
for(;;) {
rc = 0;
m_free(answer);
- answer = cpr_get_utf8(N_("pklist.user_id.enter"),
+ answer = cpr_get_utf8("pklist.user_id.enter",
_("Enter the user ID: "));
trim_spaces(answer);
cpr_kill_prompt();
diff --git a/g10/plaintext.c b/g10/plaintext.c
index a133f1670..7eda8df9d 100644
--- a/g10/plaintext.c
+++ b/g10/plaintext.c
@@ -211,8 +211,8 @@ ask_for_detached_datafile( md_filter_context_t *mfx, const char *inname )
tty_printf("Detached signature.\n");
do {
m_free(answer);
- answer = cpr_get(N_("detached_signature.filename"),
- _("Please enter name of data file: "));
+ answer = cpr_get("detached_signature.filename",
+ _("Please enter name of data file: "));
cpr_kill_prompt();
if( any && !*answer ) {
rc = G10ERR_READ_FILE;
diff --git a/g10/revoke.c b/g10/revoke.c
index 3d1eb4403..2491ee023 100644
--- a/g10/revoke.c
+++ b/g10/revoke.c
@@ -117,7 +117,7 @@ gen_revoke( const char *uname )
}
tty_printf("\n");
- if( !cpr_get_answer_is_yes(N_("gen_revoke.okay"),
+ if( !cpr_get_answer_is_yes("gen_revoke.okay",
_("Create a revocation certificate for this key? ")) ){
rc = 0;
goto leave;
diff --git a/g10/status.c b/g10/status.c
index 3fcf22b67..3b9e197b8 100644
--- a/g10/status.c
+++ b/g10/status.c
@@ -235,31 +235,6 @@ do_shm_get( const char *keyword, int hidden, int bool )
#endif /* USE_SHM_COPROCESSING */
-static void
-display_help( const char *keyword )
-{
- const char *p;
- int hint = 0;
-
- tty_kill_prompt();
- if( !keyword ) {
- tty_printf(_("No help available") );
- hint++;
- }
- else {
- p = _(keyword);
- if( !strcmp( p, keyword ) ) {
- tty_printf(_("No help available for '%s'"), keyword );
- hint++;
- }
- else
- tty_printf("%s", p );
- }
- tty_printf("\n");
- if( hint )
- tty_printf("You should set your LANG variable to a valid value.\n"
- "Set LANG to \"en\" to see the English help texts.\n" );
-}
int
@@ -285,7 +260,7 @@ cpr_get( const char *keyword, const char *prompt )
p = tty_get( prompt );
if( *p == '?' && !p[1] ) {
m_free(p);
- display_help( keyword );
+ display_online_help( keyword );
}
else
return p;
@@ -318,7 +293,7 @@ cpr_get_hidden( const char *keyword, const char *prompt )
p = tty_get_hidden( prompt );
if( *p == '?' && !p[1] ) {
m_free(p);
- display_help( keyword );
+ display_online_help( keyword );
}
else
return p;
@@ -350,7 +325,7 @@ cpr_get_answer_is_yes( const char *keyword, const char *prompt )
trim_spaces(p); /* it is okay to do this here */
if( *p == '?' && !p[1] ) {
m_free(p);
- display_help( keyword );
+ display_online_help( keyword );
}
else {
tty_kill_prompt();