[net.unix] _doprnt query

daemon@houligan.UUCP (12/18/85)

Relay-Version: version B 2.10.1 6/24/83; site houligan.UUCP
Posting-Version: version B 2.10.2 9/18/84; site ur-tut.UUCP
Path: houligan!novavax!ucf-cs!peora!codas!akguc!akgua!gatech!seismo!rochester!ur-tut!tfra
From: tfra@ur-tut.UUCP (Thomas Fravenhofer)
Newsgroups: net.unix,net.unix-wizards
Subject: "_doprnt" query
Message-ID: <280@ur-tut.UUCP>
Date: Sun, 8-Dec-85 11:01:50 EST
Article-I.D.: ur-tut.280
Posted: Sun Dec  8 11:01:50 1985
Date-Received: Mon, 16-Dec-85 20:18:59 EST
Reply-To: tfra@ur-tut.UUCP (Thomas Fravenhofer)
Distribution: net
Organization: Univ. of Rochester Computing Center
Lines: 11
Keywords: _doprnt _dontprnt _willprnt _wontprnt
Xref: peora net.unix:4811 net.unix-wizards:7716

In <280@ur-tut.UUCP> tfra@ur-tut.UUCP (Thomas Fravenhofer) writes:

I am trying to get a screen editor working on my Fortune 32:16 system.
It keeps crashing in the routine "_doprnt" (giving me a memory
addressing error).  I can't seem to find any documentation on it.

Tom

The "_doprnt" routine is the "low-level" routine that actually does the
"grunt labor" for the various "printf" family members (fprintf,
sprintf).  I'd suggest taking a look at the arguments being passed.
Generally speaking, when I have encountered a problem in this area, it
has been caused by something like:

	printf("%s", bad_address)

due to "_doprnt" trying to fetch characters from "bad_address" and
getting a "memory fault", "segmentation violation", or however your
local system implements it.

The arguments to "_doprnt" are not always the same in all
implementations, since it is not intended to be a "user-visible" (or
callable) function (even though there is a direct call to it in some
"termcap" implementations).  Generally, its argument list will be
something like this:

	_doprnt(format, args, iop)
	char *format;	/* like "%d", "%s", "blah %d\n" */
	char **args;	/* pointer to args on caller's stack frame */
	FILE *iop;	/* "stdin", "stdout", from fopen(), etc */

The "args" will be generated by (greatly simplified for clarity):

	printf(format, arg1, arg2, arg3, ... )
	char *format;
	{
		_doprnt(format, &arg1, stdout);

Thus, if you examine the first argument to "_doprnt", it should be an
address, pointing to the control string.  The corresponding slot in the
array pointed to by "args" will be the offending address.

Another possibility is that the "iop" (FILE pointer) passed is bad.  Be
sure that the third argument is non-zero.  If you can find the address
of the "_iob" (check this name in your "/usr/include/stdio.h") array,
check that the "iop" argument seems within a reasonable distance (you
can calculate the size of the structure, and then guestimate which slot
it is using).

--tgi
	while (--tgi)	/* my mind continues to decay */
		;	/* even though I do nothing.. */    

{brl-bmd,ccvaxa,pur-ee,sun}!csd-gould!midas!tgi (Craig Strickland @ Gould)
305/587-2900 x5014  CompuServe: 76545,1007   Source: BDQ615   MCIMail: 272-3350

(echo ".ft B"; echo ".ps 999"; echo "$disclaimer") | troff -t	# :-)