diff options
| author | Peter Wemm <peter@FreeBSD.org> | 1997-07-13 14:26:00 +0000 |
|---|---|---|
| committer | Peter Wemm <peter@FreeBSD.org> | 1997-07-13 14:26:00 +0000 |
| commit | 65b3003d2db57c7e7f521f5f091ed7adbc151768 (patch) | |
| tree | 6cb1cae680da34e1b89adddca017fcd9e7b0e5cf /lib/librpc/demo/msg | |
| parent | 365c3451674ab5dfb12a9ecceb485abc1cdff35c (diff) | |
Notes
Diffstat (limited to 'lib/librpc/demo/msg')
| -rw-r--r-- | lib/librpc/demo/msg/Makefile | 36 | ||||
| -rw-r--r-- | lib/librpc/demo/msg/msg.x | 9 | ||||
| -rw-r--r-- | lib/librpc/demo/msg/msg_proc.c | 28 | ||||
| -rw-r--r-- | lib/librpc/demo/msg/printmsg.c | 43 | ||||
| -rw-r--r-- | lib/librpc/demo/msg/rprintmsg.c | 74 |
5 files changed, 0 insertions, 190 deletions
diff --git a/lib/librpc/demo/msg/Makefile b/lib/librpc/demo/msg/Makefile deleted file mode 100644 index 2f3f5ddf1655..000000000000 --- a/lib/librpc/demo/msg/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# -# @(#)Makefile 2.1 88/08/11 4.0 RPCSRC -# -BIN = printmsg msg_svc rprintmsg -GEN = msg_clnt.c msg_svc.c msg.h -LIB = -lrpclib -RPCCOM = rpcgen - -all: $(BIN) - -# -# This is the non-networked version of the program -# -printmsg: printmsg.o - $(CC) -o $@ printmsg.o - -# -# note: no xdr routines are generated here, due this service's -# use of basic data types. -# -$(GEN): msg.x - $(RPCCOM) msg.x - -msg_svc: msg_proc.o msg_svc.o - $(CC) -o $@ msg_proc.o msg_svc.o $(LIB) - -rprintmsg: rprintmsg.o msg_clnt.o - $(CC) -o $@ rprintmsg.o msg_clnt.o $(LIB) - -rprintmsg.o: rprintmsg.c msg.h - -msg_proc.o: msg_proc.c msg.h - -clean cleanup: - rm -f $(GEN) *.o $(BIN) - diff --git a/lib/librpc/demo/msg/msg.x b/lib/librpc/demo/msg/msg.x deleted file mode 100644 index d3113520d822..000000000000 --- a/lib/librpc/demo/msg/msg.x +++ /dev/null @@ -1,9 +0,0 @@ -/* @(#)msg.x 2.1 88/08/11 4.0 RPCSRC */ -/* - * msg.x: Remote message printing protocol - */ -program MESSAGEPROG { - version MESSAGEVERS { - int PRINTMESSAGE(string) = 1; - } = 1; -} = 99; diff --git a/lib/librpc/demo/msg/msg_proc.c b/lib/librpc/demo/msg/msg_proc.c deleted file mode 100644 index 80e5d959aa7f..000000000000 --- a/lib/librpc/demo/msg/msg_proc.c +++ /dev/null @@ -1,28 +0,0 @@ -/* @(#)msg_proc.c 2.1 88/08/11 4.0 RPCSRC */ -/* - * msg_proc.c: implementation of the remote procedure "printmessage" - */ -#include <stdio.h> -#include <rpc/rpc.h> /* always need this here */ -#include "msg.h" /* need this too: msg.h will be generated by rpcgen */ - -/* - * Remote verson of "printmessage" - */ -int * -printmessage_1(msg) - char **msg; -{ - static int result; /* must be static! */ - FILE *f; - - f = fopen("/dev/console", "w"); - if (f == NULL) { - result = 0; - return (&result); - } - fprintf(f, "%s\n", *msg); - fclose(f); - result = 1; - return (&result); -} diff --git a/lib/librpc/demo/msg/printmsg.c b/lib/librpc/demo/msg/printmsg.c deleted file mode 100644 index dde55dd86709..000000000000 --- a/lib/librpc/demo/msg/printmsg.c +++ /dev/null @@ -1,43 +0,0 @@ -/* @(#)printmsg.c 2.1 88/08/11 4.0 RPCSRC */ -/* - * printmsg.c: print a message on the console - */ -#include <stdio.h> - -main(argc, argv) - int argc; - char *argv[]; -{ - char *message; - - if (argc < 2) { - fprintf(stderr, "usage: %s <message>\n", argv[0]); - exit(1); - } - message = argv[1]; - - if (!printmessage(message)) { - fprintf(stderr, "%s: sorry, couldn't print your message\n", - argv[0]); - exit(1); - } - printf("Message delivered!\n"); -} - -/* - * Print a message to the console. - * Return a boolean indicating whether the message was actually printed. - */ -printmessage(msg) - char *msg; -{ - FILE *f; - - f = fopen("/dev/console", "w"); - if (f == NULL) { - return (0); - } - fprintf(f, "%s\n", msg); - fclose(f); - return(1); -} diff --git a/lib/librpc/demo/msg/rprintmsg.c b/lib/librpc/demo/msg/rprintmsg.c deleted file mode 100644 index b9cb1e361706..000000000000 --- a/lib/librpc/demo/msg/rprintmsg.c +++ /dev/null @@ -1,74 +0,0 @@ -/* @(#)rprintmsg.c 2.1 88/08/11 4.0 RPCSRC */ -/* - * rprintmsg.c: remote version of "printmsg.c" - */ -#include <stdio.h> -#include <rpc/rpc.h> /* always need this */ -#include "msg.h" /* need this too: will be generated by rpcgen*/ - -main(argc, argv) - int argc; - char *argv[]; -{ - CLIENT *cl; - int *result; - char *server; - char *message; - - if (argc < 3) { - fprintf(stderr, "usage: %s host message\n", argv[0]); - exit(1); - } - - /* - * Remember what our command line arguments refer to - */ - 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 die. - */ - 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 die. - */ - 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 die. - */ - fprintf(stderr, "%s: sorry, %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); -} |
