From 47b4b7f5c3f3bb1d45053fc4ac1b2052e29d8e0e Mon Sep 17 00:00:00 2001 From: David Shaw Date: Tue, 5 Nov 2002 04:28:40 +0000 Subject: [PATCH] * keyserver.c (keyserver_search_prompt): When --with-colons is enabled, just dump the raw keyserver protocol to stdout and don't print the menu. --- g10/ChangeLog | 7 +++++++ g10/keyserver.c | 23 ++++++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/g10/ChangeLog b/g10/ChangeLog index 2ca40440a..953fc815f 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,5 +1,12 @@ 2002-11-04 David Shaw + * keyserver.c (keyserver_search_prompt): When --with-colons is + enabled, just dump the raw keyserver protocol to stdout and don't + print the menu. + + * keyserver.c (show_prompt): Don't show a prompt when command-fd + is being used. + * trustdb.c (trust_model_string, check_trustdb, update_trustdb, validate_one_keyblock): It's not clear what a trustdb rebuild or check means with a trust model other than "classic" or "openpgp", diff --git a/g10/keyserver.c b/g10/keyserver.c index b80e69148..c8218250a 100644 --- a/g10/keyserver.c +++ b/g10/keyserver.c @@ -472,7 +472,7 @@ show_prompt(KEYDB_SEARCH_DESC *desc,int numdesc,int count,const char *search) { char *answer; - if(count) + if(count && opt.command_fd==-1) { static int from=1; tty_printf("Keys %d-%d of %d for \"%s\". ",from,numdesc,count,search); @@ -514,7 +514,7 @@ 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,count=1; + int i=0,validcount=0,started=0,header=0,count=1; unsigned int maxlen,buflen; KEYDB_SEARCH_DESC *desc; byte *line=NULL; @@ -531,6 +531,21 @@ keyserver_search_prompt(IOBUF buffer,const char *searchstr) maxlen=1024; rl=iobuf_read_line(buffer,&line,&buflen,&maxlen); + if(opt.with_colons) + { + if(!header && ascii_strncasecmp("SEARCH ",line,7)==0 + && ascii_strncasecmp(" BEGIN",&line[strlen(line)-7],6)==0) + { + header=1; + continue; + } + else if(ascii_strncasecmp("SEARCH ",line,7)==0 + && ascii_strncasecmp(" END",&line[strlen(line)-5],4)==0) + continue; + + printf("%s",line); + } + /* Look for an info: line. The only current info: values defined are the version and key count. */ if(!started && rl>0 && ascii_strncasecmp("info:",line,5)==0) @@ -617,7 +632,9 @@ keyserver_search_prompt(IOBUF buffer,const char *searchstr) numlines=0; } - print_keyrec(i+1,keyrec); + + if(!opt.with_colons) + print_keyrec(i+1,keyrec); numlines+=keyrec->lines; iobuf_close(keyrec->uidbuf); m_free(keyrec);