home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * MISC.C - support routines - Phillip Lindsay (C) Commodore 1986
- * You may freely distribute this source and use it for Amiga Development -
- * as long as the Copyright notice is left intact.
- *
- * $Header: Beta:src/uucp/src/uuser/RCS/misc.c,v 1.1 90/02/02 12:10:13 dillon Exp Locker: dillon $
- *
- * (C) Copyright 1989-1990 by Matthew Dillon, All Rights Reserved.
- *
- * 30-SEP-86
- *
- * major modifications by Matthew Dillon for my PIPE: and other devices,
- * but basic theorem still Phil's.
- */
-
- #include <exec/types.h>
- #include <exec/nodes.h>
- #include <exec/lists.h>
- #include <exec/ports.h>
- #include <libraries/dos.h>
- #include <libraries/dosextens.h>
- #include "protos.h"
-
- typedef struct Node NODE;
-
- extern void returnpkt();
-
- void
- returnpktplain(packet, myproc)
- struct DosPacket *packet;
- struct Process *myproc;
- {
- returnpkt(packet, myproc, packet->dp_Res1, packet->dp_Res2);
- }
-
-
- void
- returnpkt(packet, myproc, res1, res2)
- register struct DosPacket *packet;
- struct Process *myproc;
- long res1, res2;
- {
- struct Message *mess;
- struct MsgPort *replyport;
-
- packet->dp_Res1 = res1;
- packet->dp_Res2 = res2;
- replyport = packet->dp_Port;
- mess = packet->dp_Link;
- packet->dp_Port = &myproc->pr_MsgPort;
- mess->mn_Node.ln_Name = (char *)packet;
- mess->mn_Node.ln_Succ = NULL;
- mess->mn_Node.ln_Pred = NULL;
- PutMsg(replyport, mess);
- }
-
-
- /*
- * taskwait() ... Waits for a message to arrive at your port and
- * extracts the packet address which is returned to you.
- */
-
- struct DosPacket *
- taskwait(myproc)
- struct Process *myproc;
- {
- struct MsgPort *myport;
- struct Message *mymess;
-
- myport = &myproc->pr_MsgPort;
- WaitPort(myport);
- mymess = (struct Message *)GetMsg(myport);
- return((struct DosPacket *)mymess->mn_Node.ln_Name);
- }
-
- taskpktrdy(myproc)
- struct Process *myproc;
- {
- if (((NODE *)myproc->pr_MsgPort.mp_MsgList.lh_Head)->ln_Succ == NULL)
- return(0);
- return(1);
- }
-
-