home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / os / kludge03.tz / kludge03 / mk74 / user / libmach / sprintf.c < prev    next >
C/C++ Source or Header  |  1992-02-26  |  2KB  |  66 lines

  1. /* 
  2.  * Mach Operating System
  3.  * Copyright (c) 1991,1990,1989 Carnegie Mellon University
  4.  * All Rights Reserved.
  5.  * 
  6.  * Permission to use, copy, modify and distribute this software and its
  7.  * documentation is hereby granted, provided that both the copyright
  8.  * notice and this permission notice appear in all copies of the
  9.  * software, derivative works or modified versions, and any portions
  10.  * thereof, and that both notices appear in supporting documentation.
  11.  * 
  12.  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  13.  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  14.  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  15.  * 
  16.  * Carnegie Mellon requests users of this software to return to
  17.  * 
  18.  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
  19.  *  School of Computer Science
  20.  *  Carnegie Mellon University
  21.  *  Pittsburgh PA 15213-3890
  22.  * 
  23.  * any improvements or extensions that they make and grant Carnegie Mellon
  24.  * the rights to redistribute these changes.
  25.  */
  26. /*
  27.  * HISTORY
  28.  * $Log:    sprintf.c,v $
  29.  * Revision 2.2  92/02/20  15:57:57  elf
  30.  *     Created.
  31.  *     [92/02/11            rpd]
  32.  * 
  33.  */
  34.  
  35. #include <varargs.h>
  36.  
  37. static void
  38. savechar(arg, c)
  39.     char *arg;
  40.     int c;
  41. {
  42.     *(*(char **)arg)++ = c;
  43. }
  44.  
  45. vsprintf(s, fmt, args)
  46.     char *s;
  47.     char *fmt;
  48.     va_list args;
  49. {
  50.     _doprnt(fmt, args, 0, (void (*)()) savechar, (char *) &s);
  51.     *s = 0;
  52. }
  53.  
  54. /*VARARGS2*/
  55. sprintf(s, fmt, va_alist)
  56.     char *s;
  57.     char *fmt;
  58.     va_dcl
  59. {
  60.     va_list    args;
  61.  
  62.     va_start(args);
  63.     vsprintf(s, fmt, args);
  64.     va_end(args);
  65. }
  66.