home *** CD-ROM | disk | FTP | other *** search
- /* *
- * *
- * Copyright 1987, 1988, 1989 Netwise, Inc. *
- * All Rights Reserved *
- * This software contains information which is proprietary to and a trade *
- * secret of Netwise, Inc. It is not to be used, reproduced, or disclosed *
- * except as authorized in your license agreement. *
- * *
- * Restricted Rights Legend *
- * Use, duplication, or disclosure by the Government is subject to *
- * restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in *
- * Technical Data and Computer Software clause at 252.227-7013, or the *
- * equivalent Government clause for other agencies. *
- * Contractor: Netwise, Inc., Boulder, CO 80301 USA *
- * *
- */
- /*
- * File: macro\client\client.c
- *
- * This example works in the following environments:
- * NetWare RPC 1.0, NetWare 2.1 or higher, DOS 3.3
- *
- * This is the driver program for the macro example. The purpose of this
- * example is to illustrate the use of expression macros.
- */
-
- #include <stdio.h>
- #include "macro.h" /* client header file, created by the RPC compiler */
-
- extern int _rpcerr_; /* declare RPC error code */
-
- /* Server_Name is used to set the process-binding variable.
- * It must be defined as the name the server registers under.
- */
- #define Server_Name "example"
-
- /* declare variable of type server_name for process binding */
- server_name sname;
-
- main()
- {
- int result;
- struct record rp;
- char *p;
- extern char *strchr();
-
- sname = Server_Name;
-
- /* example of call to get_record() */
-
- printf("CLIENT: calling get_record(0)\n");
- result = get_record(0, &rp);
-
- if (_rpcerr_) { /* check RPC return code */
- printf("CLIENT: RPC error %d in get_record(0) call\n",
- _rpcerr_);
- exit(1);
- }
-
- /* add trailing null character to each string so they can be printed */
- p = strchr(rp.buffer_1, rp.term_1);
- *++p = '\0';
- p = strchr(rp.r1.buffer_2, rp.term_2);
- *++p = '\0';
- p = strchr(rp.r1.r2.buffer_3, rp.term_3);
- *++p = '\0';
- p = strchr(rp.r1.r2.r3.buffer_4, rp.term_4);
- *++p = '\0';
- p = strchr(rp.r1.r2.r3.buffer_5, rp.term_5);
- *++p = '\0';
-
- if (result == 0) {
- printf("CLIENT: Record contents:\n");
- printf("CLIENT: buffer_1: '%s'\n", rp.buffer_1);
- printf("CLIENT: buffer_2: '%s'\n", rp.r1.buffer_2);
- printf("CLIENT: buffer_3: '%s'\n", rp.r1.r2.buffer_3);
- printf("CLIENT: buffer_4: '%s'\n", rp.r1.r2.r3.buffer_4);
- printf("CLIENT: buffer_5: '%s'\n", rp.r1.r2.r3.buffer_5);
- } else {
- printf("CLIENT: get_record error (%d)\n\n", result);
- }
-
- exit(0);
- }
-