--- /dev/null
+54a55,56
+> static void procmail_query(char *str);
+> static void procmail_print_email(int item);
+498a501,503
+> if( !strcmp(argv[i], "--procmail-query") )
+> procmail_query(argv[i + 1]);
+> else
+561a567,583
+>
+> static void
+> procmail_print_email(int item)
+> {
+> char emails[MAX_EMAILS][MAX_EMAIL_LEN];
+>
+> split_emailstr(item, emails);
+>
+> if( options_get_int("mutt", "return_all_emails") ) {
+> int i;
+> for(i=0; i<MAX_EMAILS; i++)
+> if( *emails[i] )
+> printf("%s\n", emails[i]);
+> } else
+> printf("%s\n", emails[0]);
+> }
+>
+571c593
+< printf("All items\n");
+---
+> /*printf("All items\n");*/
+580a603,633
+> j++;
+> }
+> free(tmp);
+> }
+> if( !j )
+> printf("Not found\n");
+> }
+>
+> quit_mutt_query();
+> exit(0);
+> }
+>
+> static void
+> procmail_query(char *str)
+> {
+> int i, j;
+> char *tmp;
+>
+> init_mutt_query();
+>
+> if( str == NULL || !strcasecmp(str, "all") ) {
+> /*printf("All items\n");*/
+> for(i = 0; i < items; i++)
+> procmail_print_email(i);
+> } else {
+> for(i = 0, j = 0 ; i < items; i++) {
+> tmp = strdup(database[i][NAME]);
+> if( strstr( strupper(tmp), strupper(str) ) != NULL ) {
+> if( !j )
+> putchar('\n');
+> procmail_print_email(i);