701dd1d8cceca2518d9017ab6490b01f84109dbd
2 Copyright (C) Prikol Software 1996-1997
3 Copyright (C) Aleksey Volynskov 1996-1997
4 Copyright (C) <ARembo@gmail.com> 2011
6 This file is part of the Doom2D:Rembo project.
8 Doom2D:Rembo is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License version 2 as
10 published by the Free Software Foundation.
12 Doom2D:Rembo is distributed in the hope that it will be useful,
13 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.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, see <http://www.gnu.org/licenses/> or
19 write to the Free Software Foundation, Inc.,
20 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 void mysplitpath(const char* path
, char* drv
, char* dir
, char* name
, char* ext
)
31 const char* end
; /* end of processed string */
32 const char* p
; /* search pointer */
33 const char* s
; /* copy pointer */
35 /* extract drive name */
36 if (path
[0] && path
[1]==':') {
45 /* search for end of string or stream separator */
46 for(end
=path
; *end
&& *end
!=':'; )
49 /* search for begin of file extension */
50 for(p
=end
; p
>path
&& *--p
!='\\' && *p
!='/'; )
57 for(s
=end
; (*ext
=*s
++); )
60 /* search for end of directory name */
62 if (*--p
=='\\' || *p
=='/') {
82 void myfread(void *ptr
, size_t n
, size_t size
, FILE *f
) {
83 if (fread(ptr
,n
,size
,f
) != size
) ERR_fatal("File reading error\n");
86 size_t myfreadc(void *ptr
, size_t n
, size_t size
, FILE *f
) {
87 return fread(ptr
,n
,size
,f
);
90 void myfwrite(void *ptr
, size_t n
, size_t size
, FILE *f
) {
91 size_t s
= fwrite(ptr
,n
,size
,f
);
94 void myrandomize(void)
96 srand(SDL_GetTicks());
99 int fexists(char * filename
)
102 if (f
= fopen(filename
, "r"))