home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2374 / vprintf.doc < prev   
Encoding:
Text File  |  1990-12-28  |  1.7 KB  |  45 lines

  1. Portable vsprintf, vfprintf, and vprintf  by Robert A. Larson
  2.     <blarson@skat.usc.edu>
  3.  
  4. Copyright 1989 Robert A. Larson.
  5. Distribution in any form is allowed as long as the author
  6. retains credit, changes are noted by their author and the
  7. copyright message remains intact.  This program comes as-is
  8. with no warentee of fitness for any purpouse.
  9.  
  10. Thanks to Doug Gwen, Chris Torek, and others who helped clarify
  11. the ansi printf specs.
  12.  
  13. Please send any bug fixes and improvments to blarson@skat.usc.edu .
  14. The use of goto is NOT a bug.
  15.  
  16.  
  17. Feb  9, 1989        blarson        First usenet release
  18.  
  19. This code implements the vsprintf function, without relying on
  20. the existance of _doprint or other system specific code.
  21.  
  22. Define NOVOID if void * is not a supported type.
  23.  
  24. Two compile options are available for efficency:
  25.     INTSPRINTF    should be defined if sprintf is int and returns
  26.             the number of chacters formated.
  27.     LONGINT        should be defined if sizeof(long) == sizeof(int)
  28.  
  29.     They only make the code smaller and faster, they need not be 
  30.     defined.
  31.  
  32. UNSIGNEDSPECIAL should be defined if unsigned is treated differently
  33. than int in argument passing.  If this is definded, and LONGINT is not,
  34. the compiler must support the type unsigned long.
  35.  
  36. Most quirks and bugs of the available sprintf and fprintf fuction are
  37. duplicated, however * in the width and precision fields will work
  38. correctly even if sprintf does not support this, and the %n format
  39. will always work in vsprintf.  %n and return count will work properly
  40. in vfprintf and vprintf only if fprintf returns the number of
  41. characters formatted.
  42.  
  43. Bad format strings, or those with very long width and precision
  44. fields (including expanded * fields) will cause undesired results.
  45.