Subversion Repositories SvarDOS

Rev

Rev 1954 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1954 Rev 2228
Line 25... Line 25...
25
/*
25
/*
26
 * ver
26
 * ver
27
 */
27
 */
28
 
28
 
29
 
29
 
-
 
30
/* takes two numbers and builds a string of the format "%u.%02u" */
-
 
31
static void cmd_ver_buildver(char *buf, unsigned char x, unsigned char y) {
-
 
32
  buf += ustoa(buf, x, 0, '0');
-
 
33
  *buf = '.';
-
 
34
  buf++;
-
 
35
  ustoa(buf, y, 2, '0');
-
 
36
}
-
 
37
 
-
 
38
 
30
static enum cmd_result cmd_ver(struct cmd_funcparam *p) {
39
static enum cmd_result cmd_ver(struct cmd_funcparam *p) {
31
  char *buff = p->BUFFER;
40
  char *buff = p->BUFFER;
32
  unsigned char maj = 0, min = 0, retcode = 0, truemaj = 0, truemin = 0, rev = 0, verflags = 0;
41
  unsigned char maj = 0, min = 0, retcode = 0, truemaj = 0, truemin = 0, rev = 0, verflags = 0;
33
  unsigned short drdosver = 0;
42
  unsigned short drdosver = 0;
34
  unsigned short doscrelstrseg = 0, doscrelstroff = 0;
43
  unsigned short doscrelstrseg = 0, doscrelstroff = 0;
Line 60... Line 69...
60
    printf("environment allocated size: %u bytes\r\n", env_allocsz(*rmod_envseg));
69
    printf("environment allocated size: %u bytes\r\n", env_allocsz(*rmod_envseg));
61
    for (fptr = MK_FP(p->rmod->rmodseg, RMOD_OFFSET_BOOTDRIVE), i = 0; *fptr != 0; fptr++) buff[i++] = *fptr;
70
    for (fptr = MK_FP(p->rmod->rmodseg, RMOD_OFFSET_BOOTDRIVE), i = 0; *fptr != 0; fptr++) buff[i++] = *fptr;
62
    buff[i] = 0;
71
    buff[i] = 0;
63
    printf("[rmod:RMOD_OFFSET_BOOTCOMSPEC] = '%s'\r\n", buff);
72
    printf("[rmod:RMOD_OFFSET_BOOTCOMSPEC] = '%s'\r\n", buff);
64
    if (*rmod_comspecptr == 0) {
73
    if (*rmod_comspecptr == 0) {
65
      sprintf(buff, "NULL");
74
      sv_strcpy(buff, "NULL");
66
    } else {
75
    } else {
67
      for (fptr = MK_FP(*rmod_envseg, *rmod_comspecptr), i = 0; *fptr != 0; fptr++) buff[i++] = *fptr;
76
      for (fptr = MK_FP(*rmod_envseg, *rmod_comspecptr), i = 0; *fptr != 0; fptr++) buff[i++] = *fptr;
68
      buff[i] = 0;
77
      buff[i] = 0;
69
    }
78
    }
70
    printf("[rmod:RMOD_OFFSET_COMSPECPTR] = '%s'\r\n", buff);
79
    printf("[rmod:RMOD_OFFSET_COMSPECPTR] = '%s'\r\n", buff);
Line 155... Line 164...
155
    buff[i] = 0;
164
    buff[i] = 0;
156
    outputnl(buff);
165
    outputnl(buff);
157
  }
166
  }
158
 
167
 
159
  if (drdosver != 0) {
168
  if (drdosver != 0) {
-
 
169
    char hexbuf[8];
160
    sprintf(buff, svarlang_str(20,11), drdosver & 0xff, drdosver >> 8);
170
    sv_strcpy(buff, svarlang_str(20,11)); /* DR-DOS kernel version % */
-
 
171
    ustoh(hexbuf, drdosver);
-
 
172
    sv_insert_str_in_str(buff, hexbuf);
161
    outputnl(buff);
173
    outputnl(buff);
162
  }
174
  }
163
 
175
 
-
 
176
  {
-
 
177
  char verbuf[8];
-
 
178
  cmd_ver_buildver(verbuf, maj, min);
164
  sprintf(buff, svarlang_str(20,1), maj, min); /* "DOS kernel version %u.%u" */
179
  sv_strcpy(buff, svarlang_str(20,1)); /* "DOS kernel version %" */
-
 
180
  sv_insert_str_in_str(buff, verbuf);
165
  output(buff);
181
  output(buff);
-
 
182
  }
166
 
183
 
167
  /* can we trust in the data returned? */
184
  /* can we trust in the data returned? */
168
  /* DR DOS 5&6 return 0x01, MS-DOS 2-4 return 0xff */
185
  /* DR DOS 5&6 return 0x01, MS-DOS 2-4 return 0xff */
169
  /* 'truemaj' is checked to mitigate the conflict from the CBIS redirector */
186
  /* 'truemaj' is checked to mitigate the conflict from the CBIS redirector */
170
  if ((retcode > 1) && (retcode < 255) && (truemaj > 4) && (truemaj < 100)) {
187
  if ((retcode > 1) && (retcode < 255) && (truemaj > 4) && (truemaj < 100)) {
171
    if ((maj != truemaj) || (min != truemin)) {
188
    if ((maj != truemaj) || (min != truemin)) {
-
 
189
      char verbuf[8];
-
 
190
      cmd_ver_buildver(verbuf, truemaj, truemin);
172
      output(" (");
191
      output(" (");
173
      sprintf(buff, svarlang_str(20,10), truemaj, truemin); /* "true ver xx.xx" */
192
      sv_strcpy(buff, svarlang_str(20,10)); /* "true ver %" */
-
 
193
      sv_insert_str_in_str(buff, verbuf);
174
      output(buff);
194
      output(buff);
175
      output(")");
195
      output(")");
176
    }
196
    }
177
    outputnl("");
197
    outputnl("");
178
 
198
 
179
    sprintf(buff, svarlang_str(20,5), 'A' + rev); /* "Revision %c" */
199
    sv_strcpy(buff, svarlang_str(20,5)); /* "Revision %c" */
-
 
200
    sv_strtr(buff, '@', 'A' + rev);
180
    outputnl(buff);
201
    outputnl(buff);
181
 
202
 
182
    {
203
    {
183
      const char *loc = svarlang_str(20,7);        /* "low memory" */
204
      const char *loc = svarlang_str(20,7);        /* "low memory" */
184
      if (verflags & 16) loc = svarlang_str(20,8); /* "HMA" */
205
      if (verflags & 16) loc = svarlang_str(20,8); /* "HMA" */
185
      if (verflags & 8) loc = svarlang_str(20,9);  /* "ROM" */
206
      if (verflags & 8) loc = svarlang_str(20,9);  /* "ROM" */
186
      sprintf(buff, svarlang_str(20,6), loc);      /* "DOS is in %s" */
207
      sv_strcpy(buff, svarlang_str(20,6));         /* "DOS is in %" */
-
 
208
      sv_insert_str_in_str(buff, loc);
187
      outputnl(buff);
209
      outputnl(buff);
188
    }
210
    }
189
  }
211
  }
190
 
212
 
191
  outputnl("");
213
  outputnl("");