Updated PCI IDs to latest snapshot.
[tangerine.git] / test / notify.c
blob7a148584990ec91e8f8c2cb25661dd922a84ad66
1 #include <exec/types.h>
2 #include <dos/dosextens.h>
3 #include <dos/bptr.h>
4 #include <dos/notify.h>
5 #include <proto/exec.h>
6 #include <proto/dos.h>
7 #include <stdio.h>
8 #include <string.h>
10 int main(int argc, char **argv) {
11 struct NotifyRequest *nr;
12 struct MsgPort *port;
14 if (argc != 2) {
15 printf("usage: %s filename\n", argv[0]);
16 return 1;
19 port = CreateMsgPort();
21 nr = AllocVec(sizeof(struct NotifyRequest) + strlen(argv[1]) + 1, MEMF_PUBLIC | MEMF_CLEAR);
22 nr->nr_Name = (STRPTR) (((UBYTE *) nr) + sizeof(struct NotifyRequest));
24 CopyMem(argv[1], nr->nr_Name, strlen(argv[1]) + 1);
26 nr->nr_Flags = NRF_SEND_MESSAGE;
27 nr->nr_stuff.nr_Msg.nr_Port = port;
29 if (StartNotify(nr) == DOSFALSE) {
30 printf("StartNotify failed: %ld\n", IoErr());
31 return 0;
34 WaitPort(port);
35 ReplyMsg(GetMsg(port));
37 printf("notified\n");
39 EndNotify(nr);
41 return 0;