# include "config.h"
#endif
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+
#include <lib-lib/mem.h>
#include <lib-lib/str.h>
#include <lib-lib/macros.h>
#include <lib-lib/file.h>
#include <lib-lib/mapping.h>
+#include <lib-ui/menu.h>
+
#include "mutt.h"
-#include "mutt_menu.h"
+#include "alias.h"
#include "mutt_idna.h"
#include "sort.h"
-#include "lib/debug.h"
-
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-
typedef struct query {
address_t *addr;
char *name;
static int FirstColumn;
static int SecondColumn;
-static void query_menu (char *buf, size_t buflen, QUERY * results,
+static void query_menu (char *buf, ssize_t buflen, QUERY * results,
int retbuf);
static address_t *result_to_addr (QUERY * r)
QUERY *cur = NULL;
char cmd[_POSIX_PATH_MAX];
char *buf = NULL;
- size_t buflen;
+ ssize_t buflen;
int dummy = 0;
char msg[STRING];
char *p;
mutt_expand_file_fmt (cmd, sizeof (cmd), QueryCmd, s);
if ((thepid = mutt_create_filter (cmd, NULL, &fp, NULL)) < 0) {
- debug_print (1, ("unable to fork command: %s\n", cmd));
return 0;
}
if (!quiet)
p_delete(&buf);
fclose (fp);
if (mutt_wait_filter (thepid)) {
- debug_print (1, ("Error: %s\n", msg));
if (!quiet)
mutt_error ("%s", msg);
}
* a menu entry for the requested item number.
*/
#define QUERY_MIN_COLUMN_LENGHT 20 /* Must be < 70/2 */
-static void query_entry (char *s, size_t slen, MUTTMENU * m, int num)
+static void query_entry (char *s, ssize_t slen, MUTTMENU * m, int num)
{
ENTRY *table = (ENTRY *) m->data;
char buf2[SHORT_STRING], buf[SHORT_STRING] = "";
return cur->tagged - ot;
}
-int mutt_query_complete (char *buf, size_t buflen)
+int mutt_query_complete (char *buf, ssize_t buflen)
{
QUERY *results = NULL;
address_t *tmpa;
mutt_addrlist_to_local (tmpa);
buf[0] = '\0';
rfc822_write_address (buf, buflen, tmpa, 0);
- address_delete (&tmpa);
+ address_list_wipe(&tmpa);
mutt_clear_error ();
return (0);
}
return (0);
}
-void mutt_query_menu (char *buf, size_t buflen)
+void mutt_query_menu (char *buf, ssize_t buflen)
{
if (!QueryCmd) {
mutt_error _("Query command not defined.");
}
}
-static void query_menu (char *buf, size_t buflen, QUERY * results, int retbuf)
+static void query_menu (char *buf, ssize_t buflen, QUERY * results, int retbuf)
{
MUTTMENU *menu;
HEADER *msg = NULL;
if (op == OP_QUERY) {
queryp = results;
while (queryp) {
- address_delete (&queryp->addr);
+ address_list_wipe(&queryp->addr);
p_delete(&queryp->name);
p_delete(&queryp->other);
results = queryp->next;
address_t *a = result_to_addr (QueryTable[menu->current].data);
mutt_create_alias (NULL, a);
- address_delete (&a);
+ address_list_wipe(&a);
}
break;
/* fall through to OP_MAIL */
case OP_MAIL:
- msg = mutt_new_header ();
- msg->env = mutt_new_envelope ();
+ msg = header_new();
+ msg->env = envelope_new();
if (!menu->tagprefix) {
msg->env->to = result_to_addr (QueryTable[menu->current].data);
}
/* if we need to return the selected entries */
if (retbuf && (done == 2)) {
int tagged = 0;
- size_t curpos = 0;
+ ssize_t curpos = 0;
p_clear(buf, buflen);
tagged = 1;
rfc822_write_address (buf, buflen, tmpa, 0);
curpos = m_strlen(buf);
- address_delete (&tmpa);
+ address_list_wipe(&tmpa);
}
else if (curpos + 2 < buflen) {
address_t *tmpa = result_to_addr (QueryTable[i].data);
rfc822_write_address ((char *) buf + curpos + 1,
buflen - curpos - 1, tmpa, 0);
curpos = m_strlen(buf);
- address_delete (&tmpa);
+ address_list_wipe(&tmpa);
}
}
}
mutt_addrlist_to_local (tmpa);
rfc822_write_address (buf, buflen, tmpa, 0);
- address_delete (&tmpa);
+ address_list_wipe(&tmpa);
}
}
queryp = results;
while (queryp) {
- address_delete (&queryp->addr);
+ address_list_wipe(&queryp->addr);
p_delete(&queryp->name);
p_delete(&queryp->other);
results = queryp->next;