Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
2.0 KiB

  1. /***
  2. *vwprintf.c - wprintf from a var args pointer
  3. *
  4. * Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * defines vwprintf() - print formatted data from an argument list pointer
  8. *
  9. *Revision History:
  10. * 05-16-92 KRS Created from vprintf.c
  11. * 04-06-93 SKS Replace _CRTAPI* with __cdecl
  12. * 02-07-94 CFW POSIXify.
  13. * 09-06-94 CFW Replace MTHREAD with _MT.
  14. * 02-06-94 CFW assert -> _ASSERTE.
  15. * 03-07-95 GJF _[un]lock_str macros now take FILE * arg.
  16. * 03-02-98 GJF Exception-safe locking.
  17. *
  18. *******************************************************************************/
  19. #ifndef _POSIX_
  20. #include <cruntime.h>
  21. #include <stdio.h>
  22. #include <wchar.h>
  23. #include <dbgint.h>
  24. #include <stdarg.h>
  25. #include <internal.h>
  26. #include <file2.h>
  27. #include <mtdll.h>
  28. /***
  29. *int vwprintf(format, ap) - print formatted data from an argument list pointer
  30. *
  31. *Purpose:
  32. * Prints formatted data items to stdout. Uses a pointer to a
  33. * variable length list of arguments instead of an argument list.
  34. *
  35. *Entry:
  36. * wchar_t *format - format string, describes data format to write
  37. * va_list ap - pointer to variable length arg list
  38. *
  39. *Exit:
  40. * returns number of wide characters written
  41. *
  42. *Exceptions:
  43. *
  44. *******************************************************************************/
  45. int __cdecl vwprintf (
  46. const wchar_t *format,
  47. va_list ap
  48. )
  49. /*
  50. * stdout 'V'ariable, 'W'char_t 'PRINT', 'F'ormatted
  51. */
  52. {
  53. REG1 FILE *stream = stdout;
  54. REG2 int buffing;
  55. REG3 int retval;
  56. _ASSERTE(format != NULL);
  57. #ifdef _MT
  58. _lock_str(stream);
  59. __try {
  60. #endif
  61. buffing = _stbuf(stream);
  62. retval = _woutput(stream, format, ap );
  63. _ftbuf(buffing, stream);
  64. #ifdef _MT
  65. }
  66. __finally {
  67. _unlock_str(stream);
  68. }
  69. #endif
  70. return(retval);
  71. }
  72. #endif /* _POSIX_ */