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: link\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 link example. This driver
- * program calls the remote procedure add_record 3 times to build the
- * linked list and then prints out the linked list, first traversing
- * the list forward and then backward.
- */
-
- #include <stdio.h>
- #include "link.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;
-
- struct customer *cust_list; /* pointer to head of linked list */
-
- main()
- {
- struct customer *fp, *bp;
- int result;
-
- sname = Server_Name;
-
- cust_list = (struct customer *)0;
-
- /* example of call to add_record() */
-
- printf("CLIENT: calling add_record()\n");
- result = add_record("Ralph Cramden", "Brooklyn, NY", "555-3333");
-
- if (_rpcerr_) { /* check RPC return code */
- printf("CLIENT: RPC error %d in add_record() call\n",
- _rpcerr_);
- exit(1);
- }
- printf("CLIENT: add_record() returned %d\n\n", result);
-
- /* second call to add_record() */
-
- printf("CLIENT: calling add_record()\n");
- result = add_record("Andy Taylor ", "Mayberry, NC", "555-6789");
-
- if (_rpcerr_) { /* check RPC return code */
- printf("CLIENT: RPC error %d in add_record() call\n",
- _rpcerr_);
- exit(1);
- }
- printf("CLIENT: add_record() returned %d\n\n", result);
-
- /* third call to add_record() */
-
- printf("CLIENT: calling add_record()\n");
- result = add_record("Fred Flintstone", "Bedrock", "555-2222");
-
- if (_rpcerr_) { /* check RPC return code */
- printf("CLIENT: RPC error %d in add_record() call\n",
- _rpcerr_);
- exit(1);
- }
- printf("CLIENT: add_record() returned %d\n\n", result);
-
- printf("\n\nCLIENT: Customer List (using forward links):\n");
- bp=(struct customer *)0;
-
- for (fp = cust_list; fp != (struct customer *)0; fp = fp->c_next) {
- printf(" %s %s %s\n", fp->c_name,
- fp->c_addr, fp->c_phone);
- bp=fp;
- }
-
- printf("\n\n\nCLIENT: Customer List (using backward links):\n");
-
- for ( ; bp != (struct customer *)0; bp = bp->c_prev) {
- printf(" %s %s %s\n", bp->c_name,
- bp->c_addr, bp->c_phone);
- }
-
- exit(0);
- }
-