home *** CD-ROM | disk | FTP | other *** search
- //************************************
- //
- // Name : janitor.c
- //
- //************************************
-
-
- //**** Header files
-
- //** OS Include files
-
- //** OS function prototypes
- #include <clib/exec_protos.h>
- #include <clib/wb_protos.h>
-
- //** OS function inline calls
- #include <pragmas/exec_pragmas.h>
- #include <pragmas/wb_pragmas.h>
-
- //** ANSI C includes
-
- //** application include
-
- #include "Librarian.h"
- #include "Node.h"
- #include "Janitor.h"
-
-
- //**** Local data structures
-
- struct MsgPort *StarPort[NUMPORTS]={NULL};
-
-
- //**** Aux functions
-
- int BindMenus(void) {
- struct ProgNode *pn;
- if (IsListEmpty(List)) return 0;
- for (pn = (struct ProgNode *)List->lh_Head ; pn->pn_Node.ln_Succ ; pn = (struct ProgNode *)pn->pn_Node.ln_Succ) {
- pn->pn_appmenu=AddAppMenuItemA(0L,(ULONG)pn,pn->pn_Node.ln_Name,StarPort[1],NULL);
- if (NULL==pn->pn_appmenu) {
- FreeMenus();
- return 0;
- } // if
- };
- return 1;
- } // BindMenus
-
- int FreeMenus(void) {
- struct ProgNode *pn;
- if (IsListEmpty(List)) return 1;
- for (pn = (struct ProgNode *)List->lh_Head ; pn->pn_Node.ln_Succ ; pn = (struct ProgNode *)pn->pn_Node.ln_Succ) {
- if (NULL!=pn->pn_appmenu) {
- RemoveAppMenuItem(pn->pn_appmenu);
- pn->pn_appmenu=NULL;
- } // if
- };
- return 1;
- } // FreeMenus
-
- int OpenPorts(void) {
- int i;
- for (i=0 ; i<NUMPORTS; i++) {
- StarPort[i]=CreateMsgPort();
- if (NULL==StarPort[i]) return 0;
- }; // for
- return 1;
- } // OpenPorts
-
- void ClosePorts(void) {
- int i;
- struct Message *msg;
-
- for (i=0 ; i<NUMPORTS; i++) {
- if (NULL!=StarPort[i]) {
- while (msg=GetMsg(StarPort[i])) ReplyMsg((struct Message *)msg);
- DeleteMsgPort(StarPort[i]);
- }; // if
- }; // for
- } // ClosePorts
-
- //**** End of file
-