/*
- * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
+ * Copyright (C) 1996-2000,2003 Michael R. Elkins <me@mutt.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "mutt_menu.h"
#include "mutt_idna.h"
#include "mapping.h"
-#include "sort.h"
#include <string.h>
#include <stdlib.h>
{ N_("Make Alias"), OP_CREATE_ALIAS },
{ N_("Search"), OP_SEARCH },
{ N_("Help"), OP_HELP },
- { NULL }
+ { NULL, 0 }
};
-/* Variables for outsizing output format */
-static int FirstColumn;
-static int SecondColumn;
-
static void query_menu (char *buf, size_t buflen, QUERY *results, int retbuf);
static ADDRESS *result_to_addr (QUERY *r)
{
static ADDRESS *tmp;
- if (!(tmp = rfc822_cpy_adr (r->addr)))
+ if (!(tmp = rfc822_cpy_adr (r->addr, 0)))
return NULL;
if(!tmp->next && !tmp->personal)
char msg[STRING];
char *p;
pid_t thepid;
- int l;
mutt_expand_file_fmt (cmd, sizeof(cmd), QueryCmd, s);
fgets (msg, sizeof (msg), fp);
if ((p = strrchr (msg, '\n')))
*p = '\0';
- while ((buf = mutt_read_line (buf, &buflen, fp, &dummy)) != NULL)
+ while ((buf = mutt_read_line (buf, &buflen, fp, &dummy, 0)) != NULL)
{
if ((p = strtok(buf, "\t\n")))
{
if (first == NULL)
{
- FirstColumn = 0;
- SecondColumn = 0;
first = (QUERY *) safe_calloc (1, sizeof (QUERY));
cur = first;
}
cur = cur->next;
}
- l = mutt_strwidth (p);
- if (l > SecondColumn)
- SecondColumn = l;
-
cur->addr = rfc822_parse_adrlist (cur->addr, p);
p = strtok(NULL, "\t\n");
if (p)
{
- l = mutt_strwidth (p);
- if (l > FirstColumn)
- FirstColumn = l;
cur->name = safe_strdup (p);
p = strtok(NULL, "\t\n");
if (p)
- {
cur->other = safe_strdup (p);
- }
}
}
}
FREE (&buf);
- fclose (fp);
+ safe_fclose (&fp);
if (mutt_wait_filter (thepid))
{
dprint (1, (debugfile, "Error: %s\n", msg));
break;
case 'c':
snprintf (tmp, sizeof (tmp), "%%%sd", fmt);
- snprintf (dest, destlen, tmp, query->num);
+ snprintf (dest, destlen, tmp, query->num + 1);
break;
case 'e':
if (!optional)
snprintf (title, sizeof (title), _("Query")); /* FIXME */
- menu = mutt_new_menu ();
+ menu = mutt_new_menu (MENU_QUERY);
menu->make_entry = query_entry;
menu->search = query_search;
menu->tag = query_tag;
- menu->menu = MENU_QUERY;
menu->title = title;
menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_QUERY, QueryHelp);
menu->current = 0;
mutt_menuDestroy (&menu);
- menu = mutt_new_menu ();
+ menu = mutt_new_menu (MENU_QUERY);
menu->make_entry = query_entry;
menu->search = query_search;
menu->tag = query_tag;
- menu->menu = MENU_QUERY;
menu->title = title;
menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_QUERY, QueryHelp);
if (QueryTable[i].tagged)
{
ADDRESS *a = result_to_addr(QueryTable[i].data);
- rfc822_append (&naddr, a);
+ rfc822_append (&naddr, a, 0);
rfc822_free_address (&a);
}
if (QueryTable[i].tagged)
{
ADDRESS *a = result_to_addr(QueryTable[i].data);
- rfc822_append (&msg->env->to, a);
+ rfc822_append (&msg->env->to, a, 0);
rfc822_free_address (&a);
}
}