/* CMS REPLACEMENT HISTORY, Element RPRINTMSG.C */ /* 1I1 25-APR-2006 16:33:20 MYTH "V56 baselevel code freeze" */ /* 1H1 13-JUN-2004 15:49:51 MILLIGAN "V55 baselevel code freeze" */ /* 1G1 11-MAY-2003 23:11:39 TIBBERT "V54 baselevel code freeze" */ /* 1F1 22-JAN-2002 20:41:39 SYSTEM "V53 baselevel code freeze" */ /* 1E1 2-MAY-2001 04:48:19 MILLIGAN "V52 baselevel code freeze" */ /* 1D1 11-DEC-2000 23:07:27 MYTH "V51 baselevel code freeze" */ /* 1C1 12-MAY-2000 05:55:38 MUGGERIDGE "V51IFT baselevel code freeze" */ /* 1B1 28-OCT-1998 21:14:47 MUGGERIDGE "V50SSB baselevel code freeze" */ /* 1A1 18-JUN-1998 08:01:47 MUGGERIDGE "V50IFT baselevel code freeze" */ /* *1 9-OCT-1997 19:19:31 GEMIGNANI "Initial population of IPv6 source" */ /* CMS REPLACEMENT HISTORY, Element RPRINTMSG.C */ /* ** rprintmsg.c: remote OpenVMS version of "printmsg.c" */ #include #include /* always needed */ #include "msg.h" /* msg.h will be generated by rpcgen */ main(argc, argv) int argc; char *argv[]; { CLIENT *cl; char *message; int *result; char *server; if (argc != 3) { fprintf(stderr, "usage: %s host message\n", argv[0]); exit(1); } server = argv[1]; message = argv[2]; /* ** Create client "handle" used for calling MESSAGEPROG on ** the server designated on the command line. We tell ** the RPC package to use the TCP protocol when ** contacting the server. */ cl = clnt_create(server, MESSAGEPROG, MESSAGEVERS, "tcp"); if (cl == NULL) { /* ** Couldn't establish connection with server. ** Print error message and stop. */ clnt_pcreateerror(server); exit(1); } /* ** Call the remote procedure "printmessage" on the server */ result = printmessage_1(&message, cl); if (result == NULL) { /* ** An error occurred while calling the server. ** Print error message and stop. */ clnt_perror(cl, server); exit(1); } /* ** Okay, we successfully called the remote procedure. */ if (*result == 0) { /* ** Server was unable to print our message. ** Print error message and stop. */ fprintf(stderr, "%s: %s couldn't print your message\n", argv[0], server); exit(1); } /* ** The message got printed on the server's console */ printf("Message delivered to %s!\n", server); exit(0); }