Subversion Repositories SvarDOS

Rev

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

Rev Author Line No. Line
421 mateuszvis 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
 
386 mateuszvis 25
/*
26
 * verify
27
 */
28
 
533 mateuszvis 29
static enum cmd_result cmd_verify(struct cmd_funcparam *p) {
386 mateuszvis 30
 
387 mateuszvis 31
  if (cmd_ishlp(p)) {
386 mateuszvis 32
    outputnl("Tells DOS whether to verify that files are written correctly to disk.");
33
    outputnl("\r\nVERIFY [ON | OFF]\r\n");
34
    outputnl("Type VERIFY without a parameter to display its current setting.");
533 mateuszvis 35
    return(CMD_OK);
386 mateuszvis 36
  }
37
 
38
  if (p->argc > 1) {
39
    outputnl("Too many parameters");
533 mateuszvis 40
    return(CMD_FAIL);
386 mateuszvis 41
  }
42
 
43
  if (p->argc == 0) {
44
    unsigned char verstate = 0;
45
    _asm {
46
      push ax
47
      mov ah, 0x54   /* Get VERIFY status */
48
      int 0x21       /* AL == 0 (off) or AL == 1 (on) */
49
      mov [verstate], al
50
      pop ax
51
    }
52
    if (verstate == 0) {
53
      outputnl("VERIFY is off");
54
    } else {
55
      outputnl("VERIFY is on");
56
    }
533 mateuszvis 57
    return(CMD_OK);
386 mateuszvis 58
  }
59
 
60
  /* argc == 1*/
61
  if (imatch(p->argv[0], "on")) {
62
    _asm {
63
      push ax
64
      push dx
65
      mov ax, 0x2e01  /* set verify ON */
66
      xor dl, dl      /* apparently required by MS-DOS 2.x */
67
      int 0x21
68
      pop dx
69
      pop ax
70
    }
71
  } else if (imatch(p->argv[0], "off")) {
72
    _asm {
73
      push ax
74
      push dx
75
      mov ax, 0x2e00  /* set verify OFF */
76
      xor dl, dl      /* apparently required by MS-DOS 2.x */
77
      int 0x21
78
      pop dx
79
      pop ax
80
    }
81
  } else {
82
    outputnl("Must specify ON or OFF");
533 mateuszvis 83
    return(CMD_FAIL);
386 mateuszvis 84
  }
85
 
533 mateuszvis 86
  return(CMD_OK);
386 mateuszvis 87
}