Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!cbmvax!bpa!asi!metro From: metro@asi.UUCP Newsgroups: net.sources Subject: Re: Public Domain _doprnt in C Message-ID: <100@asi.UUCP> Date: Fri, 27-Mar-87 22:23:39 EST Article-I.D.: asi.100 Posted: Fri Mar 27 22:23:39 1987 Date-Received: Sun, 29-Mar-87 12:09:30 EST References: <938@copper.TEK.COM> Organization: Assessment Systems, Inc., Philadelphia, PA Lines: 40 Summary: One way on the AT&T 3B2 I am not familiar with the _doprnt() routine, however I had a need to perform a similar function. I wanted to write a function of the form: fperror(fmt,args) char *fmt; int args; { } which would function much like printf(). However, depending on system parameters, would perform various logging of the error messages. The obvious way would be to use sprintf() to format the message and then pass the buffer to my routine. This is what i origionally did. However, it made the code somewhat unreadable. Then I realized that the vsprintf() routine provided with my c library took its parameters in the same form as &args of above. The function then bacame: fperror(fmt,args) char *fmt; int args; { char msgbuff[128]; vsprintf(msgbuff,fmt,&args); /* format args into msgbuff based on fmt */ . . . process the formatted arguments. } This is very likely not portable. However, on a machine where this method works, I would much rather have my parameters processed by the SAME routine as other sprintf's, printf's, and fprintf's. And save a home-brew routine for other systems. -- Metro T. Sauper, Jr. Assessment Systems, Inc. Director, Remote Systems Development 210 South Fourth Street (215) 592-8900 ..!asi!metro Philadelphia, PA 19106