* g10.c (main): Use 3DES instead of CAST5 if we don't have CAST5 support.
[gnupg.git] / g10 / keyserver.c
index b80e691..ed7883d 100644 (file)
@@ -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)
@@ -609,15 +624,19 @@ keyserver_search_prompt(IOBUF buffer,const char *searchstr)
        {
          desc[i]=keyrec->desc;
 
-         if(numlines+keyrec->lines>maxlines)
+         if(!opt.with_colons)
            {
-             if(show_prompt(desc,i,validcount?count:0,searchstr))
-               break;
-             else
-               numlines=0;
+             if(numlines+keyrec->lines>maxlines)
+               {
+                 if(show_prompt(desc,i,validcount?count:0,searchstr))
+                   break;
+                 else
+                   numlines=0;
+               }
+
+             print_keyrec(i+1,keyrec);
            }
 
-         print_keyrec(i+1,keyrec);
          numlines+=keyrec->lines;
          iobuf_close(keyrec->uidbuf);
          m_free(keyrec);
@@ -1244,17 +1263,23 @@ keyserver_refresh(STRLIST users)
   if(rc)
     return rc;
 
-  if(count==1)
-    log_info(_("refreshing 1 key from %s\n"),opt.keyserver_uri);
-  else
-    log_info(_("refreshing %d keys from %s\n"),count,opt.keyserver_uri);
-
   if(count>0)
-    rc=keyserver_work(GET,NULL,desc,count);
+    {
+      if(opt.keyserver_uri)
+       {
+         if(count==1)
+           log_info(_("refreshing 1 key from %s\n"),opt.keyserver_uri);
+         else
+           log_info(_("refreshing %d keys from %s\n"),
+                    count,opt.keyserver_uri);
+       }
+
+      rc=keyserver_work(GET,NULL,desc,count);
+    }
 
   m_free(desc);
 
-  return 0;
+  return rc;
 }
 
 int