]> pd.if.org Git - mmurtl/commitdiff
autocommit for file dated 1995-02-05 10:18:56
authorRichard Burgess <>
Sun, 5 Feb 1995 10:18:56 +0000 (10:18 +0000)
committerNathan Wagner <nw@hydaspes.if.org>
Mon, 17 Oct 2016 14:03:48 +0000 (14:03 +0000)
msamples/service/testsvc.c [new file with mode: 0644]

diff --git a/msamples/service/testsvc.c b/msamples/service/testsvc.c
new file mode 100644 (file)
index 0000000..107290f
--- /dev/null
@@ -0,0 +1,44 @@
+/* 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