Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 100 lines (73 sloc) 2.791 kb
707e849 @tbradshaw The Quake 2 tools as originally released under the GPL license.
tbradshaw authored
1 /*
2 ===========================================================================
3 Copyright (C) 1997-2006 Id Software, Inc.
4
5 This file is part of Quake 2 Tools source code.
6
7 Quake 2 Tools source code is free software; you can redistribute it
8 and/or modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of the License,
10 or (at your option) any later version.
11
12 Quake 2 Tools source code is distributed in the hope that it will be
13 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with Quake 2 Tools source code; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 ===========================================================================
21 */
22
23 // cmdlib.h
24
25 #ifndef __CMDLIB__
26 #define __CMDLIB__
27
28 #include <stdio.h>
29 #include <string.h>
30 #include <stdlib.h>
31 #include <errno.h>
32 #include <ctype.h>
33 #include <time.h>
34 #include <stdarg.h>
35
36 #ifndef __BYTEBOOL__
37 #define __BYTEBOOL__
38 typedef enum {false, true} qboolean;
39 typedef unsigned char byte;
40 #endif
41
42 // the dec offsetof macro doesn't work very well...
43 #define myoffsetof(type,identifier) ((size_t)&((type *)0)->identifier)
44
45
46 // set these before calling CheckParm
47 extern int myargc;
48 extern char **myargv;
49
50 int Q_strncasecmp (char *s1, char *s2, int n);
51 int Q_strcasecmp (char *s1, char *s2);
52
53 int Q_filelength (FILE *f);
54
55 double I_FloatTime (void);
56
57 void Error (char *error, ...);
58 int CheckParm (char *check);
59 void ParseCommandLine (char *lpCmdLine);
60
61 FILE *SafeOpenWrite (char *filename);
62 FILE *SafeOpenRead (char *filename);
63 void SafeRead (FILE *f, void *buffer, int count);
64 void SafeWrite (FILE *f, void *buffer, int count);
65
66 int LoadFile (char *filename, void **bufferptr);
67 int LoadFileNoCrash (char *filename, void **bufferptr);
68 void SaveFile (char *filename, void *buffer, int count);
69
70 void DefaultExtension (char *path, char *extension);
71 void DefaultPath (char *path, char *basepath);
72 void StripFilename (char *path);
73 void StripExtension (char *path);
74
75 void ExtractFilePath (char *path, char *dest);
76 void ExtractFileName (char *path, char *dest);
77 void ExtractFileBase (char *path, char *dest);
78 void ExtractFileExtension (char *path, char *dest);
79
80 int ParseNum (char *str);
81
82 short BigShort (short l);
83 short LittleShort (short l);
84 int BigLong (int l);
85 int LittleLong (int l);
86 float BigFloat (float l);
87 float LittleFloat (float l);
88
89
90 char *COM_Parse (char *data);
91
92 extern char com_token[1024];
93 extern qboolean com_eof;
94
95 #define MAX_NUM_ARGVS 32
96 extern int argc;
97 extern char *argv[MAX_NUM_ARGVS];
98
99 #endif
Something went wrong with that request. Please try again.