Subversion Repositories SvarDOS

Rev

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

Rev 421 Rev 533
Line 91... Line 91...
91
    outputnl(buff + 64);
91
    outputnl(buff + 64);
92
  }
92
  }
93
}
93
}
94
 
94
 
95
 
95
 
96
static int cmd_vol(struct cmd_funcparam *p) {
96
static enum cmd_result cmd_vol(struct cmd_funcparam *p) {
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
    outputnl("Displays the disk volume label and serial number, if they exist.");
103
    outputnl("");
103
    outputnl("");
104
    outputnl("VOL [drive:]");
104
    outputnl("VOL [drive:]");
105
    return(-1);
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
      outputnl("Invalid switch");
111
      return(-1);
111
      return(CMD_FAIL);
112
    }
112
    }
113
    if (drv != 0) {
113
    if (drv != 0) {
114
      outputnl("Too many parameters");
114
      outputnl("Too many parameters");
115
      return(-1);
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
      outputnl("Invalid parameter format");
119
      return(-1);
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')) {
124
      drv -= 'a';
124
      drv -= 'a';
Line 139... Line 139...
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
    outputnl("Invalid drive");
144
    return(-1);
144
    return(CMD_FAIL);
145
  }
145
  }
146
 
146
 
147
  cmd_vol_internal(drv, p->BUFFER);
147
  cmd_vol_internal(drv, p->BUFFER);
148
 
148
 
149
  return(-1);
149
  return(CMD_OK);
150
}
150
}