Index: functions.c
===================================================================
--- functions.c	(revision e9b1f60924134160992e5732ba8efb10c07e84d4)
+++ functions.c	(revision d54838d8a769834d5e698841a4ab4cc2db3a696e)
@@ -14,9 +14,11 @@
 static const char fileIdent[] = "$Id$";
 
-void owl_function_noop(void) {
+void owl_function_noop(void)
+{
   return;
 }
 
-char *owl_function_command(char *cmdbuff) {
+char *owl_function_command(char *cmdbuff)
+{
   owl_function_debugmsg("executing command: %s", cmdbuff);
   return owl_cmddict_execute(owl_global_get_cmddict(&g), 
@@ -24,5 +26,6 @@
 }
 
-void owl_function_command_norv(char *cmdbuff) {
+void owl_function_command_norv(char *cmdbuff)
+{
   char *rv;
   rv=owl_function_command(cmdbuff);
@@ -30,13 +33,16 @@
 }
 
-void owl_function_command_alias(char *alias_from, char *alias_to) {
+void owl_function_command_alias(char *alias_from, char *alias_to)
+{
   owl_cmddict_add_alias(owl_global_get_cmddict(&g), alias_from, alias_to);
 }
 
-owl_cmd *owl_function_get_cmd(char *name) {
+owl_cmd *owl_function_get_cmd(char *name)
+{
   return owl_cmddict_find(owl_global_get_cmddict(&g), name);
 }
 
-void owl_function_show_commands() {
+void owl_function_show_commands()
+{
   owl_list l;
   owl_fmtext fm;
@@ -53,5 +59,6 @@
 }
 
-char *owl_function_cmd_describe(void *name) {
+char *owl_function_cmd_describe(void *name)
+{
   owl_cmd *cmd = owl_cmddict_find(owl_global_get_cmddict(&g), name);
   if (cmd) return owl_cmd_describe(cmd);
@@ -59,9 +66,11 @@
 }
 
-void owl_function_show_command(char *name) {
+void owl_function_show_command(char *name)
+{
   owl_function_help_for_command(name);
 }
 
-void owl_function_adminmsg(char *header, char *body) {
+void owl_function_adminmsg(char *header, char *body)
+{
   owl_message *m;
   int followlast;
@@ -84,5 +93,6 @@
 }
 
-void owl_function_make_outgoing_zephyr(char *body, char *zwriteline, char *zsig) {
+void owl_function_make_outgoing_zephyr(char *body, char *zwriteline, char *zsig)
+{
   owl_message *m;
   int followlast;
@@ -114,5 +124,6 @@
 }
 
-void owl_function_zwrite_setup(char *line) {
+void owl_function_zwrite_setup(char *line)
+{
   owl_editwin *e;
   char buff[1024];
@@ -155,5 +166,6 @@
 }
 
-void owl_function_zcrypt_setup(char *line) {
+void owl_function_zcrypt_setup(char *line)
+{
   owl_editwin *e;
   char buff[1024];
@@ -202,5 +214,6 @@
 }
 
-void owl_function_zwrite(char *line) {
+void owl_function_zwrite(char *line)
+{
   owl_zwrite z;
   int i, j;
@@ -234,5 +247,6 @@
  * If last_if_none, will stop at the last message in the view
  * if no matching messages are found.  */
-void owl_function_nextmsg_full(char *filter, int skip_deleted, int last_if_none) {
+void owl_function_nextmsg_full(char *filter, int skip_deleted, int last_if_none)
+{
   int curmsg, i, viewsize, found;
   owl_view *v;
@@ -283,5 +297,6 @@
 }
 
-void owl_function_prevmsg_full(char *filter, int skip_deleted, int first_if_none) {
+void owl_function_prevmsg_full(char *filter, int skip_deleted, int first_if_none)
+{
   int curmsg, i, viewsize, found;
   owl_view *v;
@@ -331,27 +346,33 @@
 }
 
-void owl_function_nextmsg() {
+void owl_function_nextmsg()
+{
   owl_function_nextmsg_full(NULL, 0, 1);
 }
 
 
-void owl_function_prevmsg() {
+void owl_function_prevmsg()
+{
   owl_function_prevmsg_full(NULL, 0, 1);
 }
 
-void owl_function_nextmsg_notdeleted() {
+void owl_function_nextmsg_notdeleted()
+{
   owl_function_nextmsg_full(NULL, 1, 1);
 }
 
-void owl_function_prevmsg_notdeleted() {
+void owl_function_prevmsg_notdeleted()
+{
   owl_function_prevmsg_full(NULL, 1, 1);
 }
 
 
-void owl_function_nextmsg_personal() {
+void owl_function_nextmsg_personal()
+{
   owl_function_nextmsg_full("personal", 0, 0);
 }
 
-void owl_function_prevmsg_personal() {
+void owl_function_prevmsg_personal()
+{
   owl_function_prevmsg_full("personal", 0, 0);
 }
@@ -359,5 +380,6 @@
 
 /* if move_after is 1, moves after the delete */
-void owl_function_deletecur(int move_after) {
+void owl_function_deletecur(int move_after)
+{
   int curmsg;
   owl_view *v;
@@ -387,5 +409,6 @@
 
 
-void owl_function_undeletecur(int move_after) {
+void owl_function_undeletecur(int move_after)
+{
   int curmsg;
   owl_view *v;
@@ -417,5 +440,6 @@
 
 
-void owl_function_expunge() {
+void owl_function_expunge()
+{
   int curmsg;
   owl_message *m;
@@ -453,5 +477,6 @@
 
 
-void owl_function_firstmsg() {
+void owl_function_firstmsg()
+{
   owl_global_set_curmsg(&g, 0);
   owl_global_set_topmsg(&g, 0);
@@ -460,5 +485,6 @@
 }
 
-void owl_function_lastmsg_noredisplay() {
+void owl_function_lastmsg_noredisplay()
+{
   int oldcurmsg, curmsg;
   owl_view *v;
@@ -481,10 +507,12 @@
 }
 
-void owl_function_lastmsg() {
+void owl_function_lastmsg()
+{
   owl_function_lastmsg_noredisplay();
   owl_mainwin_redisplay(owl_global_get_mainwin(&g));  
 }
 
-void owl_function_shift_right() {
+void owl_function_shift_right()
+{
   owl_global_set_rightshift(&g, owl_global_get_rightshift(&g)+10);
   owl_mainwin_redisplay(owl_global_get_mainwin(&g));
@@ -493,5 +521,6 @@
 
 
-void owl_function_shift_left() {
+void owl_function_shift_left()
+{
   int shift;
 
@@ -508,10 +537,12 @@
 
 
-void owl_function_unsuball() {
+void owl_function_unsuball()
+{
   unsuball();
   owl_function_makemsg("Unsubscribed from all messages.");
 }
 
-void owl_function_loadsubs(char *file) {
+void owl_function_loadsubs(char *file)
+{
   int ret;
 
@@ -528,5 +559,6 @@
 }
 
-void owl_function_loadloginsubs(char *file) {
+void owl_function_loadloginsubs(char *file)
+{
   int ret;
 
@@ -543,5 +575,6 @@
 }
 
-void owl_function_suspend() {
+void owl_function_suspend()
+{
   endwin();
   printf("\n");
@@ -552,5 +585,6 @@
 }
 
-void owl_function_zaway_toggle() {
+void owl_function_zaway_toggle()
+{
   if (!owl_global_is_zaway(&g)) {
     owl_global_set_zaway_msg(&g, owl_global_get_zaway_msg_default(&g));
@@ -561,15 +595,18 @@
 }
 
-void owl_function_zaway_on() {
+void owl_function_zaway_on()
+{
   owl_global_set_zaway_on(&g);
   owl_function_makemsg("zaway set (%s)", owl_global_get_zaway_msg(&g));
 }
 
-void owl_function_zaway_off() {
+void owl_function_zaway_off()
+{
   owl_global_set_zaway_off(&g);
   owl_function_makemsg("zaway off");
 }
 
-void owl_function_quit() {
+void owl_function_quit()
+{
   char *ret;
   
@@ -592,5 +629,6 @@
 
 
-void owl_function_zlog_in() {
+void owl_function_zlog_in()
+{
   char *exposure, *eset;
   int ret;
@@ -624,5 +662,6 @@
 }
 
-void owl_function_zlog_out() {
+void owl_function_zlog_out()
+{
   int ret;
   
@@ -638,5 +677,6 @@
 
 
-void owl_function_makemsg(char *fmt, ...) {
+void owl_function_makemsg(char *fmt, ...)
+{
   va_list ap;
   char buff[2048];
@@ -653,5 +693,6 @@
 }
 
-void owl_function_errormsg(char *fmt, ...) {
+void owl_function_errormsg(char *fmt, ...)
+{
   va_list ap;
   char buff[2048];
@@ -670,5 +711,6 @@
 
 
-void owl_function_openurl() {
+void owl_function_openurl()
+{
   /* visit the first url in the current message */
   owl_message *m;
@@ -767,5 +809,6 @@
 }
 
-void owl_function_calculate_topmsg(int direction) {
+void owl_function_calculate_topmsg(int direction)
+{
   int recwinlines, topmsg, curmsg;
   owl_view *v;
@@ -813,9 +856,11 @@
  * and the number of lines in the recwin.
  */
-int owl_function_calculate_topmsg_top(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines) {
+int owl_function_calculate_topmsg_top(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines)
+{
   return(curmsg);
 }
 
-int owl_function_calculate_topmsg_neartop(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines) {
+int owl_function_calculate_topmsg_neartop(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines)
+{
   if (curmsg>0 
       && (owl_message_get_numlines(owl_view_get_element(v, curmsg-1))
@@ -827,5 +872,6 @@
 }
   
-int owl_function_calculate_topmsg_center(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines) {
+int owl_function_calculate_topmsg_center(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines)
+{
   int i, last, lines;
 
@@ -840,5 +886,6 @@
 }
   
-int owl_function_calculate_topmsg_paged(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines, int center_on_page) {
+int owl_function_calculate_topmsg_paged(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines, int center_on_page)
+{
   int i, last, lines, savey;
   
@@ -880,5 +927,6 @@
 
 
-int owl_function_calculate_topmsg_normal(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines) {
+int owl_function_calculate_topmsg_normal(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines)
+{
   int savey, j, i, foo, y;
 
@@ -945,10 +993,12 @@
 
 
-void owl_function_resize() {
+void owl_function_resize()
+{
   owl_global_set_resize_pending(&g);
 }
 
 
-void owl_function_run_buffercommand() {
+void owl_function_run_buffercommand()
+{
   char *buff;
 
@@ -960,5 +1010,6 @@
 }
 
-void owl_function_debugmsg(char *fmt, ...) {
+void owl_function_debugmsg(char *fmt, ...)
+{
   FILE *file;
   time_t now;
@@ -987,9 +1038,11 @@
 
 
-void owl_function_refresh() {
+void owl_function_refresh()
+{
   owl_function_resize();
 }
 
-void owl_function_beep() {
+void owl_function_beep()
+{
   if (owl_global_is_bell(&g)) {
     beep();
@@ -999,5 +1052,6 @@
 
 
-void owl_function_subscribe(char *class, char *inst, char *recip) {
+void owl_function_subscribe(char *class, char *inst, char *recip)
+{
   int ret;
 
@@ -1011,5 +1065,6 @@
 
 
-void owl_function_unsubscribe(char *class, char *inst, char *recip) {
+void owl_function_unsubscribe(char *class, char *inst, char *recip)
+{
   int ret;
 
@@ -1023,10 +1078,12 @@
 
 
-void owl_function_set_cursor(WINDOW *win) {
+void owl_function_set_cursor(WINDOW *win)
+{
   wnoutrefresh(win);
 }
 
 
-void owl_function_full_redisplay() {
+void owl_function_full_redisplay()
+{
   redrawwin(owl_global_get_curs_recwin(&g));
   redrawwin(owl_global_get_curs_sepwin(&g));
@@ -1046,5 +1103,6 @@
 
 
-void owl_function_popless_text(char *text) {
+void owl_function_popless_text(char *text)
+{
   owl_popwin *pw;
   owl_viewwin *v;
@@ -1063,5 +1121,6 @@
 
 
-void owl_function_popless_fmtext(owl_fmtext *fm) {
+void owl_function_popless_fmtext(owl_fmtext *fm)
+{
   owl_popwin *pw;
   owl_viewwin *v;
@@ -1079,5 +1138,6 @@
 }
 
-void owl_function_about() {
+void owl_function_about()
+{
   char buff[5000];
 
@@ -1104,5 +1164,6 @@
 }
 
-void owl_function_info() {
+void owl_function_info()
+{
   owl_message *m;
   owl_fmtext fm;
@@ -1254,5 +1315,6 @@
 
 
-void owl_function_curmsg_to_popwin() {
+void owl_function_curmsg_to_popwin()
+{
   owl_popwin *pw;
   owl_view *v;
@@ -1274,5 +1336,6 @@
 
 
-void owl_function_page_curmsg(int step) {
+void owl_function_page_curmsg(int step)
+{
   /* scroll down or up within the current message IF the message is truncated */
 
@@ -1326,10 +1389,12 @@
 }
 
-void owl_function_resize_typwin(int newsize) {
+void owl_function_resize_typwin(int newsize)
+{
   owl_global_set_typwin_lines(&g, newsize);
   owl_function_resize();
 }
 
-void owl_function_typwin_grow() {
+void owl_function_typwin_grow()
+{
   int i;
 
@@ -1338,5 +1403,6 @@
 }
 
-void owl_function_typwin_shrink() {
+void owl_function_typwin_shrink()
+{
   int i;
 
@@ -1347,5 +1413,6 @@
 }
 
-void owl_function_mainwin_pagedown() {
+void owl_function_mainwin_pagedown()
+{
   int i;
 
@@ -1361,10 +1428,12 @@
 }
 
-void owl_function_mainwin_pageup() {
+void owl_function_mainwin_pageup()
+{
   owl_global_set_curmsg(&g, owl_global_get_topmsg(&g));
   owl_function_prevmsg();
 }
 
-void owl_function_getsubs() {
+void owl_function_getsubs()
+{
   int ret, num, i, one;
   ZSubscription_t sub;
@@ -1402,5 +1471,6 @@
 
 #define PABUFLEN 5000
-void owl_function_printallvars() {
+void owl_function_printallvars()
+{
   char buff[PABUFLEN], *pos, *name;
   owl_list varnames;
@@ -1430,5 +1500,6 @@
 }
 
-void owl_function_show_variables() {
+void owl_function_show_variables()
+{
   owl_list varnames;
   owl_fmtext fm;  
@@ -1452,5 +1523,6 @@
 }
 
-void owl_function_show_variable(char *name) {
+void owl_function_show_variable(char *name)
+{
   owl_fmtext fm;  
 
@@ -1463,5 +1535,6 @@
 /* note: this applies to global message list, not to view.
  * If flag is 1, deletes.  If flag is 0, undeletes. */
-void owl_function_delete_by_id(int id, int flag) {
+void owl_function_delete_by_id(int id, int flag)
+{
   owl_messagelist *ml;
   owl_message *m;
@@ -1481,5 +1554,6 @@
 }
 
-void owl_function_delete_automsgs() {
+void owl_function_delete_automsgs()
+{
   /* mark for deletion all messages in the current view that match the
    * 'trash' filter */
@@ -1514,5 +1588,6 @@
 
 
-void owl_function_status() {
+void owl_function_status()
+{
   char buff[5000];
   time_t start;
@@ -1548,5 +1623,6 @@
 }
 
-void owl_function_show_term() {
+void owl_function_show_term()
+{
   owl_fmtext fm;
   char buff[LINE];
@@ -1573,5 +1649,6 @@
 
 
-void owl_function_reply(int type, int enter) {
+void owl_function_reply(int type, int enter)
+{
   /* if type = 0 then normal reply.
    * if type = 1 then it's a reply to sender
@@ -1682,5 +1759,6 @@
 }
 
-void owl_function_zlocate(int argc, char **argv, int auth) {
+void owl_function_zlocate(int argc, char **argv, int auth)
+{
   owl_fmtext fm;
   char *ptr, buff[LINE];
@@ -1700,5 +1778,6 @@
 }
 
-void owl_function_start_command(char *line) {
+void owl_function_start_command(char *line)
+{
   int i, j;
   owl_editwin *tw;
@@ -1719,5 +1798,6 @@
 }
 
-char *owl_function_exec(int argc, char **argv, char *buff, int type) {
+char *owl_function_exec(int argc, char **argv, char *buff, int type)
+{
   /* if type == 1 display in a popup
    * if type == 2 display an admin messages
@@ -1765,5 +1845,6 @@
 
 
-char *owl_function_perl(int argc, char **argv, char *buff, int type) {
+char *owl_function_perl(int argc, char **argv, char *buff, int type)
+{
   /* if type == 1 display in a popup
    * if type == 2 display an admin messages
@@ -1798,5 +1879,6 @@
 
 
-void owl_function_change_view(char *filtname) {
+void owl_function_change_view(char *filtname)
+{
   owl_view *v;
   owl_filter *f;
@@ -1845,5 +1927,6 @@
 }
 
-void owl_function_create_filter(int argc, char **argv) {
+void owl_function_create_filter(int argc, char **argv)
+{
   owl_filter *f;
   owl_view *v;
@@ -1906,5 +1989,6 @@
 }
 
-void owl_function_show_filters() {
+void owl_function_show_filters()
+{
   owl_list *l;
   owl_filter *f;
@@ -1933,5 +2017,6 @@
 }
 
-void owl_function_show_filter(char *name) {
+void owl_function_show_filter(char *name)
+{
   owl_filter *f;
   char buff[5000];
@@ -1946,5 +2031,6 @@
 }
 
-void owl_function_show_zpunts() {
+void owl_function_show_zpunts()
+{
   owl_filter *f;
   owl_list *fl;
@@ -1968,5 +2054,6 @@
 }
 
-char *owl_function_fastclassinstfilt(char *class, char *instance) {
+char *owl_function_fastclassinstfilt(char *class, char *instance) 
+{
   /* creates a filter for a class, instance if one doesn't exist.
    * If instance is null then apply for all messgaes in the class.
@@ -1975,5 +2062,5 @@
   owl_filter *f;
   char *argbuff, *filtname;
-  char *tmpclass, *tmpinstance;
+  char *tmpclass, *tmpinstance = NULL;
   int len;
 
@@ -2008,9 +2095,9 @@
   }
   sprintf(argbuff, "( class ^%s$ )", tmpclass);
-  if (instance) {
+  if (tmpinstance) {
     sprintf(argbuff, "%s and ( instance ^%s$ )", argbuff, tmpinstance);
   }
   owl_free(tmpclass);
-  if (instance) owl_free(tmpinstance);
+  if (tmpinstance) owl_free(tmpinstance);
 
   f=owl_malloc(sizeof(owl_filter));
@@ -2024,5 +2111,6 @@
 }
 
-char *owl_function_fastuserfilt(char *user) {
+char *owl_function_fastuserfilt(char *user)
+{
   owl_filter *f;
   char *argbuff, *longuser, *shortuser, *filtname;
@@ -2062,5 +2150,6 @@
 }
 
-char *owl_function_fasttypefilt(char *type) {
+char *owl_function_fasttypefilt(char *type)
+{
   owl_filter *f;
   char *argbuff, *filtname;
@@ -2092,5 +2181,6 @@
 /* If flag is 1, marks for deletion.  If flag is 0,
  * unmarks for deletion. */
-void owl_function_delete_curview_msgs(int flag) {
+void owl_function_delete_curview_msgs(int flag)
+{
   owl_view *v;
   int i, j;
@@ -2111,5 +2201,6 @@
 }
 
-char *owl_function_smartfilter(int type) {
+char *owl_function_smartfilter(int type)
+{
   /* Returns the name of a filter, or null.  The caller 
    * must free this name.  */
@@ -2171,5 +2262,6 @@
 }
 
-void owl_function_smartzpunt(int type) {
+void owl_function_smartzpunt(int type)
+{
   /* Starts a zpunt command based on the current class,instance pair. 
    * If type=0, uses just class.  If type=1, uses instance as well. */
@@ -2219,5 +2311,6 @@
 
 
-void owl_function_color_current_filter(char *color) {
+void owl_function_color_current_filter(char *color)
+{
   owl_filter *f;
   char *name;
@@ -2242,5 +2335,6 @@
 }
 
-void owl_function_show_colors() {
+void owl_function_show_colors()
+{
   owl_fmtext fm;
 
@@ -2259,5 +2353,6 @@
 }
 
-void owl_function_zpunt(char *class, char *inst, char *recip, int direction) {
+void owl_function_zpunt(char *class, char *inst, char *recip, int direction)
+{
   /* add the given class, inst, recip to the punt list for filtering.
    *   if direction==0 then punt
@@ -2312,5 +2407,6 @@
 }
 
-void owl_function_activate_keymap(char *keymap) {
+void owl_function_activate_keymap(char *keymap)
+{
   if (!owl_keyhandler_activate(owl_global_get_keyhandler(&g), keymap)) {
     owl_function_makemsg("Unable to activate keymap '%s'", keymap);
@@ -2319,5 +2415,6 @@
 
 
-void owl_function_show_keymaps() {
+void owl_function_show_keymaps()
+{
   owl_list l;
   owl_fmtext fm;
@@ -2349,5 +2446,6 @@
 }
 
-char *owl_function_keymap_summary(void *name) {
+char *owl_function_keymap_summary(void *name)
+{
   owl_keymap *km 
     = owl_keyhandler_get_keymap(owl_global_get_keyhandler(&g), name);
@@ -2357,5 +2455,6 @@
 
 /* TODO: implement for real */
-void owl_function_show_keymap(char *name) {
+void owl_function_show_keymap(char *name)
+{
   owl_fmtext fm;
   owl_keymap *km;
@@ -2372,5 +2471,6 @@
 }
 
-void owl_function_help_for_command(char *cmdname) {
+void owl_function_help_for_command(char *cmdname)
+{
   owl_fmtext fm;
 
@@ -2381,5 +2481,6 @@
 }
 
-void owl_function_search_start(char *string, int direction) {
+void owl_function_search_start(char *string, int direction)
+{
   /* direction is OWL_DIRECTION_DOWNWARDS or OWL_DIRECTION_UPWARDS */
   owl_global_set_search_active(&g, string);
@@ -2387,10 +2488,12 @@
 }
 
-void owl_function_search_continue(int direction) {
+void owl_function_search_continue(int direction)
+{
   /* direction is OWL_DIRECTION_DOWNWARDS or OWL_DIRECTION_UPWARDS */
   owl_function_search_helper(1, direction);
 }
 
-void owl_function_search_helper(int mode, int direction) {
+void owl_function_search_helper(int mode, int direction)
+{
   /* move to a message that contains the string.  If direction is
    * OWL_DIRECTION_DOWNWARDS then search fowards, if direction is
@@ -2454,5 +2557,6 @@
 /* strips formatting from ztext and returns the unformatted text. 
  * caller is responsible for freeing. */
-char *owl_function_ztext_stylestrip(char *zt) {
+char *owl_function_ztext_stylestrip(char *zt)
+{
   owl_fmtext fm;
   char *plaintext;
@@ -2467,5 +2571,6 @@
 /* popup a znol listing.  If file is NULL use the default .anyone */
 /* this doesn't obey 'elapsed' or 'timesort' yet */
-void owl_function_zlist(char *file, int elapsed, int timesort) {
+void owl_function_zlist(char *file, int elapsed, int timesort)
+{
   char *ourfile, *tmp, buff[LINE], *line;
   FILE *f;
@@ -2552,5 +2657,6 @@
 }
 
-void owl_function_dump(char *filename) {
+void owl_function_dump(char *filename) 
+{
   int i, j, count;
   owl_message *m;
@@ -2587,5 +2693,5 @@
 
 
-void owl_function_do_newmsgproc() {
+void owl_function_do_newmsgproc(void) {
   if (owl_global_get_newmsgproc(&g) && strcmp(owl_global_get_newmsgproc(&g), "")) {
     /* if there's a process out there, we need to check on it */
@@ -2610,5 +2716,4 @@
 	/* parent set the child's pid */
 	owl_global_set_newmsgproc_pid(&g, i);
-	waitpid(i, NULL, WNOHANG);
 	owl_function_debugmsg("I'm the parent and I started a new newmsgproc with pid %i", i);
       } else {
@@ -2616,14 +2721,21 @@
 	char **parsed;
 	parsed=owl_parseline(owl_global_get_newmsgproc(&g), &myargc);
-	parsed=realloc(parsed, strlen(owl_global_get_newmsgproc(&g)+300));
-	parsed[myargc]=(char *) NULL;
+	if (myargc < 0) {
+	  owl_function_debugmsg("Could not parse newmsgproc '%s': unbalanced quotes?", owl_global_get_newmsgproc(&g));
+	}
+	if (myargc <= 0) {
+	  _exit(127);
+	}
+	parsed=realloc(parsed, sizeof(*parsed) * (myargc+1));
+	parsed[myargc] = NULL;
 	
-	owl_function_debugmsg("About to exec: %s with %i arguments", parsed[0], myargc);
+	owl_function_debugmsg("About to exec \"%s\" with %d arguments", parsed[0], myargc);
 	
-	execvp(parsed[0], (char **) parsed);
+	execvp(parsed[0], parsed);
 	
 	
 	/* was there an error exec'ing? */
-	owl_function_debugmsg("Error execing: %s", strerror(errno));
+	owl_function_debugmsg("Cannot run newmsgproc '%s': cannot exec '%s': %s", 
+			      owl_global_get_newmsgproc(&g), parsed[0], strerror(errno));
 	_exit(127);
       }
@@ -2634,9 +2746,7 @@
 void owl_function_xterm_raise(void) {
   printf("\033[5t");
-  fflush(stdout);
 }
 
 void owl_function_xterm_deiconify(void) {
   printf("\033[1t");
-  fflush(stdout);
-}
+}
