home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
544a.lha
/
RPN_v1.0
/
Source
/
cleanup.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-09-06
|
1KB
|
50 lines
/*------------------------------------*
| File: CLEANUP.c - MLO 900131 V1.00 |
| These routines perform cleanup for |
| program termination. |
*------------------------------------*/
#include "rpn.h"
#include "proto.h"
extern struct Window *Wrpn;
extern struct Window *Wreg;
static void cleanMess(struct Window *pW);
void cleanup(
int code /* Completion code */
)
{/*--------------------------------------*
| Frees all Intuition resources and |
| exits with the given completion code |
*--------------------------------------*/
if (Wreg != NULL) {
CloseWindow(Wreg);
}
if (Wrpn != NULL) {
ClearMenuStrip(Wrpn);
cleanMess(Wrpn);
CloseWindow(Wrpn);
}
deallMem();
exit(code);
}
static void cleanMess(
struct Window *pW
)
{/*------------------------------------------*
| Local function. Replies to all Intuition |
| messages pending for the given window. |
*------------------------------------------*/
struct IntuiMessage *pIM;
while ( (pIM = (struct IntuiMessage *) GetMsg(pW->UserPort)) != NULL) {
ReplyMsg(pIM);
}
}