Subversion Repositories SvarDOS

Rev

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

Rev 387 Rev 397
1
/*
1
/*
2
 * verify
2
 * verify
3
 */
3
 */
4
 
4
 
5
static int cmd_verify(struct cmd_funcparam *p) {
5
static int cmd_verify(struct cmd_funcparam *p) {
6
 
6
 
7
  if (cmd_ishlp(p)) {
7
  if (cmd_ishlp(p)) {
8
    outputnl("Tells DOS whether to verify that files are written correctly to disk.");
8
    outputnl("Tells DOS whether to verify that files are written correctly to disk.");
9
    outputnl("\r\nVERIFY [ON | OFF]\r\n");
9
    outputnl("\r\nVERIFY [ON | OFF]\r\n");
10
    outputnl("Type VERIFY without a parameter to display its current setting.");
10
    outputnl("Type VERIFY without a parameter to display its current setting.");
11
    return(-1);
11
    return(-1);
12
  }
12
  }
13
 
13
 
14
  if (p->argc > 1) {
14
  if (p->argc > 1) {
15
    outputnl("Too many parameters");
15
    outputnl("Too many parameters");
16
    return(-1);
16
    return(-1);
17
  }
17
  }
18
 
18
 
19
  if (p->argc == 0) {
19
  if (p->argc == 0) {
20
    unsigned char verstate = 0;
20
    unsigned char verstate = 0;
21
    _asm {
21
    _asm {
22
      push ax
22
      push ax
23
      mov ah, 0x54   /* Get VERIFY status */
23
      mov ah, 0x54   /* Get VERIFY status */
24
      int 0x21       /* AL == 0 (off) or AL == 1 (on) */
24
      int 0x21       /* AL == 0 (off) or AL == 1 (on) */
25
      mov [verstate], al
25
      mov [verstate], al
26
      pop ax
26
      pop ax
27
    }
27
    }
28
    if (verstate == 0) {
28
    if (verstate == 0) {
29
      outputnl("VERIFY is off");
29
      outputnl("VERIFY is off");
30
    } else {
30
    } else {
31
      outputnl("VERIFY is on");
31
      outputnl("VERIFY is on");
32
    }
32
    }
33
    return(-1);
33
    return(-1);
34
  }
34
  }
35
 
35
 
36
  /* argc == 1*/
36
  /* argc == 1*/
37
  if (imatch(p->argv[0], "on")) {
37
  if (imatch(p->argv[0], "on")) {
38
    _asm {
38
    _asm {
39
      push ax
39
      push ax
40
      push dx
40
      push dx
41
      mov ax, 0x2e01  /* set verify ON */
41
      mov ax, 0x2e01  /* set verify ON */
42
      xor dl, dl      /* apparently required by MS-DOS 2.x */
42
      xor dl, dl      /* apparently required by MS-DOS 2.x */
43
      int 0x21
43
      int 0x21
44
      pop dx
44
      pop dx
45
      pop ax
45
      pop ax
46
    }
46
    }
47
  } else if (imatch(p->argv[0], "off")) {
47
  } else if (imatch(p->argv[0], "off")) {
48
    _asm {
48
    _asm {
49
      push ax
49
      push ax
50
      push dx
50
      push dx
51
      mov ax, 0x2e00  /* set verify OFF */
51
      mov ax, 0x2e00  /* set verify OFF */
52
      xor dl, dl      /* apparently required by MS-DOS 2.x */
52
      xor dl, dl      /* apparently required by MS-DOS 2.x */
53
      int 0x21
53
      int 0x21
54
      pop dx
54
      pop dx
55
      pop ax
55
      pop ax
56
    }
56
    }
57
  } else {
57
  } else {
58
    outputnl("Must specify ON or OFF");
58
    outputnl("Must specify ON or OFF");
59
  }
59
  }
60
 
60
 
61
  return(-1);
61
  return(-1);
62
}
62
}
63
 
63