Subversion Repositories SvarDOS

Rev

Rev 533 | Rev 2214 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 533 Rev 990
Line 1... Line 1...
1
/* This file is part of the SvarCOM project and is published under the terms
1
/* This file is part of the SvarCOM project and is published under the terms
2
 * of the MIT license.
2
 * of the MIT license.
3
 *
3
 *
4
 * Copyright (C) 2021 Mateusz Viste
4
 * Copyright (C) 2021-2022 Mateusz Viste
5
 *
5
 *
6
 * Permission is hereby granted, free of charge, to any person obtaining a
6
 * Permission is hereby granted, free of charge, to any person obtaining a
7
 * copy of this software and associated documentation files (the "Software"),
7
 * copy of this software and associated documentation files (the "Software"),
8
 * to deal in the Software without restriction, including without limitation
8
 * to deal in the Software without restriction, including without limitation
9
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
Line 51... Line 51...
51
    pop cx
51
    pop cx
52
    pop ax
52
    pop ax
53
  }
53
  }
54
 
54
 
55
  if (err != 0) {
55
  if (err != 0) {
56
    sprintf(buff, "Volume in drive %c has no label", drv + 'A');
56
    sprintf(buff, svarlang_str(34,2)/*"Volume in drive %c has no label"*/, drv + 'A');
57
  } else {
57
  } else {
58
    /* if label > 8 chars then drop the dot (DRIVE_LA.BEL -> DRIVE_LABEL) */
58
    /* if label > 8 chars then drop the dot (DRIVE_LA.BEL -> DRIVE_LABEL) */
59
    if (strlen(dta->fname) > 8) memmove(dta->fname + 8, dta->fname + 9, 4);
59
    if (strlen(dta->fname) > 8) memmove(dta->fname + 8, dta->fname + 9, 4);
60
    sprintf(buff, "Volume in drive %c is %s", drv + 'A', dta->fname);
60
    sprintf(buff, svarlang_str(34,3)/*"Volume in drive %c is %s"*/, drv + 'A', dta->fname);
61
  }
61
  }
62
  outputnl(buff);
62
  outputnl(buff);
63
 
63
 
64
  /* try to fetch the disk's serial number (DOS 4+ internal call) */
64
  /* try to fetch the disk's serial number (DOS 4+ internal call) */
65
  err = 0;
65
  err = 0;
Line 85... Line 85...
85
   00h     WORD    0000h (info level)
85
   00h     WORD    0000h (info level)
86
   02h     DWORD   disk serial number (binary)
86
   02h     DWORD   disk serial number (binary)
87
   06h  11 BYTEs   volume label or "NO NAME    " if none present
87
   06h  11 BYTEs   volume label or "NO NAME    " if none present
88
   11h   8 BYTEs   filesystem type */
88
   11h   8 BYTEs   filesystem type */
89
  if ((err == 0) && (buff16[1] | buff16[2])) {
89
  if ((err == 0) && (buff16[1] | buff16[2])) {
90
    sprintf(buff + 64, "Volume Serial Number is %04X-%04X", buff16[2], buff16[1]);
90
    sprintf(buff + 64, svarlang_str(34,4)/*"Volume Serial Number is %04X-%04X"*/, buff16[2], buff16[1]);
91
    outputnl(buff + 64);
91
    outputnl(buff + 64);
92
  }
92
  }
93
}
93
}
94
 
94
 
95
 
95
 
Line 97... Line 97...
97
  char drv = 0;
97
  char drv = 0;
98
  char curdrv = 0;
98
  char curdrv = 0;
99
  unsigned short i;
99
  unsigned short i;
100
 
100
 
101
  if (cmd_ishlp(p)) {
101
  if (cmd_ishlp(p)) {
102
    outputnl("Displays the disk volume label and serial number, if they exist.");
102
    nls_outputnl(34,0); /* "Displays the disk volume label and serial number, if they exist." */
103
    outputnl("");
103
    outputnl("");
104
    outputnl("VOL [drive:]");
104
    nls_outputnl(34,1); /* "VOL [drive:]" */
105
    return(CMD_OK);
105
    return(CMD_OK);
106
  }
106
  }
107
 
107
 
108
  for (i = 0; i < p->argc; i++) {
108
  for (i = 0; i < p->argc; i++) {
109
    if (p->argv[i][0] == '/') {
109
    if (p->argv[i][0] == '/') {
110
      outputnl("Invalid switch");
110
      nls_outputnl(0,2); /* "Invalid switch" */
111
      return(CMD_FAIL);
111
      return(CMD_FAIL);
112
    }
112
    }
113
    if (drv != 0) {
113
    if (drv != 0) {
114
      outputnl("Too many parameters");
114
      nls_outputnl(0,4); /* "Too many parameters" */
115
      return(CMD_FAIL);
115
      return(CMD_FAIL);
116
    }
116
    }
117
    if ((p->argv[i][0] == 0) || (p->argv[i][1] != ':') || (p->argv[i][2] != 0)) {
117
    if ((p->argv[i][0] == 0) || (p->argv[i][1] != ':') || (p->argv[i][2] != 0)) {
118
      outputnl("Invalid parameter format");
118
      nls_outputnl(0,3); /* "Invalid parameter format" */
119
      return(CMD_FAIL);
119
      return(CMD_FAIL);
120
    }
120
    }
121
    drv = p->argv[i][0];
121
    drv = p->argv[i][0];
122
    /* convert drive letter to a value 1..x (1=A, 2=B, etc) */
122
    /* convert drive letter to a value 1..x (1=A, 2=B, etc) */
123
    if ((drv >= 'a') && (drv <= 'z')) {
123
    if ((drv >= 'a') && (drv <= 'z')) {
Line 138... Line 138...
138
 
138
 
139
  /* if no drive specified, use the default one */
139
  /* if no drive specified, use the default one */
140
  if (drv == 0) {
140
  if (drv == 0) {
141
    drv = curdrv;
141
    drv = curdrv;
142
  } else if (!isdrivevalid(drv)) { /* is specified drive valid? */
142
  } else if (!isdrivevalid(drv)) { /* is specified drive valid? */
143
    outputnl("Invalid drive");
143
    nls_outputnl(255,15); /* "Invalid drive" */
144
    return(CMD_FAIL);
144
    return(CMD_FAIL);
145
  }
145
  }
146
 
146
 
147
  cmd_vol_internal(drv, p->BUFFER);
147
  cmd_vol_internal(drv, p->BUFFER);
148
 
148