97 lines
2.2 KiB
C
97 lines
2.2 KiB
C
// cmdlib.h
|
|
|
|
#ifndef __cmdlib__
|
|
#define __cmdlib__
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <errno.h>
|
|
#include <ctype.h>
|
|
#include <time.h>
|
|
#include <stdarg.h>
|
|
|
|
#ifndef __bytebool__
|
|
#define __bytebool__
|
|
typedef enum {false, true} qboolean;
|
|
typedef unsigned char byte;
|
|
#endif
|
|
|
|
// the dec offsetof macro doesn't work very well...
|
|
#define myoffsetof(type,identifier) ((size_t)&((type *)0)->identifier)
|
|
|
|
|
|
// set these before calling checkparm
|
|
extern int myargc;
|
|
extern char **myargv;
|
|
|
|
char *strupr (char *in);
|
|
char *strlower (char *in);
|
|
int q_strncasecmp (char *s1, char *s2, int n);
|
|
int q_strcasecmp (char *s1, char *s2);
|
|
void q_getwd (char *out);
|
|
|
|
int filelength (file *f);
|
|
int filetime (char *path);
|
|
|
|
void q_mkdir (char *path);
|
|
|
|
extern char qdir[1024];
|
|
extern char gamedir[1024];
|
|
void setqdirfrompath (char *path);
|
|
char *expandpath (char *path);
|
|
char *expandpathandarchive (char *path);
|
|
|
|
|
|
double i_floattime (void);
|
|
|
|
void error (char *error, ...);
|
|
int checkparm (char *check);
|
|
|
|
file *safeopenwrite (char *filename);
|
|
file *safeopenread (char *filename);
|
|
void saferead (file *f, void *buffer, int count);
|
|
void safewrite (file *f, void *buffer, int count);
|
|
|
|
int loadfile (char *filename, void **bufferptr);
|
|
void savefile (char *filename, void *buffer, int count);
|
|
|
|
void defaultextension (char *path, char *extension);
|
|
void defaultpath (char *path, char *basepath);
|
|
void stripfilename (char *path);
|
|
void stripextension (char *path);
|
|
|
|
void extractfilepath (char *path, char *dest);
|
|
void extractfilebase (char *path, char *dest);
|
|
void extractfileextension (char *path, char *dest);
|
|
|
|
int parsenum (char *str);
|
|
|
|
short bigshort (short l);
|
|
short littleshort (short l);
|
|
int biglong (int l);
|
|
int littlelong (int l);
|
|
float bigfloat (float l);
|
|
float littlefloat (float l);
|
|
|
|
|
|
char *com_parse (char *data);
|
|
|
|
extern char com_token[1024];
|
|
extern qboolean com_eof;
|
|
|
|
char *copystring(char *s);
|
|
|
|
|
|
void crc_init(unsigned short *crcvalue);
|
|
void crc_processbyte(unsigned short *crcvalue, byte data);
|
|
unsigned short crc_value(unsigned short crcvalue);
|
|
|
|
void createpath (char *path);
|
|
void copyfile (char *from, char *to);
|
|
|
|
extern qboolean archive;
|
|
extern char archivedir[1024];
|
|
|
|
|
|
#endif
|