1 //####COPYRIGHTBEGIN####
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
6 // This program is part of the eCos host tools.
8 // This program is free software; you can redistribute it and/or modify it
9 // under the terms of the GNU General Public License as published by the Free
10 // Software Foundation; either version 2 of the License, or (at your option)
13 // This program is distributed in the hope that it will be useful, but WITHOUT
14 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 // You should have received a copy of the GNU General Public License along with
19 // this program; if not, write to the Free Software Foundation, Inc.,
20 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 // ----------------------------------------------------------------------------
24 //####COPYRIGHTEND####
25 //#####DESCRIPTIONBEGIN####
32 // Description: This is the source file that includes just the standard includes
33 // stdafx.obj will contain the pre-compiled type information
41 //####DESCRIPTIONEND####
43 //===========================================================================
47 void __Trace(LPCTSTR pszFormat, ...)
50 va_start(args, pszFormat);
51 for(int nLength=100;nLength;) {
52 TCHAR *buf=new TCHAR[1+nLength];
53 int n=_vsntprintf(buf, nLength, pszFormat, args);
55 nLength*=2; // NT behavior
56 } else if (n<nLength){
57 OutputDebugString(buf);
58 nLength=0; // trigger exit from loop
60 nLength=n+1; // UNIX behavior generally, or NT behavior when buffer size exactly matches required length