Subversion Repositories SvarDOS

Rev

Rev 990 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 990 Rev 1729
Line 98... Line 98...
98
    /* does file exist? */
98
    /* does file exist? */
99
    if (findfirst(dta, p->BUFFER, 0) == 0) negflag ^= 1;
99
    if (findfirst(dta, p->BUFFER, 0) == 0) negflag ^= 1;
100
    goto EXEC_S_CMD_IF_NEGFLAG_SET;
100
    goto EXEC_S_CMD_IF_NEGFLAG_SET;
101
  }
101
  }
102
 
102
 
103
  /* IF str1==str2 ? (and if that's not it, then it's a syntax error) */
103
  /* assume "IF str1==str2" and if that's not it then it's a syntax error */
104
  if (strstr(s, "==") != NULL) {
-
 
105
    /* copy first argument to BUFF, until first '=' or space */
104
  /* copy first argument to BUFF, until first '=' or space */
106
    for (i = 0; (s[i] != '=') && (s[i] != ' '); i++) p->BUFFER[i] = s[i];
105
  for (i = 0; (s[i] != '=') && (s[i] != ' ') && (s[i] != 0); i++) p->BUFFER[i] = s[i];
107
    /* 1st arg cannot be empty */
106
  /* 1st arg cannot be empty */
108
    if (i == 0) goto SYNTAX_ERR;
107
  if (i == 0) goto SYNTAX_ERR;
109
    /* terminate buff string and move s forward to the equality char (or space) */
108
  /* terminate buff string */
110
    p->BUFFER[i++] = 0;
109
  p->BUFFER[i] = 0;
111
    s += i;
110
  s += i;
112
    while (*s == ' ') s++;
111
  while (*s == ' ') s++;
113
    /* if second char is not a '=' then syntax error (equality sign is not
112
  /* should be two '=' now, otherwise it's a syntax error (equality sign is not
114
     * allowed in first string) */
113
   * allowed in first string) */
115
    if (*s != '=') goto SYNTAX_ERR;
114
  if ((s[0] != '=') || (s[1] != '=')) goto SYNTAX_ERR;
116
    /* skip all trailing equality chars (MSDOS accepts many of them, ie all
115
  /* skip all trailing equality chars (MSDOS accepts many of them, ie all
117
     * these are fine: "dupa==dupa", "dupa===dupa", "dupa====dupa", etc) */
116
   * these are fine: "dupa==dupa", "dupa===dupa", "dupa====dupa", etc) */
118
    while (*s == '=') s++;
117
  while (*s == '=') s++;
119
    while (*s == ' ') s++; /* skip any leading spaces */
118
  while (*s == ' ') s++; /* skip any leading spaces */
120
    /* move along until space or NULL terminator, checking equality */
119
  /* move along until space or NULL terminator, checking equality */
121
    for (i = 0; (p->BUFFER[i] != 0) && (p->BUFFER[i] == s[i]); i++);
120
  for (i = 0; (p->BUFFER[i] != 0) && (p->BUFFER[i] == s[i]); i++);
122
    if ((p->BUFFER[i] == 0) && (s[i] == ' ')) negflag ^= 1;
121
  if ((p->BUFFER[i] == 0) && (s[i] == ' ')) negflag ^= 1;
123
    JMP_NEXT_ARG(s);
122
  JMP_NEXT_ARG(s);
124
    goto EXEC_S_CMD_IF_NEGFLAG_SET;
123
  goto EXEC_S_CMD_IF_NEGFLAG_SET;
125
  }
-
 
126
 
124
 
127
  /* invalid syntax */
125
  /* invalid syntax */
128
  SYNTAX_ERR:
126
  SYNTAX_ERR:
129
  nls_outputnl(0,1); /* "Invalid syntax" */
127
  nls_outputnl(0,1); /* "Invalid syntax" */
130
  return(CMD_FAIL);
128
  return(CMD_FAIL);