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: pointer1\server\rproc.c
- *
- * This example runs in the following environment:
- * NetWare RPC 1.0, NetWare 2.1 or higher, DOS 3.3
- *
- * This file contains the remote procedures for the pointer example.
- */
-
- #include <stdio.h>
- #include "pointer1.h" /* server header file, created by the RPC compiler */
-
- struct info names[] = {
- { "Rocket", "Squirrel", 25 },
- { "Bullwinkle", "Moose", 27 },
- { "Dudley", "Doright", 34 }
- };
-
- int
- get_data(data)
- struct info ***data; /* address of sequence of pointers to structures */
- {
- struct info **top;
- int i;
- extern char *malloc();
-
- printf("SERVER: get_data() called \n");
-
- /* allocate memory for sequence of pointers to structures; this
- * memory will be deallocated via the exit statement in the RPC
- * specification
- */
- if ((*data=(struct info **)malloc(10 * sizeof (struct info *))) ==
- (struct info **)NULL) {
- printf ("malloc failed! execution aborted\n");
- exit (1);
- }
- top = *data;
-
- /* for each pointer in the sequence, assign it to point to a structure;
- * each structure, for convenience, is not dynamically allocated, but
- * is statically allocated and initialized above
- */
- for (i=0; i<3; i++) {
- *top++ = &names[i];
- }
- /* the final pointer must be NULL */
- *top = (struct info *)NULL;
-
- return (0);
- }
-