/svarcom/cmd/cd.c |
---|
13,7 → 13,7 |
static int cmd_cd(const struct cmd_funcparam *p) { |
/* two arguments max */ |
if (p->argc > 1) { |
puts("Too many parameters"); |
outputnl("Too many parameters"); |
} |
/* no argument? display current drive and dir ("CWD") */ |
92,7 → 92,9 |
pop dx |
} |
} |
if (err != 0) puts(doserr(err)); |
if (err != 0) { |
outputnl(doserr(err)); |
} |
} |
return(-1); |
/svarcom/cmd/dir.c |
---|
79,7 → 79,7 |
} |
if (errcode != 0) return(-1); |
puts(dta->fname); |
outputnl(dta->fname); |
NEXTFILE: |
98,7 → 98,7 |
pop ax |
} |
puts(dta->fname); |
outputnl(dta->fname); |
if (errcode == 0) goto NEXTFILE; |
/svarcom/cmd/exit.c |
---|
7,10 → 7,10 |
static int cmd_exit(const struct cmd_funcparam *p) { |
if ((p->argc == 1) && (imatch(p->argv[0], "/?"))) { |
puts("EXIT"); |
puts(""); |
puts("Quits the COMMAND.COM program (command interpreter)"); |
puts(""); |
output("EXIT\r\n" |
"\r\n" |
"Quits the COMMAND.COM program (command interpreter)\r\n" |
"\r\n"); |
} else { |
exit(0); |
} |
/svarcom/cmd/set.c |
---|
23,7 → 23,7 |
puts(buff); |
} |
} else if ((p->argc == 1) && (imatch(p->argv[0], "/?"))) { |
puts("TODO: help screen"); /* TODO */ |
outputnl("TODO: help screen"); /* TODO */ |
} else { /* set variable (do not rely on argv, SET has its own rules...) */ |
const char far *ptr; |
char buff[256]; |
53,12 → 53,12 |
/* commit variable to environment */ |
i = env_setvar(p->env_seg, buff); |
if (i == ENV_INVSYNT) goto syntax_err; |
if (i == ENV_NOTENOM) puts("Not enough available space within the environment block"); |
if (i == ENV_NOTENOM) outputnl("Not enough available space within the environment block"); |
} |
return(-1); |
syntax_err: |
puts("Syntax error"); |
outputnl("Syntax error"); |
return(-1); |
} |
/svarcom/command.c |
---|
249,12 → 249,12 |
if (rmod_seg == 0xffff) { |
rmod_seg = rmod_install(cfg.envsiz); |
if (rmod_seg == 0xffff) { |
puts("ERROR: rmod_install() failed"); |
outputnl("ERROR: rmod_install() failed"); |
return(1); |
} |
printf("rmod installed at seg 0x%04X\r\n", rmod_seg); |
/* printf("rmod installed at seg 0x%04X\r\n", rmod_seg); */ |
} else { |
printf("rmod found at seg 0x%04x\r\n", rmod_seg); |
/* printf("rmod found at seg 0x%04x\r\n", rmod_seg); */ |
} |
rmod_envseg = MK_FP(rmod_seg, RMOD_OFFSET_ENVSEG); |
263,13 → 263,13 |
/* make COMPSEC point to myself */ |
set_comspec_to_self(*rmod_envseg); |
{ |
/* { |
unsigned short envsiz; |
unsigned short far *sizptr = MK_FP(*rmod_envseg - 1, 3); |
envsiz = *sizptr; |
envsiz *= 16; |
printf("rmod_inpbuff at %04X:%04X, env_seg at %04X:0000 (env_size = %u bytes)\r\n", rmod_seg, RMOD_OFFSET_INPBUFF, *rmod_envseg, envsiz); |
} |
}*/ |
for (;;) { |
char far *cmdline = MK_FP(rmod_seg, RMOD_OFFSET_INPBUFF + 2); |
333,7 → 333,7 |
pop bx |
pop ax |
} |
printf("\r\n"); |
outputnl(""); |
/* if nothing entered, loop again */ |
if (cmdline[-1] == 0) continue; |
359,7 → 359,7 |
/* execvp() replaces the current process by the new one |
if I am still alive then external command failed to execute */ |
puts("Bad command or file name"); |
outputnl("Bad command or file name"); |
} |
/svarcom/helpers.c |
---|
31,3 → 31,29 |
} |
return(0); |
} |
/* outputs a NULL-terminated string to stdout */ |
void output_internal(const char *s, unsigned short nl) { |
_asm { |
mov ah, 0x02 /* AH=9 - write character in DL to stdout */ |
mov si, s |
cld /* clear DF so lodsb increments SI */ |
NEXTBYTE: |
lodsb /* load byte from DS:SI into AL, SI++ */ |
mov dl, al |
or al, 0 /* is al == 0? */ |
jz DONE |
int 0x21 |
jmp NEXTBYTE |
DONE: |
or nl, 0 |
jz FINITO |
/* print out a CR/LF trailer if nl set */ |
mov dl, 0x0D /* CR */ |
int 0x21 |
mov dl, 0x0A /* LF */ |
int 0x21 |
FINITO: |
} |
} |
/svarcom/helpers.h |
---|
7,4 → 7,10 |
/* returns zero if s1 starts with s2 */ |
int strstartswith(const char *s1, const char *s2); |
/* outputs a NULL-terminated string to stdout */ |
void output_internal(const char *s, unsigned short nl); |
#define output(x) output_internal(x, 0) |
#define outputnl(x) output_internal(x, 1) |
#endif |
/svarcom/rmodinit.c |
---|
1,9 → 1,9 |
#include <i86.h> |
#include <stdio.h> |
#include <string.h> |
#include "env.h" |
#include "helpers.h" |
#include "rmod.h" |
28,7 → 28,7 |
pop ax |
} |
printf("original (PSP) env buffer at %04X\r\n", envseg); |
/* printf("original (PSP) env buffer at %04X\r\n", envseg); */ |
/* if custom envsize requested, convert it to number of paragraphs */ |
if (envsize != 0) { |
envsize += 15; |
81,7 → 81,7 |
} |
if (rmodseg == 0xffff) { |
puts("malloc error"); |
outputnl("malloc error"); |
return(0xffff); |
} |