Wrapper function to sprintf
Greg Hackney 214+464-2771
mechjgh at tness1.UUCP
Sun Mar 6 11:01:38 AEST 1988
In article <8803040308.AA02292 at mimsy.umd.edu> chris at MIMSY.UMD.EDU (Chris Torek) writes:
>I am afraid I have to agree with Greg Hackney's own description of
>his method:
>
> I couldn't figure out how to pass an array of pointers to sprintf()
> and make it work correctly, but here's a dippy way that does work.
Ouch Chris.
>There *is* a way to implement the desired `dialog' function, however.
>A careful scan of the manuals reveals the `vsprintf' function.
>/* if you need it: */
>#ifdef notdef
>int
>vsprintf(str, fmt, arg)
> char *str, *fmt;
> va_list arg;
>{
> FILE f;
> int ret;
>
> f._flag = _IOSTRG; /* leave out _IOWRT to avoid libc bug */
> f._base = f._ptr = str;
> ret = _doprnt(fmt, arg, &f);
> *f._ptr = 0;
> return (ret);
>}
>#endif
The code (vsprintf) does work in the SysV universe, but there were 2 lines
that needed to be added to make it work in the Pyramid BSD environment...
#include <values.h>
f._cnt = MAXINT;
--
Greg Hackney
Southwestern Bell Telephone Co.
Dallas, Texas
mechjgh at tness1.UUCP
{ihnp4,bellcore,killer}!tness1!mechjgh
Newsgroups: comp.sys.pyramid
Subject: Re: Wrapper function to sprintf
Summary:
Expires:
References: <8803040308.AA02292 at mimsy.umd.edu>
Sender:
Reply-To: mechjgh at tness1.UUCP (Greg Hackney)
Followup-To:
Distribution:
Organization: S.W. Bell, Network Engineering, Dallas, Texas
Keywords:
In article <8803040308.AA02292 at mimsy.umd.edu> chris at MIMSY.UMD.EDU (Chris Torek) writes:
>I am afraid I have to agree with Greg Hackney's own description of
>his method:
>
> I couldn't figure out how to pass an array of pointers to sprintf()
> and make it work correctly, but here's a dippy way that does work.
Ouch Chris.
>There *is* a way to implement the desired `dialog' function, however.
>A careful scan of the manuals reveals the `vsprintf' function.
>/* if you need it: */
>#ifdef notdef
>int
>vsprintf(str, fmt, arg)
> char *str, *fmt;
> va_list arg;
>{
> FILE f;
> int ret;
>
> f._flag = _IOSTRG; /* leave out _IOWRT to avoid libc bug */
> f._base = f._ptr = str;
> ret = _doprnt(fmt, arg, &f);
> *f._ptr = 0;
> return (ret);
>}
>#endif
The code (vsprintf) does work in the SysV universe, but there were 2 lines
that needed to be added to make it work in the Pyramid BSD environment...
#include <values.h>
f._cnt = MAXINT;
--
Greg Hackney
Southwestern Bell Telephone Co.
Dallas, Texas
mechjgh at tness1.UUCP
{ihnp4,bellcore,killer}!tness1!mechjgh
More information about the Comp.sys.pyramid
mailing list