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: error\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 error example. The purpose of this
- * example is to illustrate how to add custom code to a client stub. In
- * this case, the custom code reports RPC errors using the return values
- * of a remote procedure call.
- *
- * This driver program calls the remote procedure update_key() and prints
- * the result. Refer to the error_i.rpc file (which is imported into the
- * error.rpc file) to see how the client stub is customized.
- */
- #include <stdio.h>
- #include "error.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 current_key;
- int result;
-
- sname = Server_Name;
-
- current_key = 0;
-
- /* Example of call to update_key() */
- printf("CLIENT: update_key called \n");
- result = update_key(¤t_key);
-
- if (result == 0) {
- printf("CLIENT: update_key() returned key %d\n",current_key);
- } else {
- /* Note that RPC errors will be reported here also */
- printf("CLIENT: update_key error (%d)\n", result);
- }
-
- /* Example of another call to update_key() */
- printf("CLIENT: update_key called again\n");
- result = update_key(¤t_key);
-
- if (result == 0) {
- printf("CLIENT: update_key() returned key %d\n",current_key);
- } else {
- /* Note that RPC errors will be reported here also */
- printf("CLIENT: update_key error (%d)\n", result);
- }
-
- exit(0);
- }
-