Subversion Repositories SvarDOS

Rev

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

Rev 989 Rev 1134
Line 58... Line 58...
58
      }
58
      }
59
      outputnl(buff);
59
      outputnl(buff);
60
    }
60
    }
61
  } else { /* set variable (do not rely on argv, SET has its own rules...) */
61
  } else { /* set variable (do not rely on argv, SET has its own rules...) */
62
    const char far *ptr;
62
    const char far *ptr;
63
    unsigned short i;
63
    unsigned short i, errcode = 0;
-
 
64
 
64
    /* locate the first space */
65
    /* locate the first space or tab */
65
    for (ptr = p->cmdline; *ptr != ' '; ptr++);
66
    for (ptr = p->cmdline; ((*ptr != ' ') && (*ptr != '\t')); ptr++);
-
 
67
 
66
    /* now locate the first non-space: that's where the variable name begins */
68
    /* now locate the first non-space/non-tab: that's where the variable name begins */
67
    for (; *ptr == ' '; ptr++);
69
    for (; ((*ptr == ' ') || (*ptr == '\t')); ptr++);
-
 
70
 
68
    /* copy variable to buff and switch it upercase */
71
    /* copy variable name to buff */
69
    i = 0;
72
    i = 0;
70
    for (; *ptr != '='; ptr++) {
73
    for (; *ptr != '='; ptr++) {
71
      if (*ptr == 0) goto syntax_err;
74
      if (*ptr == 0) goto syntax_err;
72
      buff[i] = *ptr;
75
      buff[i++] = *ptr;
-
 
76
    }
-
 
77
 
-
 
78
    /* make variable name all caps */
-
 
79
    _asm {
-
 
80
      push ax
-
 
81
      push cx
-
 
82
      push dx
-
 
83
 
73
      if ((buff[i] >= 'a') && (buff[i] <= 'z')) buff[i] -= ('a' - 'A');
84
      mov ax, 0x6521 /* country-dependent capitalize string (DOS 4+) */
-
 
85
      mov cx, [i]    /* CX=length of string */
-
 
86
      mov dx, buff   /* DS:DX->string to capitalize */
-
 
87
      int 0x21
-
 
88
      jnc DONE
-
 
89
      mov [errcode], ax
74
      i++;
90
      DONE:
-
 
91
 
-
 
92
      pop dx
-
 
93
      pop cx
-
 
94
      pop ax
-
 
95
    }
-
 
96
    if (errcode != 0) {
-
 
97
      nls_outputnl_doserr(errcode);
-
 
98
      return(CMD_FAIL);
75
    }
99
    }
76
 
100
 
77
    /* copy value now */
101
    /* copy value now */
78
    while (*ptr != 0) {
102
    while (*ptr != 0) {
79
      buff[i++] = *ptr;
103
      buff[i++] = *ptr;