home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Spezial / SPEZIAL2_97.zip / SPEZIAL2_97.iso / ANWEND / ONLINE / ELM23-2 / ELM23-2.ZIP / src / exitprog.c < prev    next >
C/C++ Source or Header  |  1990-04-28  |  2KB  |  59 lines

  1.  
  2. static char rcsid[] = "@(#)$Id: exitprog.c,v 4.1 90/04/28 22:43:00 syd Exp $";
  3.  
  4. /*******************************************************************************
  5.  *  The Elm Mail System  -  $Revision: 4.1 $   $State: Exp $
  6.  *
  7.  *             Copyright (c) 1986, 1987 Dave Taylor
  8.  *             Copyright (c) 1988, 1989, 1990 USENET Community Trust
  9.  *******************************************************************************
  10.  * Bug reports, patches, comments, suggestions should be sent to:
  11.  *
  12.  *    Syd Weinstein, Elm Coordinator
  13.  *    elm@DSI.COM            dsinc!elm
  14.  *
  15.  *******************************************************************************
  16.  * $Log:    exitprog.c,v $
  17.  * Revision 4.1  90/04/28  22:43:00  syd
  18.  * checkin of Elm 2.3 as of Release PL0
  19.  *
  20.  *
  21.  ******************************************************************************/
  22.  
  23. #include "headers.h"
  24.  
  25. int
  26. exit_prog()
  27. {
  28.     /** Exit, abandoning all changes to the mailbox (if there were
  29.         any, and if the user say's it's ok)
  30.     **/
  31.  
  32.     char buffer[SLEN], answer;
  33.     register int i, changes;
  34.  
  35.     dprint(1, (debugfile, "\n\n-- exiting --\n\n"));
  36.  
  37.     /* Determine if any messages are scheduled for deletion, or if
  38.      * any message has changed status
  39.      */
  40.     for (changes = 0, i = 0; i < message_count; i++)
  41.       if (ison(headers[i]->status, DELETED) || headers[i]->status_chgd)
  42.         changes++;
  43.  
  44.     if (changes) {
  45.       /* YES or NO on softkeys */
  46.       if (hp_softkeys) {
  47.         define_softkeys(YESNO);
  48.         softkeys_on();
  49.       }
  50.       sprintf(buffer,"Abandon change%s to mailbox? (y/n) ",plural(changes));
  51.       answer = want_to(buffer, 'n');
  52.  
  53.       if(answer != 'y') return -1;
  54.     }
  55.  
  56.     fflush(stdout);
  57.     return leave(0);
  58. }
  59.