jonabbey@ccwf.cc.utexas.edu (Jonathan Abbey) (01/31/91)
Greetings.. I am trying to put together a package on our Alliant (apE 2.0), and have been unsucessful in doing so, as of the moment. One of the stumbling blocks is that a library in apE uses vfprintf and vsprintf, which are versions of fprintf and sprintf designed to work with the varargs macros. I have looked at the source for sprintf and fprintf on our system, and they use a common routine called doprnt(), which accepts arguments in terms of an argument list, such as would be constructed by the varargs macros. It seems what I can see that I should be able to simply substitute sprintf and fprintf for the varargs-specialized versions, but this does not seem to work. Any hints would be gratefully accepted. -- Jonathan Abbey (512) 472-2052 \ (512) 835-3081 jonabbey@ccwf.cc.utexas.edu \ broccol@csdfx8a.arlut.utexas.edu The University of Texas at Austin \ Applied Research Laboratories
d89peter@odalix.ida.liu.se (Peter Eriksson) (02/01/91)
jonabbey@ccwf.cc.utexas.edu (Jonathan Abbey) writes: >Greetings.. I am trying to put together a package on our Alliant (apE 2.0), >and have been unsucessful in doing so, as of the moment. One of the >stumbling blocks is that a library in apE uses vfprintf and vsprintf, which >are versions of fprintf and sprintf designed to work with the varargs >macros. I have looked at the source for sprintf and fprintf on our system, >and they use a common routine called doprnt(), which accepts arguments in >terms of an argument list, such as would be constructed by the varargs >macros. It seems what I can see that I should be able to simply substitute >sprintf and fprintf for the varargs-specialized versions, but this does not >seem to work. >Any hints would be gratefully accepted. 'uunet.uu.net' has in the directory 'bsd-source/lib/libc/stdio' a set of C-sources that implemement a full set of *printf routines.. Or if anyone is interrested I could post/email our version of a modified 'doprnt.c' (that contains all the *printf.c routines as well). The features of this is that the doprnt() routine has been replaced by a more general function that allows you to specify a function to be called when a character is to be output (instead of doing like 'doprnt' does - fiddle with FILE-structures which limits you to strings and FILEs... As you may notice, I think doprnt() is _ugly_). The syntax of our general (and extendible! One can add new output formats (like %Q, or whatever) on the fly with it) function is: int _printf( int (*out_char)(int ch, void *uptr), const char *format, va_list AP, void *uptr) With it it is easy to implement just about any variation of the *printf() functions. (it is even possible to emulate the doprnt() function with it..) /Peter -- Peter Eriksson pen@lysator.liu.se Lysator Computer Club ...!uunet!lysator.liu.se!pen University of Linkoping, Sweden Support the LPF!
blarson@blars (02/01/91)
Use the portable v*printf routines that I posted to comp.sources.misc a year or two ago. There is a modified version being distributed with XRN in violation of my copyright. (The modifacation was not documented.) -- blarson@usc.edu C news and rn for os9/68k! -- Bob Larson (blars) blarson@usc.edu usc!blarson Hiding differences does not make them go away. Accepting differences makes them unimportant.