| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
#ifndef __CMDLIB__ |
| 26 |
#define __CMDLIB__ |
| 27 |
|
| 28 |
#if GDEF_COMPILER_MSVC |
| 29 |
#pragma warning(disable : 4244) // MIPS |
| 30 |
#pragma warning(disable : 4136) // X86 |
| 31 |
#pragma warning(disable : 4051) // ALPHA |
| 32 |
|
| 33 |
#pragma warning(disable : 4018) // signed/unsigned mismatch |
| 34 |
#pragma warning(disable : 4305) // truncate from double to float |
| 35 |
#endif |
| 36 |
|
| 37 |
#include <stdio.h> |
| 38 |
#include <string.h> |
| 39 |
#include <stdlib.h> |
| 40 |
#include <errno.h> |
| 41 |
#include <ctype.h> |
| 42 |
#include <time.h> |
| 43 |
#include <stdarg.h> |
| 44 |
|
| 45 |
#ifndef __BYTEBOOL__ |
| 46 |
#define __BYTEBOOL__ |
| 47 |
typedef enum {false, true} qboolean; |
| 48 |
typedef unsigned char byte; |
| 49 |
#endif |
| 50 |
|
| 51 |
|
| 52 |
#define myoffsetof(type,identifier) ((size_t)&((type *)0)->identifier) |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
extern int myargc; |
| 57 |
extern char **myargv; |
| 58 |
|
| 59 |
|
| 60 |
#ifndef strupr |
| 61 |
char *strupr (char *start); |
| 62 |
#endif |
| 63 |
|
| 64 |
char *strlower (char *start); |
| 65 |
int Q_strncasecmp (char *s1, char *s2, int n); |
| 66 |
int Q_strcasecmp (char *s1, char *s2); |
| 67 |
void Q_getwd (char *out); |
| 68 |
|
| 69 |
int Q_filelength (FILE *f); |
| 70 |
int FileTime (char *path); |
| 71 |
|
| 72 |
void Q_mkdir (char *path); |
| 73 |
|
| 74 |
extern char qdir[1024]; |
| 75 |
extern char gamedir[1024]; |
| 76 |
void SetQdirFromPath (char *path); |
| 77 |
char *ExpandArg (char *path); |
| 78 |
char *ExpandPath (char *path); |
| 79 |
char *ExpandPathAndArchive (char *path); |
| 80 |
|
| 81 |
|
| 82 |
double I_FloatTime (void); |
| 83 |
|
| 84 |
void Error (char *error, ...); |
| 85 |
int CheckParm (char *check); |
| 86 |
|
| 87 |
FILE *SafeOpenWrite (char *filename); |
| 88 |
FILE *SafeOpenRead (char *filename); |
| 89 |
void SafeRead (FILE *f, void *buffer, int count); |
| 90 |
void SafeWrite (FILE *f, void *buffer, int count); |
| 91 |
|
| 92 |
int LoadFile (char *filename, void **bufferptr); |
| 93 |
int TryLoadFile (char *filename, void **bufferptr); |
| 94 |
void SaveFile (char *filename, void *buffer, int count); |
| 95 |
qboolean FileExists (char *filename); |
| 96 |
|
| 97 |
void DefaultExtension (char *path, char *extension); |
| 98 |
void DefaultPath (char *path, char *basepath); |
| 99 |
void StripFilename (char *path); |
| 100 |
void StripExtension (char *path); |
| 101 |
|
| 102 |
void ExtractFilePath (char *path, char *dest); |
| 103 |
void ExtractFileBase (char *path, char *dest); |
| 104 |
void ExtractFileExtension (char *path, char *dest); |
| 105 |
|
| 106 |
int ParseNum (char *str); |
| 107 |
|
| 108 |
short BigShort (short l); |
| 109 |
short LittleShort (short l); |
| 110 |
int BigLong (int l); |
| 111 |
int LittleLong (int l); |
| 112 |
float BigFloat (float l); |
| 113 |
float LittleFloat (float l); |
| 114 |
|
| 115 |
|
| 116 |
char *COM_Parse (char *data); |
| 117 |
|
| 118 |
extern char com_token[1024]; |
| 119 |
extern qboolean com_eof; |
| 120 |
|
| 121 |
char *copystring(char *s); |
| 122 |
|
| 123 |
|
| 124 |
void CRC_Init(unsigned short *crcvalue); |
| 125 |
void CRC_ProcessByte(unsigned short *crcvalue, byte data); |
| 126 |
unsigned short CRC_Value(unsigned short crcvalue); |
| 127 |
|
| 128 |
void CreatePath (char *path); |
| 129 |
void QCopyFile (char *from, char *to); |
| 130 |
|
| 131 |
extern qboolean archive; |
| 132 |
extern char archivedir[1024]; |
| 133 |
|
| 134 |
|
| 135 |
extern qboolean verbose; |
| 136 |
void qprintf (char *format, ...); |
| 137 |
|
| 138 |
void ExpandWildcards (int *argc, char ***argv); |
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
typedef struct |
| 143 |
{ |
| 144 |
byte *data; |
| 145 |
int count; |
| 146 |
} cblock_t; |
| 147 |
|
| 148 |
|
| 149 |
#endif |