cmdlib.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /* Copyright (C) 1996-1997 Id Software, Inc.
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation; either version 2 of the License, or
  5. (at your option) any later version.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. GNU General Public License for more details.
  10. You should have received a copy of the GNU General Public License
  11. along with this program; if not, write to the Free Software
  12. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  13. See file, 'COPYING', for details.
  14. */
  15. // cmdlib.h
  16. #ifndef __CMDLIB__
  17. #define __CMDLIB__
  18. #include <stdio.h>
  19. #include <string.h>
  20. #include <stdlib.h>
  21. #include <errno.h>
  22. #include <ctype.h>
  23. #include <sys/types.h>
  24. #include <sys/stat.h>
  25. #include <sys/file.h>
  26. #include <stdarg.h>
  27. #ifdef NeXT
  28. #include <libc.h>
  29. #endif
  30. #ifndef __BYTEBOOL__
  31. #define __BYTEBOOL__
  32. typedef enum {false, true} boolean;
  33. typedef unsigned char byte;
  34. #endif
  35. // the dec offsetof macro doesn't work very well...
  36. #define myoffsetof(type,identifier) ((size_t)&((type *)0)->identifier)
  37. // set these before calling CheckParm
  38. extern int myargc;
  39. extern char **myargv;
  40. char *strupr (char *in);
  41. char *strlower (char *in);
  42. int filelength (int handle);
  43. int tell (int handle);
  44. double I_FloatTime (void);
  45. void Error (char *error, ...);
  46. int CheckParm (char *check);
  47. int SafeOpenWrite (char *filename);
  48. int SafeOpenRead (char *filename);
  49. void SafeRead (int handle, void *buffer, long count);
  50. void SafeWrite (int handle, void *buffer, long count);
  51. void *SafeMalloc (long size);
  52. long LoadFile (char *filename, void **bufferptr);
  53. void SaveFile (char *filename, void *buffer, long count);
  54. void DefaultExtension (char *path, char *extension);
  55. void DefaultPath (char *path, char *basepath);
  56. void StripFilename (char *path);
  57. void StripExtension (char *path);
  58. void ExtractFilePath (char *path, char *dest);
  59. void ExtractFileBase (char *path, char *dest);
  60. void ExtractFileExtension (char *path, char *dest);
  61. long ParseNum (char *str);
  62. short BigShort (short l);
  63. short LittleShort (short l);
  64. long BigLong (long l);
  65. long LittleLong (long l);
  66. float BigFloat (float l);
  67. float LittleFloat (float l);
  68. char *COM_Parse (char *data);
  69. extern char com_token[1024];
  70. extern int com_eof;
  71. #endif