Path: utzoo!mnetor!uunet!husc6!uwvax!oddjob!gargoyle!ihnp4!tness1!mechjgh From: mechjgh@tness1.UUCP (Greg Hackney 214+464-2771) Newsgroups: comp.sys.pyramid Subject: Re: Wrapper function to sprintf Message-ID: <432@tness1.UUCP> Date: 6 Mar 88 01:01:38 GMT References: <8803040308.AA02292@mimsy.umd.edu> Reply-To: mechjgh@tness1.UUCP (Greg Hackney) Organization: S.W. Bell, Network Engineering, Dallas, Texas Lines: 99 In article <8803040308.AA02292@mimsy.umd.edu> chris@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 f._cnt = MAXINT; -- Greg Hackney Southwestern Bell Telephone Co. Dallas, Texas mechjgh@tness1.UUCP {ihnp4,bellcore,killer}!tness1!mechjgh Newsgroups: comp.sys.pyramid Subject: Re: Wrapper function to sprintf Summary: Expires: References: <8803040308.AA02292@mimsy.umd.edu> Sender: Reply-To: mechjgh@tness1.UUCP (Greg Hackney) Followup-To: Distribution: Organization: S.W. Bell, Network Engineering, Dallas, Texas Keywords: In article <8803040308.AA02292@mimsy.umd.edu> chris@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 f._cnt = MAXINT; -- Greg Hackney Southwestern Bell Telephone Co. Dallas, Texas mechjgh@tness1.UUCP {ihnp4,bellcore,killer}!tness1!mechjgh