Subversion Repositories SvarDOS

Rev

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

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