/svarcom/trunk/cmd/set.c |
---|
60,7 → 60,7 |
} |
} else { /* set variable (do not rely on argv, SET has its own rules...) */ |
const char far *ptr; |
unsigned short i, errcode = 0; |
unsigned short i; |
/* locate the first space or tab */ |
for (ptr = p->cmdline; ((*ptr != ' ') && (*ptr != '\t')); ptr++); |
75,29 → 75,10 |
buff[i++] = *ptr; |
} |
/* make variable name all caps */ |
_asm { |
push ax |
push cx |
push dx |
/* make variable name all caps (country-dependend) */ |
buff[i] = 0; |
nls_strtoup(buff); |
mov ax, 0x6521 /* country-dependent capitalize string (DOS 4+) */ |
mov cx, [i] /* CX=length of string */ |
mov dx, buff /* DS:DX->string to capitalize */ |
int 0x21 |
jnc DONE |
mov [errcode], ax |
DONE: |
pop dx |
pop cx |
pop ax |
} |
if (errcode != 0) { |
nls_outputnl_doserr(errcode); |
return(CMD_FAIL); |
} |
/* copy value now */ |
while (*ptr != 0) { |
buff[i++] = *ptr; |
/svarcom/trunk/helpers.c |
---|
621,6 → 621,31 |
} |
/* capitalize an ASCIZ string following country-dependent rules */ |
void nls_strtoup(char *buff) { |
unsigned short errcode = 0; |
/* requires DOS 4+ */ |
_asm { |
push ax |
push dx |
mov ax, 0x6522 /* country-dependent capitalize string (DOS 4+) */ |
mov dx, buff /* DS:DX -> string to capitalize */ |
int 0x21 |
jnc DONE |
mov errcode, ax /* set errcode on failure */ |
DONE: |
pop dx |
pop ax |
} |
/* rely on OpenWatcom's strupr() if DOS has no NLS support */ |
if (errcode != 0) strupr(buff); |
} |
/* reload nls ressources from svarcom.lng into svarlang_mem */ |
void nls_langreload(char *buff, unsigned short env) { |
const char far *nlspath; |
/svarcom/trunk/helpers.h |
---|
182,6 → 182,9 |
* returns length of result */ |
unsigned short nls_format_number(char *s, unsigned long num, const struct nls_patterns *p); |
/* capitalize an ASCIZ string following country-dependent rules */ |
void nls_strtoup(char *buff); |
/* reload nls ressources from svarcom.lng into langblock */ |
void nls_langreload(char *buff, unsigned short env); |