Subversion Repositories SvarDOS

Compare Revisions

Ignore whitespace Rev 352 → Rev 353

/svarcom/cmd.c
1,6 → 1,7
/* entry point for internal commands
* matches internal commands and executes them
* returns exit code or -1 if not processed */
* returns -1 or exit code if processed
* returns -2 if command unrecognized */
 
#include <i86.h>
#include <stdio.h>
15,5 → 16,5
 
if (imatch(argv[0], "set")) return(cmd_set(argc, argv, env_seg));
 
return(-1);
return(-2); /* command is not recognized as internal */
}
/svarcom/command.c
111,7 → 111,7
struct config cfg;
unsigned short rmod_seg;
unsigned short far *rmod_envseg;
int ecode = 0;
unsigned short far *lastexitcode;
 
parse_argv(&cfg, argc, argv);
 
129,6 → 129,7
}
 
rmod_envseg = MK_FP(rmod_seg, RMOD_OFFSET_ENVSEG);
lastexitcode = MK_FP(rmod_seg, RMOD_OFFSET_LEXITCODE);
 
{
unsigned short envsiz;
202,8 → 203,11
if (imatch(argvlist[0], "exit")) break;
 
/* try running it as an internal command */
ecode = cmd_process(argcount, argvlist, *rmod_envseg);
if (ecode >= 0) continue;
{
int ecode = cmd_process(argcount, argvlist, *rmod_envseg);
if (ecode >= 0) *lastexitcode = ecode;
if (ecode >= -1) continue; /* command is internal but did not set an exit code */
}
 
/* must be an external command then */
execvp(argvlist[0], argvlist);
/svarcom/rmod.asm
22,13 → 22,16
; environment segment - this is updated by SvarCOM at init time
ENVSEG dw 0 ; +8
 
; exit code of last application
LEXCODE dw 0 ; +0Ah
 
; input buffer used for the "previous command" history
BUF000 db 128, 0 ; +0Ah
BUF000 db 128, 0 ; +0Ch
BUF064 db "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"
BUF128 db "0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF"
 
 
skipsig: ; +8Ch
skipsig: ; +8Eh
 
; set up CS=DS=SS and point SP to my private stack buffer
mov ax, cs
37,6 → 40,12
mov ss, ax
mov sp, STACKPTR
 
; collect the exit code of previous application
mov ah, 0x4D
int 0x21
xor ah, ah ; clear out termination status, I only want the exit code
mov [LEXCODE], ax
 
; prepare the exec param block
mov ax, [ENVSEG]
mov [EXEC_PARAM_REC], ax
/svarcom/rmod.h
1,25 → 1,26
const char rmod[] = {
131, 25,133, 25, 23, 32, 25, 32, 0, 0,128, 0, 48, 49, 50, 51,
52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51,
52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51,
52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51,
52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51,
52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51,
52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51,
52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51,
52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,140,200,142,216,
142,192,142,208,188,106, 1,161, 8, 0,163,208, 0,184, 7, 1,
163,210, 0,140, 30,212, 0,184, 0, 75,186, 7, 1,187,208, 0,
205, 33,115,216, 4, 48,162,226, 0,180, 9,186,222, 0,198, 6,
41, 1, 36,205, 33,198, 6, 41, 1, 0,180, 8,205, 33,235,188,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 69, 82,
82, 32,120, 44, 32, 70, 65, 73, 76, 69, 68, 32, 84, 79, 32, 76,
79, 65, 68, 32, 67, 79, 77, 77, 65, 78, 68, 46, 67, 79, 77, 32,
70, 82, 79, 77, 58, 13, 10, 67, 58, 92, 83, 86, 78, 92, 83, 86,
65, 82, 68, 79, 83, 92, 83, 86, 65, 82, 67, 79, 77, 92, 67, 79,
77, 77, 65, 78, 68, 46, 67, 79, 77, 0, 48, 49, 50, 51, 52, 53,
54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53,
54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53,
54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53,
54, 55, 56, 57, 65, 66, 67, 68, 69, 70,120,120};
#define rmod_len 364
131, 25,133, 25, 23, 32, 25, 32, 0, 0, 0, 0,128, 0, 48, 49,
50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49,
50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49,
50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49,
50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49,
50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49,
50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49,
50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 48, 49,
50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70,140,200,
142,216,142,192,142,208,188,117, 1,180, 77,205, 33, 48,228,163,
10, 0,161, 8, 0,163,219, 0,184, 18, 1,163,221, 0,140, 30,
223, 0,184, 0, 75,186, 18, 1,187,219, 0,205, 33,115,207, 4,
48,162,237, 0,180, 9,186,233, 0,198, 6, 52, 1, 36,205, 33,
198, 6, 52, 1, 0,180, 8,205, 33,235,179, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 69, 82, 82, 32,120, 44, 32,
70, 65, 73, 76, 69, 68, 32, 84, 79, 32, 76, 79, 65, 68, 32, 67,
79, 77, 77, 65, 78, 68, 46, 67, 79, 77, 32, 70, 82, 79, 77, 58,
13, 10, 67, 58, 92, 83, 86, 78, 92, 83, 86, 65, 82, 68, 79, 83,
92, 83, 86, 65, 82, 67, 79, 77, 92, 67, 79, 77, 77, 65, 78, 68,
46, 67, 79, 77, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65,
66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65,
66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65,
66, 67, 68, 69, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65,
66, 67, 68, 69, 70,120,120};
#define rmod_len 375
/svarcom/rmodinit.h
1,9 → 1,10
#ifndef RMODINIT_H
#define RMODINIT_H
 
#define RMOD_OFFSET_ENVSEG 0x08
#define RMOD_OFFSET_INPBUFF 0x0A
#define RMOD_OFFSET_ROUTINE 0x8C
#define RMOD_OFFSET_ENVSEG 0x08
#define RMOD_OFFSET_LEXITCODE 0x0A
#define RMOD_OFFSET_INPBUFF 0x0C
#define RMOD_OFFSET_ROUTINE 0x8E
 
unsigned short rmod_install(unsigned short envsize);
unsigned short rmod_find(void);