diff options
-rw-r--r-- | g10/ChangeLog | 10 | ||||
-rw-r--r-- | g10/g10.c | 26 | ||||
-rw-r--r-- | g10/keyedit.c | 12 | ||||
-rw-r--r-- | g10/keyserver.c | 9 | ||||
-rw-r--r-- | g10/mainproc.c | 2 | ||||
-rw-r--r-- | g10/options.h | 2 |
6 files changed, 45 insertions, 16 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog index 8aebfadff..d1577516e 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,13 @@ +2004-01-23 David Shaw <dshaw@jabberwocky.com> + + * mainproc.c (list_node): Show sigs with --verbose. + + * options.h, g10.c (set_screen_dimensions): New function to look + at COLUMNS and LINES. + + * keyserver.c (parse_keyrec, keyserver_search_prompt), keyedit.c + (print_and_check_one_sig): Use new screen dimension variables. + 2004-01-21 David Shaw <dshaw@jabberwocky.com> * g10.c (list_config): New function to dump config options to @@ -870,6 +870,31 @@ set_homedir (char *dir) } +/* We set the screen dimensions for UI purposes. Do not allow screens + smaller than 80x24 for the sake of simplicity. */ +static void +set_screen_dimensions(void) +{ +#ifndef _WIN32 + char *str; + + str=getenv("COLUMNS"); + if(str) + opt.screen_columns=atoi(str); + + str=getenv("LINES"); + if(str) + opt.screen_lines=atoi(str); +#endif + + if(opt.screen_columns<80 || opt.screen_columns>255) + opt.screen_columns=80; + + if(opt.screen_lines<24 || opt.screen_lines>255) + opt.screen_lines=24; +} + + static void set_cmd( enum cmd_and_opt_values *ret_cmd, enum cmd_and_opt_values new_cmd ) { @@ -1366,6 +1391,7 @@ main( int argc, char **argv ) VERIFY_SHOW_POLICY_URLS|VERIFY_SHOW_NOTATIONS|VERIFY_SHOW_KEYSERVER_URLS; opt.trust_model=TM_AUTO; opt.mangle_dos_filenames = 0; + set_screen_dimensions(); #if defined (_WIN32) set_homedir ( read_w32_registry_string( NULL, "Software\\GNU\\GnuPG", "HomeDir" )); diff --git a/g10/keyedit.c b/g10/keyedit.c index 50383b9e3..21607737b 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -71,7 +71,6 @@ static int enable_disable_key( KBNODE keyblock, int disable ); static void menu_showphoto( KBNODE keyblock ); static int update_trust=0; -static int columns=80; #define CONTROL_D ('D' - 'A' + 1) @@ -165,7 +164,7 @@ print_and_check_one_sig( KBNODE keyblock, KBNODE node, else { size_t n; char *p = get_user_id( sig->keyid, &n ); - tty_print_utf8_string2( p, n, columns-37 ); + tty_print_utf8_string2( p, n, opt.screen_columns-37 ); m_free(p); } tty_printf("\n"); @@ -1189,15 +1188,6 @@ keyedit_menu( const char *username, STRLIST locusr, STRLIST commands, goto leave; } -#ifndef _WIN32 - if(getenv("COLUMNS")) - { - columns=atoi(getenv("COLUMNS")); - if(columns<80 || columns>255) - columns=80; - } -#endif - if( sign_mode ) { commands = NULL; append_to_strlist( &commands, sign_mode == 1? "sign": diff --git a/g10/keyserver.c b/g10/keyserver.c index 3c8a769d2..63287042c 100644 --- a/g10/keyserver.c +++ b/g10/keyserver.c @@ -532,6 +532,8 @@ parse_keyrec(char *keystring) does this for us. */ decoded=utf8_to_native(userid,i,0); + if(strlen(decoded)>opt.screen_columns-10) + decoded[opt.screen_columns-10]='\0'; iobuf_writestr(work->uidbuf,decoded); m_free(decoded); iobuf_writestr(work->uidbuf,"\n\t"); @@ -595,12 +597,10 @@ show_prompt(KEYDB_SEARCH_DESC *desc,int numdesc,int count,const char *search) static void keyserver_search_prompt(IOBUF buffer,const char *searchstr) { - int i=0,validcount=0,started=0,header=0,count=1; + int i=0,validcount=0,started=0,header=0,count=1,numlines=0; unsigned int maxlen,buflen; KEYDB_SEARCH_DESC *desc; byte *line=NULL; - /* TODO: Something other than 23? That's 24-1 (the prompt). */ - int maxlines=23,numlines=0; desc=m_alloc(count*sizeof(KEYDB_SEARCH_DESC)); @@ -707,7 +707,8 @@ keyserver_search_prompt(IOBUF buffer,const char *searchstr) if(!opt.with_colons) { - if(numlines+keyrec->lines>maxlines) + /* screen_lines - 1 for the prompt. */ + if(numlines+keyrec->lines>opt.screen_lines-1) { if(show_prompt(desc,i,validcount?count:0,searchstr)) break; diff --git a/g10/mainproc.c b/g10/mainproc.c index 8fe45c544..4062ab95a 100644 --- a/g10/mainproc.c +++ b/g10/mainproc.c @@ -1005,7 +1005,7 @@ list_node( CTX c, KBNODE node ) char *p; int sigrc = ' '; - if( !opt.list_sigs ) + if( !opt.verbose ) return; if( sig->sig_class == 0x20 || sig->sig_class == 0x30 ) diff --git a/g10/options.h b/g10/options.h index c2af79aef..4698aead5 100644 --- a/g10/options.h +++ b/g10/options.h @@ -183,6 +183,8 @@ struct { int strict; int mangle_dos_filenames; int enable_progress_filter; + int screen_columns; + int screen_lines; #ifdef ENABLE_CARD_SUPPORT const char *ctapi_driver; /* Library to access the ctAPI. */ |