Subversion Repositories SvarDOS

Rev

Rev 397 | Rev 533 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 397 Rev 421
-
 
1
/* This file is part of the SvarCOM project and is published under the terms
-
 
2
 * of the MIT license.
-
 
3
 *
-
 
4
 * Copyright (C) 2021 Mateusz Viste
-
 
5
 *
-
 
6
 * Permission is hereby granted, free of charge, to any person obtaining a
-
 
7
 * copy of this software and associated documentation files (the "Software"),
-
 
8
 * to deal in the Software without restriction, including without limitation
-
 
9
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
-
 
10
 * and/or sell copies of the Software, and to permit persons to whom the
-
 
11
 * Software is furnished to do so, subject to the following conditions:
-
 
12
 *
-
 
13
 * The above copyright notice and this permission notice shall be included in
-
 
14
 * all copies or substantial portions of the Software.
-
 
15
 *
-
 
16
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-
 
17
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-
 
18
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-
 
19
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-
 
20
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-
 
21
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-
 
22
 * DEALINGS IN THE SOFTWARE.
-
 
23
 */
-
 
24
 
1
/*
25
/*
2
 * mkdir
26
 * mkdir
3
 */
27
 */
4
 
28
 
5
static int cmd_mkdir(struct cmd_funcparam *p) {
29
static int cmd_mkdir(struct cmd_funcparam *p) {
6
  const char *dname = p->argv[0];
30
  const char *dname = p->argv[0];
7
  unsigned short err = 0;
31
  unsigned short err = 0;
8
 
32
 
9
  if (cmd_ishlp(p)) {
33
  if (cmd_ishlp(p)) {
10
    outputnl("Creates a directory");
34
    outputnl("Creates a directory");
11
    outputnl("");
35
    outputnl("");
12
    outputnl("MKDIR [drive:]path");
36
    outputnl("MKDIR [drive:]path");
13
    outputnl("MD [drive:]path");
37
    outputnl("MD [drive:]path");
14
    return(-1);
38
    return(-1);
15
  }
39
  }
16
 
40
 
17
  if (p->argc == 0) {
41
  if (p->argc == 0) {
18
    outputnl("Required parameter missing");
42
    outputnl("Required parameter missing");
19
    return(-1);
43
    return(-1);
20
  }
44
  }
21
 
45
 
22
  if (p->argc > 1) {
46
  if (p->argc > 1) {
23
    outputnl("Too many parameters");
47
    outputnl("Too many parameters");
24
    return(-1);
48
    return(-1);
25
  }
49
  }
26
 
50
 
27
  if (p->argv[0][0] == '/') {
51
  if (p->argv[0][0] == '/') {
28
    outputnl("Invalid parameter");
52
    outputnl("Invalid parameter");
29
    return(-1);
53
    return(-1);
30
  }
54
  }
31
 
55
 
32
  _asm {
56
  _asm {
33
    push ax
57
    push ax
34
    push dx
58
    push dx
35
 
59
 
36
    mov ah, 0x39   /* create new directory, DS:DX points to ASCIIZ dir name */
60
    mov ah, 0x39   /* create new directory, DS:DX points to ASCIIZ dir name */
37
    mov dx, [dname]
61
    mov dx, [dname]
38
    int 0x21
62
    int 0x21
39
    jnc DONE
63
    jnc DONE
40
    mov [err], ax
64
    mov [err], ax
41
    DONE:
65
    DONE:
42
 
66
 
43
    pop dx
67
    pop dx
44
    pop ax
68
    pop ax
45
  }
69
  }
46
 
70
 
47
  if (err != 0) outputnl(doserr(err));
71
  if (err != 0) outputnl(doserr(err));
48
 
72
 
49
  return(-1);
73
  return(-1);
50
}
74
}
51
 
75