home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / dmake40.zip / quit.c < prev    next >
C/C++ Source or Header  |  1994-10-23  |  2KB  |  79 lines

  1. /* RCS      -- $Header: /u5/dvadura/src/public/dmake/src/RCS/quit.c,v 1.1 1994/10/06 17:41:57 dvadura Exp $
  2. -- SYNOPSIS -- end the dmake session.
  3. -- 
  4. -- DESCRIPTION
  5. --     Handles dmake termination.
  6. --
  7. -- AUTHOR
  8. --      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  9. --      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  10. --
  11. -- COPYRIGHT
  12. --      Copyright (c) 1992,1994 by Dennis Vadura.  All rights reserved.
  13. -- 
  14. --      This program is free software; you can redistribute it and/or
  15. --      modify it under the terms of the GNU General Public License
  16. --      (version 1), as published by the Free Software Foundation, and
  17. --      found in the file 'LICENSE' included with this distribution.
  18. -- 
  19. --      This program is distributed in the hope that it will be useful,
  20. --      but WITHOUT ANY WARRANTY; without even the implied warrant of
  21. --      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  22. --      GNU General Public License for more details.
  23. -- 
  24. --      You should have received a copy of the GNU General Public License
  25. --      along with this program;  if not, write to the Free Software
  26. --      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  27. --
  28. -- LOG
  29. --     $Log: quit.c,v $
  30.  * Revision 1.1  1994/10/06  17:41:57  dvadura
  31.  * dmake Release Version 4.0, Initial revision
  32.  *
  33. */
  34.  
  35. #include "extern.h"
  36.  
  37. static    void    _handle_quit ANSI((char*));
  38. static    int    _dont_quit = 0;
  39.  
  40.  
  41. PUBLIC void
  42. Quit()/*
  43. ======== Error or quit */
  44. {
  45.    if( _dont_quit ) return;
  46.  
  47.    while( Closefile() != NIL( FILE ) );
  48.    Clean_up_processes();
  49.  
  50.    if( Current_target != NIL(CELL) )
  51.       Unlink_temp_files(Current_target);
  52.  
  53.    if( _dont_quit == 0 ) _handle_quit( ".ERROR" );
  54.  
  55.    Set_dir( Makedir );        /* No Error message if we can't do it */
  56.    Epilog( ERROR_EXIT_VALUE );
  57. }
  58.  
  59.  
  60. static void
  61. _handle_quit( err_target )/*
  62. ============================
  63.    Called by quit and the others to handle the execution of termination code
  64.    from within make */
  65. char *err_target;
  66. {
  67.    HASHPTR hp;
  68.    CELLPTR cp;
  69.  
  70.    if( (hp = Get_name(err_target, Defs, FALSE)) != NIL(HASH) ) {
  71.       cp = hp->CP_OWNR;
  72.       Glob_attr |= A_IGNORE;
  73.  
  74.       _dont_quit = 1;
  75.       cp->ce_flag |= F_TARGET;
  76.       Make( cp, NIL(CELL) );
  77.    }
  78. }
  79.