void checkforsave(void) /* If the spreadsheet has been changed, will ask the user if they want to save it. */ { int save; if (changed && getyesno(&save, MSGSAVESHEET) && (save == 'Y')) savesheet(); } /* checkforsave */
void smenu(void) /* Executes the commands in the spreadsheet menu */ { char filename[MAXINPUT + 1]; filename[0] = 0; switch(getcommand(SMENU, SCOMMAND)) { case 0 : checkforsave(); loadsheet(filename); break; case 1 : savesheet(); break; case 2 : printsheet(); break; case 3 : checkforsave(); clearsheet(); break; } /* switch */ } /* smenu */