1 #include <exec/types.h>
2 #include <dos/dosextens.h>
4 #include <dos/notify.h>
5 #include <proto/exec.h>
10 int main(int argc
, char **argv
)
12 struct NotifyRequest
*nr
;
18 printf("usage: %s filename\n", argv
[0]);
22 port
= CreateMsgPort();
24 nr
= AllocVec(sizeof(struct NotifyRequest
) + strlen(argv
[1]) + 1, MEMF_PUBLIC
| MEMF_CLEAR
);
25 nr
->nr_Name
= (STRPTR
) (((UBYTE
*) nr
) + sizeof(struct NotifyRequest
));
27 CopyMem(argv
[1], nr
->nr_Name
, strlen(argv
[1]) + 1);
29 nr
->nr_Flags
= NRF_SEND_MESSAGE
;
30 nr
->nr_stuff
.nr_Msg
.nr_Port
= port
;
32 if (StartNotify(nr
) == DOSFALSE
)
34 printf("StartNotify failed: %ld\n", (long)IoErr());
39 Wait((1L << port
->mp_SigBit
) | SIGBREAKF_CTRL_C
);
48 printf("CTRL-C received\n");