diff options
author | David Shaw <[email protected]> | 2007-11-28 15:09:52 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2007-11-28 15:09:52 +0000 |
commit | c756a493c934353395dbb3c0bec90d15a158aed7 (patch) | |
tree | 0a76d6a4d255b988b8b80b7a4d98fdbbfe3d98af | |
parent | Grammar fix (diff) | |
download | gnupg-c756a493c934353395dbb3c0bec90d15a158aed7.tar.gz gnupg-c756a493c934353395dbb3c0bec90d15a158aed7.zip |
* gpg.c (print_algo_names): New. (list_config): Use it here for the
"ciphername" and "digestname" config items so we can get a
script-parseable list of the names.
-rw-r--r-- | g10/ChangeLog | 6 | ||||
-rw-r--r-- | g10/gpg.c | 36 |
2 files changed, 41 insertions, 1 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog index cc736d2ab..1c1d3de51 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,9 @@ +2007-11-28 David Shaw <[email protected]> + + * gpg.c (print_algo_names): New. + (list_config): Use it here for the "ciphername" and "digestname" + config items so we can get a script-parseable list of the names. + 2007-11-19 Werner Koch <[email protected]> * keyedit.c (keyedit_menu): String grammar fix. @@ -1324,7 +1324,6 @@ check_permissions(const char *path,int item) return 0; } - static void print_algo_numbers(int (*checker)(int)) { @@ -1343,6 +1342,23 @@ print_algo_numbers(int (*checker)(int)) } } +static void +print_algo_names(int (*checker)(int),const char *(*mapper)(int)) +{ + int i,first=1; + + for(i=0;i<=110;i++) + { + if(!checker(i)) + { + if(first) + first=0; + else + printf(";"); + printf("%s",mapper(i)); + } + } +} /* In the future, we can do all sorts of interesting configuration output here. For now, just give "group" as the Enigmail folks need @@ -1410,6 +1426,14 @@ list_config(char *items) any=1; } + if(show_all || ascii_strcasecmp(name,"ciphername")==0) + { + printf("cfg:ciphername:"); + print_algo_names(check_cipher_algo,cipher_algo_to_string); + printf("\n"); + any=1; + } + if(show_all || ascii_strcasecmp(name,"digest")==0 || ascii_strcasecmp(name,"hash")==0) @@ -1420,6 +1444,16 @@ list_config(char *items) any=1; } + if(show_all + || ascii_strcasecmp(name,"digestname")==0 + || ascii_strcasecmp(name,"hashname")==0) + { + printf("cfg:digestname:"); + print_algo_names(check_digest_algo,digest_algo_to_string); + printf("\n"); + any=1; + } + if(show_all || ascii_strcasecmp(name,"compress")==0) { printf("cfg:compress:"); |