/* * kbdestroy() - kills the key pad function key search tree * and frees all lines associated with it * * Should be called with arg kbesc, the top of the tree. */ void kbdestroy(KBESC_T *kb) { if(kb){ kbdestroy(kb->left); kbdestroy(kb->down); free((char *)kb); kb = NULL; } }
/* * Quit command. If an argument, always quit. Otherwise confirm if a buffer * has been changed and not written out. Normally bound to "C-X C-C". */ int wquit(int f, int n) { register int s; if(Pmaster){ char *result = NULL; int ret; /* First, make sure there are no outstanding problems */ if(AttachError()){ emlwrite(_("\007Problem with attachments! Fix errors or delete attachments."), NULL); return(FALSE); } #ifdef SPELLER if(Pmaster->always_spell_check) if(spell(0, 0) == -1) sleep(3); /* problem, show error */ #endif /* * if we're not in header, show some of it as we verify sending... */ display_for_send(); packheader(); Pmaster->arm_winch_cleanup++; if((!(Pmaster->pine_flags & MDHDRONLY) || any_header_changes()) && (ret = (*Pmaster->exittest)(Pmaster->headents, redraw_pico_for_callback, Pmaster->allow_flowed_text, &result))){ Pmaster->arm_winch_cleanup--; if(ret == -1){ pico_all_done = COMP_CANCEL; } else{ if(sgarbf) update(); lchange(WFHARD); /* set update flags... */ curwp->w_flag |= WFMODE; /* and modeline so we */ sgarbk = TRUE; /* redraw the keymenu */ pclear(term.t_nrow-2, term.t_nrow); } if(result && *result) emlwrite(result, NULL); } else{ Pmaster->arm_winch_cleanup--; pico_all_done = COMP_EXIT; return(TRUE); } } else{ if (f != FALSE /* Argument forces it. */ || anycb() == FALSE /* All buffers clean. */ /* User says it's OK. */ /* TRANSLATORS: buffer is the in-memory copy of a file */ || (s=mlyesno_utf8(_("Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES)"), -1)) == FALSE) { vttidy(); #if defined(USE_TERMCAP) || defined(USE_TERMINFO) || defined(VMS) kbdestroy(kbesc); #endif exit(0); } if(s == TRUE){ if(filewrite(0,1) == TRUE) wquit(1, 0); } else if(s == ABORT){ emlwrite(_("Exit cancelled"), NULL); if(term.t_mrow == 0) curwp->w_flag |= WFHARD; /* cause bottom 3 lines to paint */ } return(s); } return(FALSE); }