home *** CD-ROM | disk | FTP | other *** search
- /* --------------------------------------------------------------------------- */
- /* Name: UserTemplate.c
- * Author: aleph NULL (Silicon Based Life)
- * Date: 8/10/95
- * Comment: (c) Copyright 1995 Silicon Based Life
- * :
- */
- /* --------------------------------------------------------------------------- */
- /* #includes */
-
- #include <exec/ports.h>
- #include <exec/types.h>
-
- #include <clib/exec_protos.h>
-
- #include "UserTemplate.h"
- #include "UserTemplate_protos.h"
-
- /* --------------------------------------------------------------------------- */
- /* main */
-
- main( int argc, char **argv )
- {
- struct MsgPort *mp = NULL;
- struct UserMessage *um = NULL;
- BOOL Done = FALSE;
-
- if(!( mp = CreateMsgPort() ))
- goto Exception;
-
- mp->mp_Node.ln_Name = DEFAULT_USER_PORT;
- mp->mp_Node.ln_Pri = 50;
-
- AddPort( mp );
-
- if(!( InitUserClock() ))
- goto Exception;
-
- while(! Done )
- {
- WaitPort( mp );
- while( um = (struct UserMessage *)GetMsg( mp ) )
- {
- switch( um->um_Event )
- {
- case OPENFACE:
- OpenUserClock();
- break;
- case CLOSEFACE:
- CloseUserClock();
- break;
- case CHIME:
- ChimeUserClock();
- break;
- case ALARM:
- AlarmUserClock();
- break;
- case TIME:
- UpdateUserClock();
- break;
- case PREFS:
- OpenUserClockPrefs();
- break;
- case QUIT:
- Done = TRUE;
- break;
- }
- ReplyMsg( (struct Message *)um );
- }
- }
-
- Exception:
- FreeUserClock();
- if( mp )
- {
- RemPort( mp );
- while( um = (struct UserMessage *)GetMsg( mp ) )
- ReplyMsg( (struct Message *)um );
- DeleteMsgPort( mp );
- }
- exit(0);
- }
-
- /* --------------------------------------------------------------------------- */
-
-
-