--- /dev/null
+/* Test client for the NUMBERS System Service.\r
+ Run this program from another CLI when Service is running\r
+*/\r
+\r
+#include <stdio.h>\r
+#include "\OSSOurce\MKernel.h"\r
+\r
+unsigned long Number; /* The number to return */\r
+unsigned long Exch; /* Where hte service will respond */\r
+unsigned long Message[2]; /* The Message from the service */\r
+\r
+void main(void)\r
+{\r
+unsigned long Error, rqhndl;\r
+\r
+ Error = AllocExch(&Exch); /* get an exchange */\r
+\r
+ if (Error)\r
+ printf("Error %d allocating Exchange.\r\n", Error);\r
+\r
+ Error = Request("NUMBERS ", 1, Exch, &rqhndl,\r
+ 0, /* No Send ptrs */\r
+ &Number, 4, 0, 0,\r
+ 0,0,0);\r
+ if (Error)\r
+ printf("Error %d from Request.\r\n", Error);\r
+\r
+ if (!Error)\r
+ {\r
+ Error = WaitMsg(Exch, Message);\r
+\r
+ if (Error)\r
+ printf("Error %d from WaitMsg.\r\n", Error);\r
+ else\r
+ {\r
+ if (Message[1])\r
+ printf("Error %d from NUMBERS Service.\r\n", Message[1]);\r
+ else\r
+ printf("NUMBERS Service gave out number: %d.\r\n", Number);\r
+ }\r
+ }\r
+\r
+ DeAllocExch(Exch); /* it's nice to do this for the OS */\r
+}\r