mirror of
https://git.code.sf.net/p/quake/quakeforge-old
synced 2024-11-10 14:42:06 +00:00
common/common.c common/common.h qw_client/cl_parse.c qw_server/sv_main.c:
handle escape chars better common/quakefs.c: check the return value of opendir
This commit is contained in:
parent
8ce43b2ec1
commit
bcd302a948
5 changed files with 24 additions and 2 deletions
|
@ -40,7 +40,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include <console.h>
|
||||
#include <cmd.h>
|
||||
|
||||
char com_token[1024];
|
||||
int com_no_escapes = 0;
|
||||
char com_token[1024];
|
||||
qboolean standard_quake = true, rogue, hipnotic;
|
||||
qboolean msg_suppress_1 = 0;
|
||||
|
||||
|
@ -631,7 +632,7 @@ skipwhite:
|
|||
while (*data && *data!='\"')
|
||||
{
|
||||
c = *data++;
|
||||
if (c=='\\') {
|
||||
if (!com_no_escapes && c=='\\') {
|
||||
int base=8;
|
||||
char buf[4];
|
||||
char *str,*string=buf;
|
||||
|
@ -693,6 +694,20 @@ skipwhite:
|
|||
return data;
|
||||
}
|
||||
|
||||
char *
|
||||
COM_EscapeEscapes(char *str)
|
||||
{
|
||||
static char buf[4096];
|
||||
int i;
|
||||
|
||||
for (i=0; *str && i<sizeof(buf)-1; i++, str++) {
|
||||
if (*str=='\\')
|
||||
buf[i++]='\\';
|
||||
buf[i]=*str;
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
va
|
||||
|
|
|
@ -148,10 +148,12 @@ void MSG_ReadDeltaUsercmd (struct usercmd_s *from, struct usercmd_s *cmd);
|
|||
|
||||
//============================================================================
|
||||
|
||||
extern int com_no_escapes;
|
||||
extern char com_token[1024];
|
||||
extern qboolean com_eof;
|
||||
|
||||
char *COM_Parse (char *data);
|
||||
char *COM_EscapeEscapes(char *str);
|
||||
|
||||
|
||||
extern int com_argc;
|
||||
|
|
|
@ -676,6 +676,8 @@ COM_LoadGameDirectory(char *dir)
|
|||
struct dirent *dirent;
|
||||
|
||||
dir_ptr = opendir(dir);
|
||||
if (!dir_ptr)
|
||||
return;
|
||||
|
||||
while ((dirent = readdir(dir_ptr))) {
|
||||
if (!fnmatch("*.pak", dirent->d_name, 0)) {
|
||||
|
|
|
@ -1122,6 +1122,7 @@ void CL_ParseServerMessage (void)
|
|||
|
||||
case svc_stufftext:
|
||||
s = MSG_ReadString ();
|
||||
//s = COM_EscapeEscapes(s);
|
||||
Con_DPrintf ("stufftext: %s\n", s);
|
||||
Cbuf_AddText (s);
|
||||
break;
|
||||
|
|
|
@ -846,7 +846,9 @@ void SV_ConnectionlessPacket (void)
|
|||
|
||||
s = MSG_ReadStringLine ();
|
||||
|
||||
com_no_escapes++;
|
||||
Cmd_TokenizeString (s);
|
||||
com_no_escapes--;
|
||||
|
||||
c = Cmd_Argv(0);
|
||||
|
||||
|
|
Loading…
Reference in a new issue