VFS_GETS is implemented now.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1844 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2006-01-11 22:28:09 +00:00
parent 4b877b1090
commit 1d437c5023
2 changed files with 31 additions and 1 deletions

View file

@ -317,7 +317,7 @@ typedef struct vfsfile_s {
#define VFS_READ(vf,buffer,buflen) (vf->ReadBytes(vf,buffer,buflen))
#define VFS_WRITE(vf,buffer,buflen) (vf->WriteBytes(vf,buffer,buflen))
#define VFS_FLUSH(vf) do{if(vf->Flush)vf->Flush(vf);}while(0)
#define VFS_GETS(vf,buffer,buflen) (Sys_Error("VFS_GETS not implemented"),false) //:(
int VFS_GETS(vfsfile_t *vf, char *buffer, int buflen);
void FS_Remove(char *fname, int relativeto);
vfsfile_t *FS_OpenVFS(char *filename, char *mode, int relativeto);

View file

@ -37,6 +37,36 @@ vfsfile_t *FS_OpenVFSLoc(flocation_t *loc, char *mode);
int VFS_GETS(vfsfile_t *vf, char *buffer, int buflen)
{
char in;
char *out = buffer;
int len;
len = buflen-1;
if (len == 0)
return NULL;
while (len > 0)
{
if (!VFS_READ(vf, &in, 1))
{
*out = '\0';
return buffer;
}
if (in == '\n')
break;
*out++ = in;
len--;
}
*out = '\0';
return buffer;
}
char gamedirfile[MAX_OSPATH];