]> icculus.org git repositories - taylor/freespace2.git/blob - src/platform/unix.cpp
155 undefined references left
[taylor/freespace2.git] / src / platform / unix.cpp
1 #include <unistd.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <string.h>
5 #include <ctype.h>
6 #include <errno.h>
7
8 #include "unix.h"
9
10 void strlwr (char * str)
11 {
12         while (*str) {*str = tolower (*str); str++; }
13 }
14
15 int filelength (int fd)
16 {
17         FILE *f = fdopen (dup(fd), "r");
18         fseek (f, 0, SEEK_END);
19         int len = ftell (f);
20         fclose (f);
21         return len;
22 }
23
24 unsigned long _beginthread (void (*pfuncStart)(void *), unsigned unStackSize, void* pArgList)
25 {
26         STUB_FUNCTION;
27         
28         return 0;
29 }
30
31 void Sleep (int mili)
32 {
33         usleep (mili * 1000);
34 }
35
36 void OutputDebugString (const char *str)
37 {
38         fprintf(stderr, "OutputDebugString: %s\n", str);
39 }
40
41 int WSAGetLastError()
42 {
43         return errno;
44 }
45
46 int MulDiv(int a, int b, int c)
47 {
48         /* slow long long version */
49         __extension__ long long aa = a;
50         __extension__ long long bb = b;
51         __extension__ long long cc = c;
52         
53         __extension__ long long dd = aa * bb;
54         __extension__ long long ee = dd / cc;
55         
56         int retr = (int) ee;
57         
58         return retr;
59 }
60
61 /* mem debug junk */
62 int TotalRam = 0;
63
64 void vm_free(void* ptr, char*, int)
65 {
66         free(ptr);
67 }
68
69 void *vm_malloc(int size, char*, int)
70 {
71         return malloc(size);
72 }
73
74 char *vm_strdup(char const* str, char*, int)
75 {
76         return strdup(str);
77 }
78
79 void windebug_memwatch_init()
80 {
81         TotalRam = 0;
82 }
83
84 /* error message debugging junk */
85 int Log_debug_output_to_file = 0;
86
87 void load_filter_info(void)
88 {
89         STUB_FUNCTION;
90 }
91
92 void outwnd_printf(char*, char*, ...)
93 {
94         STUB_FUNCTION;
95 }
96
97 void outwnd_printf2(char*, ...)
98 {
99         STUB_FUNCTION;
100 }
101
102 void outwnd_close()
103 {
104         STUB_FUNCTION;
105 }
106
107 void Warning( char * filename, int line, char * format, ... )
108 {
109         STUB_FUNCTION;
110 }
111
112 void Error( char * filename, int line, char * format, ... )
113 {
114         STUB_FUNCTION;
115 }
116
117 void WinAssert(char * text,char *filename, int line)
118 {
119         STUB_FUNCTION;
120 }