home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / elm / elm2.4 / src / exitprog.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-04-11  |  2.8 KB  |  88 lines

  1.  
  2. static char rcsid[] = "@(#)$Id: exitprog.c,v 5.5 1993/04/12 02:34:36 syd Exp $";
  3.  
  4. /*******************************************************************************
  5.  *  The Elm Mail System  -  $Revision: 5.5 $   $State: Exp $
  6.  *
  7.  *            Copyright (c) 1988-1992 USENET Community Trust
  8.  *            Copyright (c) 1986,1987 Dave Taylor
  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 5.5  1993/04/12  02:34:36  syd
  18.  * I have now added a parameter which controls whether want_to clears the
  19.  * line and centers the question or behaves like it did before. I also
  20.  * added a 0 at the end of the parameter list to all the other calls to
  21.  * want_to where a centered question on a clean line is not desirable.
  22.  * From: Jukka Ukkonen <ukkonen@csc.fi>
  23.  *
  24.  * Revision 5.4  1993/01/19  03:55:39  syd
  25.  * exitprog.c makes a reference to a null character pointer, savecopy.c
  26.  * tries to reference an uninitialized variable, and the previous patch to
  27.  * src/lock.c to get rid of an uninitialized variable compiler message
  28.  * needed to be put in filter/lock.c as well.
  29.  * From: wdh@grouper.mkt.csd.harris.com (W. David Higgins)
  30.  *
  31.  * Revision 5.3  1992/12/25  00:26:49  syd
  32.  * Fix routine names
  33.  * From: Syd
  34.  *
  35.  * Revision 5.2  1992/12/24  21:42:01  syd
  36.  * Fix messages and nls messages to match.  Plus use want_to
  37.  * where appropriate.
  38.  * From: Syd, via prompting from Jan Djarv <Jan.Djarv@sa.erisoft.se>
  39.  *
  40.  * Revision 5.1  1992/10/03  22:58:40  syd
  41.  * Initial checkin as of 2.4 Release at PL0
  42.  *
  43.  *
  44.  ******************************************************************************/
  45.  
  46. #include "headers.h"
  47. #include "s_elm.h"
  48.  
  49. int
  50. exit_prog()
  51. {
  52.     /** Exit, abandoning all changes to the mailbox (if there were
  53.         any, and if the user say's it's ok)
  54.     **/
  55.  
  56.     char msg[SLEN], answer;
  57.     register int i, changes;
  58.  
  59.     dprint(1, (debugfile, "\n\n-- exiting --\n\n"));
  60.  
  61.     /* Determine if any messages are scheduled for deletion, or if
  62.      * any message has changed status
  63.      */
  64.     for (changes = 0, i = 0; i < message_count; i++)
  65.       if (ison(headers[i]->status, DELETED) || headers[i]->status_chgd)
  66.         changes++;
  67.     
  68.     if (changes) {
  69.       /* YES or NO on softkeys */
  70.       if (hp_softkeys) {
  71.         define_softkeys(YESNO);
  72.         softkeys_on();
  73.       }
  74.       if (changes == 1)
  75.         MCsprintf(msg, catgets(elm_msg_cat, ElmSet, ElmAbandonChange,
  76.         "Abandon change to mailbox? (%c/%c) "), *def_ans_yes, *def_ans_no);
  77.       else
  78.         MCsprintf(msg, catgets(elm_msg_cat, ElmSet, ElmAbandonChangePlural,
  79.         "Abandon changes to mailbox? (%c/%c) "), *def_ans_yes, *def_ans_no);
  80.       answer = want_to(msg, *def_ans_no, LINES-3, 0);
  81.  
  82.       if(answer != *def_ans_yes) return -1;
  83.     }
  84.  
  85.     fflush(stdout);
  86.     return leave(0);
  87. }
  88.