🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.protocols.misc
1 messages
1 total messages Started by Jim Wright Wed, 18 Jul 1990 20:53
RPCGEN and array of strings
#212
Author: Jim Wright
Date: Wed, 18 Jul 1990 20:53
48 lines
1711 bytes
In an RPC call, part of the structure I'm passing is an array of strings.
All is OK on the server before returning, but the client only sees garbage.
The samples below have lots removed, but I hope they get the idea across.
Specifically, I don't have any lack of error checking in the real code.
Are there any special tricks involved in passing an array of strings?  Any
help is greatly appreciated.

=================
from rpcgen file:
=================
const NUMERRSTR = 4;
typedef string ErrorStr<>;
union ErrorStrs switch (int errno) {
	case 0:
		ErrorStr str[NUMERRSTR];
	default:
		void;
};
=====================
from the server side:
=====================
ErrorStrs errorstrs;

ErrorStrs *logger_geterr_1(device)
char **device;
{
	for (n=0 ; n<NUMERRSTR ; n++) {
		HPIB_WRITE (hh_id, "ERRSTR?");
		HPIB_READ (hh_id, buffer, 255);
		errorstrs.ErrorStrs_u.str[n] = strtok(buffer, "\n\r");
		fprintf (stderr, "%s\n", errorstrs.ErrorStrs_u.str[n]);
	}
	errorstrs.errno = 0;
	return (&errorstrs);
}
=====================
from the client side:
=====================

        errorstrs = logger_geterr_1(&device, cl);
	for (n=0 ; n<NUMERRSTR ; n++) {
		printf ("%d - %s\n", n, errorstrs->ErrorStrs_u.str[n]);
	}

--
Jim Wright
jwright@quonset.cfht.hawaii.edu
Canada-France-Hawaii Telescope Corp.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads