sprint.c 651 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  3. * See the copyright notice in the ACK home directory, in the file "Copyright".
  4. */
  5. /* $Id$ */
  6. #include <system.h>
  7. #include "print.h"
  8. #include "param.h"
  9. /*FORMAT1v $
  10. %s = char *
  11. %l = long
  12. %c = int
  13. %[uxbo] = unsigned int
  14. %d = int
  15. $ */
  16. /*VARARGS*/
  17. char *
  18. sprint
  19. #if __STDC__
  20. (char *buf, char *fmt, ...)
  21. {
  22. #else
  23. (va_alist)
  24. va_dcl
  25. {
  26. char *buf, *fmt;
  27. #endif
  28. va_list args;
  29. #if __STDC__
  30. va_start(args, fmt);
  31. #else
  32. va_start(args);
  33. buf = va_arg(args, char *);
  34. fmt = va_arg(args, char *);
  35. #endif
  36. buf[_format(buf, fmt, args)] = '\0';
  37. va_end(args);
  38. return buf;
  39. }