/*
* $Id$
*
- * by JH <jheinonen@bigfoot.com>
+ * by JH <jheinonen@users.sourceforge.net>
*
* Copyright (C) Jaakko Heinonen
*/
extern list_item *database;
static void
-muttq_print_item(int item)
+muttq_print_item(FILE *file, int item)
{
char emails[MAX_EMAILS][MAX_EMAIL_LEN];
int i;
for(i = 0; i < (options_get_int("mutt_return_all_emails") ?
MAX_EMAILS : 1) ; i++)
if( *emails[i] )
- printf("%s\t%s\t%s\n", emails[i],
+ fprintf(file, "%s\t%s\t%s\n", emails[i],
database[item][NAME],
database[item][NOTES] == NULL ? " " :
database[item][NOTES]
struct db_enumerator e = init_db_enumerator(ENUM_ALL);
printf("All items\n");
db_enumerate_items(e)
- muttq_print_item(e.item);
+ muttq_print_item(stdout, e.item);
} else {
int search_fields[] = {NAME, EMAIL, NICK, -1};
int i;
}
putchar('\n');
while(i >= 0) {
- muttq_print_item(i);
+ muttq_print_item(stdout, i);
i = find_item(str, i+1, search_fields);
}
}
return ret;
}
+void
+print_stderr(int item)
+{
+ fprintf (stderr, "%c", '\n');
+
+ if( is_valid_item(item) )
+ muttq_print_item(stderr, item);
+ else {
+ struct db_enumerator e = init_db_enumerator(ENUM_SELECTED);
+ db_enumerate_items(e) {
+ muttq_print_item(stderr, e.item);
+ }
+ }
+
+}
+
void
launch_mutt(int item)
{
char *cmd = NULL, *mailstr = NULL;
+ char *mutt_command = options_get_str("mutt_command");
+
+ if(mutt_command == NULL || !*mutt_command)
+ return;
if( is_valid_item(item) )
mailstr = make_mailstr(item);
}
}
- cmd = strconcat(options_get_str("mutt_command"), " \'", mailstr,
+ cmd = strconcat(mutt_command, " \'", mailstr,
"\'", NULL);
free(mailstr);
#ifdef DEBUG
#endif
system(cmd);
free(cmd);
+
+ /*
+ * we need to make sure that curses settings are correct
+ */
+ ui_init_curses();
}
void
system(cmd);
free(cmd);
+
+ /*
+ * we need to make sure that curses settings are correct
+ */
+ ui_init_curses();
}
void *
strlower(srcformat);
strlower(dstformat);
+#ifndef DEBUG
if( !strcmp(srcformat, dstformat) ) {
printf( "input and output formats are the same\n"
"exiting...\n");
exit(1);
}
+#endif
set_filenames();
init_options();
exit(ret);
}
-