~n-muench/ubuntu/oneiric/open-vm-tools/open-vm-tools.fix-836277

« back to all changes in this revision

Viewing changes to toolbox/stub.c

  • Committer: Bazaar Package Importer
  • Author(s): Devid Antonio Filoni
  • Date: 2008-08-15 21:21:40 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080815212140-05fhxj8wroosysmj
Tags: 2008.08.08-109361-1ubuntu1
* Merge from Debian unstable (LP: #258393), remaining Ubuntu change:
  - add ubuntu_toolchain_FTBFS.dpatch patch, fix FTBFS
* Update ubuntu_toolchain_FTBFS.dpatch patch for the new version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*********************************************************
2
 
 * Copyright (C) 1998 VMware, Inc. All rights reserved.
3
 
 *
4
 
 * This program is free software; you can redistribute it and/or modify it
5
 
 * under the terms of the GNU Lesser General Public License as published
6
 
 * by the Free Software Foundation version 2.1 and no later version.
7
 
 *
8
 
 * This program is distributed in the hope that it will be useful, but
9
 
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10
 
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the Lesser GNU General Public
11
 
 * License for more details.
12
 
 *
13
 
 * You should have received a copy of the GNU Lesser General Public License
14
 
 * along with this program; if not, write to the Free Software Foundation, Inc.,
15
 
 * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA.
16
 
 *
17
 
 *********************************************************/
18
 
 
19
 
/*
20
 
 * stub.c --
21
 
 *
22
 
 *   Stub for unuseful functions. Stolen from one of the other
23
 
 *   13 stub.c files in bora. This is necessary because the 
24
 
 *   toolbox uses FileIO_* API, which in turn uses these suckers
25
 
 *   below.
26
 
 *   --Ganesh.
27
 
 *
28
 
 */
29
 
 
30
 
#ifndef VMX86_DEVEL
31
 
 
32
 
#endif 
33
 
 
34
 
 
35
 
#include <stdlib.h>
36
 
#include <stdio.h>
37
 
#include <sys/types.h>
38
 
#include <stdarg.h>
39
 
#include <string.h>
40
 
 
41
 
#ifdef _MSC_VER
42
 
#   include <io.h>
43
 
#   include <windows.h>
44
 
#endif
45
 
 
46
 
 
47
 
#include "vm_version.h"
48
 
#include "vm_assert.h"
49
 
#include "vmware.h"
50
 
#include "str.h"
51
 
#include "debug.h"
52
 
 
53
 
#ifdef _WIN32
54
 
#include "poll.h"
55
 
#endif
56
 
 
57
 
#if defined(N_PLAT_NLM)
58
 
char *
59
 
File_GetTmpDir(Bool useConf)
60
 
{
61
 
   return NULL;
62
 
}
63
 
#endif
64
 
 
65
 
 
66
 
/*
67
 
 *----------------------------------------------------------------------
68
 
 *
69
 
 * StubVprintf --
70
 
 *
71
 
 *      Output error text.
72
 
 *
73
 
 * Results:
74
 
 *      
75
 
 *      None.
76
 
 *
77
 
 * Side effects:
78
 
 *
79
 
 *      None.
80
 
 *
81
 
 *----------------------------------------------------------------------
82
 
 */
83
 
 
84
 
void
85
 
StubVprintf(const char *prefix,
86
 
            const char *fmt,
87
 
            va_list args)
88
 
{
89
 
   char *str;
90
 
 
91
 
   /* Doesn't work yet. [greg] */
92
 
 
93
 
   str = Str_Vasprintf(NULL, fmt, args);
94
 
 
95
 
#if defined(_WIN32)
96
 
   Debug("%s: %s", prefix, str);
97
 
   printf("%s: %s", prefix, str); 
98
 
      // how do we print to stderr? fprintf(stderr,...) doesn't work
99
 
#else
100
 
   fprintf(stderr, "%s: %s", prefix, str);
101
 
   fflush(stderr);
102
 
#endif
103
 
 
104
 
   free(str);
105
 
}
106
 
 
107
 
#ifdef N_PLAT_NLM
108
 
void 
109
 
Panic(const char *fmt, ...)
110
 
{
111
 
   va_list args;
112
 
 
113
 
   va_start(args, fmt);
114
 
   StubVprintf("PANIC", fmt, args);
115
 
   va_end(args);
116
 
 
117
 
   exit(255);
118
 
   NOT_REACHED();
119
 
}
120
 
#endif
121
 
 
122
 
void 
123
 
Panic_PostPanicMsg(const char *format,
124
 
                   ...)
125
 
{}
126
 
 
127
 
void
128
 
Log_DisableThrottling(void)
129
 
{}
130
 
 
131
 
void
132
 
Log_SetAlwaysKeep(Bool unused)
133
 
{}
134
 
 
135
 
 
136
 
Bool
137
 
Config_GetBool(Bool defaultValue,
138
 
               const char *fmt,
139
 
               ...)
140
 
{
141
 
   return defaultValue;
142
 
}
143
 
 
144
 
 
145
 
int32
146
 
Config_GetLong(int32 defaultValue,
147
 
               const char *fmt,
148
 
               ...)
149
 
{
150
 
   return defaultValue;
151
 
}
152
 
 
153
 
 
154
 
void 
155
 
Log(const char *fmt,
156
 
    ...)
157
 
{
158
 
   va_list args;
159
 
 
160
 
   va_start(args, fmt);
161
 
   StubVprintf("Log", fmt, args);
162
 
   va_end(args);
163
 
}
164
 
 
165
 
void
166
 
Warning(const char *fmt,
167
 
        ...)
168
 
{
169
 
   va_list args;
170
 
 
171
 
   va_start(args, fmt);
172
 
   StubVprintf("Warning", fmt, args);
173
 
   va_end(args);
174
 
}
175
 
 
176
 
 
177
 
void 
178
 
Msg_Append(const char *idFmt, 
179
 
           ...)
180
 
{
181
 
   char *str;
182
 
   
183
 
   va_list args;
184
 
   va_start(args, idFmt);
185
 
   str = Str_Vasprintf(NULL, idFmt, args);
186
 
   va_end(args);
187
 
 
188
 
   Warning("Msg_Append: %s\n", str);
189
 
   free(str);
190
 
}
191
 
 
192
 
unsigned int 
193
 
Msg_Question(void *buttons,
194
 
             int defaultAnswer,
195
 
             char const *fmt,
196
 
             ...)
197
 
{
198
 
   char *str;
199
 
   
200
 
   va_list args;
201
 
   va_start(args, fmt);
202
 
   str = Str_Vasprintf(NULL, fmt, args);
203
 
   va_end(args);
204
 
 
205
 
   Warning("Msg_Question: %s\n", str);
206
 
   free(str);
207
 
 
208
 
   return 0;
209
 
}
210
 
 
211
 
typedef int MsgSeverity;
212
 
 
213
 
void 
214
 
Msg_Post(MsgSeverity severity,
215
 
         const char *idFmt,
216
 
         ...)
217
 
{
218
 
   char *str;
219
 
   
220
 
   va_list args;
221
 
   va_start(args, idFmt);
222
 
   str = Str_Vasprintf(NULL, idFmt, args);
223
 
   va_end(args);
224
 
 
225
 
   Warning("Msg_Post: %s\n", str);
226
 
   free(str);
227
 
}
228
 
 
229
 
 
230
 
#ifdef _WIN32
231
 
Bool
232
 
Preference_GetBool(Bool defaultValue, 
233
 
                   const char *name) 
234
 
{
235
 
   return defaultValue;
236
 
}
237
 
#endif
238
 
 
239
 
char *
240
 
Preference_GetString(char *defaultValue, 
241
 
                     const char *name) 
242
 
{
243
 
   return defaultValue;
244
 
}
245
 
 
246
 
#ifdef _WIN32
247
 
VMwareStatus
248
 
Poll_CB_RTime(PollerFunction f,           // IN
249
 
              void *clientData,           // IN
250
 
              int info,                   // IN
251
 
              Bool periodic,              // IN
252
 
              struct DeviceLock *lock)    // IN
253
 
{
254
 
   //NOT_IMPLEMENTED();
255
 
   return VMWARE_STATUS_SUCCESS;
256
 
}
257
 
 
258
 
 
259
 
Bool
260
 
Poll_CB_RTimeRemove(PollerFunction f,  // IN
261
 
                    void *clientData,  // IN
262
 
                    Bool periodic)     // IN
263
 
{
264
 
   //NOT_IMPLEMENTED();
265
 
   return TRUE;
266
 
}
267
 
#endif
268