fopen mode 4 = whole file (fgets doesn't stop on new lines)

git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3561 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2010-07-18 15:48:58 +00:00
parent 48457fdfec
commit 6b48d670ac

View file

@ -523,6 +523,7 @@ void PF_fopen (progfuncs_t *prinst, struct globalvars_s *pr_globals)
switch (fmode) switch (fmode)
{ {
case 0: //read case 0: //read
case 4: //read whole file
pf_fopen_files[i].data = FS_LoadMallocFile(pf_fopen_files[i].name); pf_fopen_files[i].data = FS_LoadMallocFile(pf_fopen_files[i].name);
if (!pf_fopen_files[i].data) if (!pf_fopen_files[i].data)
{ {
@ -590,6 +591,7 @@ void PF_fclose_i (int fnum)
switch(pf_fopen_files[fnum].accessmode) switch(pf_fopen_files[fnum].accessmode)
{ {
case 0: case 0:
case 4:
BZ_Free(pf_fopen_files[fnum].data); BZ_Free(pf_fopen_files[fnum].data);
break; break;
case 1: case 1:
@ -657,9 +659,9 @@ void PF_fgets (progfuncs_t *prinst, struct globalvars_s *pr_globals)
while(s < eof) while(s < eof)
{ {
c = *s++; c = *s++;
if (c == '\n') if (c == '\n' && pf_fopen_files[fnum].accessmode != 4)
break; break;
if (c == '\r') if (c == '\r' && pf_fopen_files[fnum].accessmode != 4)
continue; continue;
if (o == max) if (o == max)