Subversion Repositories SvarDOS

Rev

Rev 385 | Rev 397 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
385 mateuszvis 1
/*
2
 * rmdir
3
 */
4
 
5
static int cmd_rmdir(struct cmd_funcparam *p) {
6
  const char *dname = p->argv[0];
7
  unsigned short err = 0;
8
 
387 mateuszvis 9
  if (cmd_ishlp(p)) {
385 mateuszvis 10
    outputnl("Removes (deletes) a directory");
11
    outputnl("");
12
    outputnl("RMDIR [drive:]path");
13
    outputnl("RD [drive:]path");
14
    return(-1);
15
  }
16
 
17
  if (p->argc == 0) {
18
    outputnl("Required parameter missing");
19
    return(-1);
20
  }
21
 
22
  if (p->argc > 1) {
23
    outputnl("Too many parameters");
24
    return(-1);
25
  }
26
 
27
  if (p->argv[0][0] == '/') {
28
    outputnl("Invalid parameter");
29
    return(-1);
30
  }
31
 
32
  _asm {
33
    push ax
34
    push dx
35
 
36
    mov ah, 0x3a   /* delete a directory, DS:DX points to ASCIIZ dir name */
37
    mov dx, [dname]
38
    int 0x21
39
    jnc DONE
40
    mov [err], ax
41
    DONE:
42
 
43
    pop dx
44
    pop ax
45
  }
46
 
47
  if (err != 0) outputnl(doserr(err));
48
 
49
  return(-1);
50
}