1
0
Fork 0

fixed tab problems when parsing commands (bug: #897177)

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1682
This commit is contained in:
Peter Veenstra 2004-02-18 15:31:13 +00:00
parent a165df8acb
commit 2a1cee61e1
2 changed files with 13 additions and 8 deletions

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: shell.h,v 1.2 2004-01-10 14:03:33 qbix79 Exp $ */
/* $Id: shell.h,v 1.3 2004-02-18 15:31:13 qbix79 Exp $ */
#ifndef SHELL_H_
#define SHELL_H_
@ -119,7 +119,7 @@ struct SHELL_Cmd {
static inline void StripSpaces(char*&args)
{
while(*args && (*args == ' '))
while(*args && ((*args == ' ') || (*args == '\t')))
args++;
}

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: support.cpp,v 1.21 2004-01-10 14:03:35 qbix79 Exp $ */
/* $Id: support.cpp,v 1.22 2004-02-18 15:31:13 qbix79 Exp $ */
#include <string.h>
#include <stdlib.h>
@ -90,7 +90,7 @@ bool ScanCMDBool(char * cmd,char * check) {
while ((scan=strchr(scan,'/'))) {
/* found a / now see behind it */
scan++;
if (strncasecmp(scan,check,c_len)==0 && (scan[c_len]==' ' || scan[c_len]=='/' || scan[c_len]==0)) {
if (strncasecmp(scan,check,c_len)==0 && (scan[c_len]==' ' || scan[c_len]=='\t' || scan[c_len]=='/' || scan[c_len]==0)) {
/* Found a math now remove it from the string */
memmove(scan-1,scan+c_len,strlen(scan+c_len)+1);
trim(scan-1);
@ -106,7 +106,7 @@ bool ScanCMDHex(char * cmd,char * check,Bits * result) {
while ((scan=strchr(scan,'/'))) {
/* found a / now see behind it */
scan++;
if (strncasecmp(scan,check,c_len)==0 && (scan[c_len]==' ' || scan[c_len]==0)) {
if (strncasecmp(scan,check,c_len)==0 && (scan[c_len]==' ' || scan[c_len]=='\t' || scan[c_len]==0)) {
/* Found a match now find the number and remove it from the string */
char * begin=scan-1;
scan=ltrim(scan+c_len);
@ -128,7 +128,7 @@ bool ScanCMDHex(char * cmd,char * check,Bits * result) {
char * ScanCMDRemain(char * cmd) {
char * scan,*found;;
if ((scan=found=strchr(cmd,'/'))) {
while (*scan!=' ' && *scan!=0) scan++;
while (*scan!=' ' && *scan!='\t' && *scan!=0) scan++;
*scan=0;
return found;
} else return 0;
@ -141,11 +141,16 @@ char * StripWord(char * cmd) {
quoted=true;
cmd++;
}
char * end;
char * end = 0;
if (quoted) {
end=strchr(cmd,'"');
} else {
end=strchr(cmd,' ');
for(char* in=cmd;*in;in++){
if(*in==' '||*in=='\t'){
end=in;
break;
}
}
}
if (!end) {
return cmd+strlen(cmd);