Subversion Repositories SvarDOS

Compare Revisions

Ignore whitespace Rev 384 → Rev 385

/svarcom/cmd/mkdir.c
0,0 → 1,50
/*
* mkdir
*/
 
static int cmd_mkdir(struct cmd_funcparam *p) {
const char *dname = p->argv[0];
unsigned short err = 0;
 
if ((p->argc == 1) && (imatch(p->argv[0], "/?"))) {
outputnl("Creates a directory");
outputnl("");
outputnl("MKDIR [drive:]path");
outputnl("MD [drive:]path");
return(-1);
}
 
if (p->argc == 0) {
outputnl("Required parameter missing");
return(-1);
}
 
if (p->argc > 1) {
outputnl("Too many parameters");
return(-1);
}
 
if (p->argv[0][0] == '/') {
outputnl("Invalid parameter");
return(-1);
}
 
_asm {
push ax
push dx
 
mov ah, 0x39 /* create new directory, DS:DX points to ASCIIZ dir name */
mov dx, [dname]
int 0x21
jnc DONE
mov [err], ax
DONE:
 
pop dx
pop ax
}
 
if (err != 0) outputnl(doserr(err));
 
return(-1);
}
/svarcom/cmd/rmdir.c
0,0 → 1,50
/*
* rmdir
*/
 
static int cmd_rmdir(struct cmd_funcparam *p) {
const char *dname = p->argv[0];
unsigned short err = 0;
 
if ((p->argc == 1) && (imatch(p->argv[0], "/?"))) {
outputnl("Removes (deletes) a directory");
outputnl("");
outputnl("RMDIR [drive:]path");
outputnl("RD [drive:]path");
return(-1);
}
 
if (p->argc == 0) {
outputnl("Required parameter missing");
return(-1);
}
 
if (p->argc > 1) {
outputnl("Too many parameters");
return(-1);
}
 
if (p->argv[0][0] == '/') {
outputnl("Invalid parameter");
return(-1);
}
 
_asm {
push ax
push dx
 
mov ah, 0x3a /* delete a directory, DS:DX points to ASCIIZ dir name */
mov dx, [dname]
int 0x21
jnc DONE
mov [err], ax
DONE:
 
pop dx
pop ax
}
 
if (err != 0) outputnl(doserr(err));
 
return(-1);
}
/svarcom/cmd.c
25,8 → 25,10
#include "cmd/cd.c"
#include "cmd/dir.c"
#include "cmd/exit.c"
#include "cmd/mkdir.c"
#include "cmd/path.c"
#include "cmd/prompt.c"
#include "cmd/rmdir.c"
#include "cmd/set.c"
#include "cmd/ver.c"
#include "cmd/type.c"
55,15 → 57,15
{"EXIT", cmd_exit},
{"LH", cmd_notimpl},
{"LOADHIGH",cmd_notimpl},
{"MD", cmd_notimpl},
{"MKDIR", cmd_notimpl},
{"MD", cmd_mkdir},
{"MKDIR", cmd_mkdir},
{"PAUSE", cmd_notimpl},
{"PATH", cmd_path},
{"PROMPT", cmd_prompt},
{"RD", cmd_notimpl},
{"RD", cmd_rmdir},
{"REN", cmd_notimpl},
{"RENAME", cmd_notimpl},
{"RMDIR", cmd_notimpl},
{"RMDIR", cmd_rmdir},
{"SET", cmd_set},
{"TIME", cmd_notimpl},
{"TYPE", cmd_type},