]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - tools/src/tools/configtool/common/win32/StdAfx.cpp
Initial revision
[karo-tx-redboot.git] / tools / src / tools / configtool / common / win32 / StdAfx.cpp
1 //####COPYRIGHTBEGIN####
2 //                                                                          
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
5 //
6 // This program is part of the eCos host tools.
7 //
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) 
11 // any later version.
12 // 
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 
16 // more details.
17 // 
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.
21 //
22 // ----------------------------------------------------------------------------
23 //                                                                          
24 //####COPYRIGHTEND####
25 //#####DESCRIPTIONBEGIN####
26 //
27 // Author(s):   sdf
28 // Contact(s):  sdf
29 // Date:                1998/08/11
30 // Version:             0.01
31 // Purpose:     
32 // Description: This is the source file that includes just the standard includes
33 //                              stdafx.obj will contain the pre-compiled type information
34 //
35 // Requires:    
36 // Provides:    
37 // See also:    
38 // Known bugs:  
39 // Usage:       
40 //
41 //####DESCRIPTIONEND####
42 //
43 //===========================================================================
44
45 #include "stdafx.h"
46
47 void __Trace(LPCTSTR pszFormat, ...)
48 {
49   va_list args;
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); 
54     if(-1==n){
55       nLength*=2;  // NT behavior
56     } else if (n<nLength){
57       OutputDebugString(buf);
58       nLength=0;   // trigger exit from loop
59     } else {
60       nLength=n+1; // UNIX behavior generally, or NT behavior when buffer size exactly matches required length
61     }
62     delete [] buf;
63   }
64   va_end(args);
65 }