Subversion Repositories SvarDOS

Rev

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

Rev 367 Rev 369
Line 247... Line 247...
247
 
247
 
248
  rmod_seg = rmod_find();
248
  rmod_seg = rmod_find();
249
  if (rmod_seg == 0xffff) {
249
  if (rmod_seg == 0xffff) {
250
    rmod_seg = rmod_install(cfg.envsiz);
250
    rmod_seg = rmod_install(cfg.envsiz);
251
    if (rmod_seg == 0xffff) {
251
    if (rmod_seg == 0xffff) {
252
      puts("ERROR: rmod_install() failed");
252
      outputnl("ERROR: rmod_install() failed");
253
      return(1);
253
      return(1);
254
    }
254
    }
255
    printf("rmod installed at seg 0x%04X\r\n", rmod_seg);
255
/*    printf("rmod installed at seg 0x%04X\r\n", rmod_seg); */
256
  } else {
256
  } else {
257
    printf("rmod found at seg 0x%04x\r\n", rmod_seg);
257
/*    printf("rmod found at seg 0x%04x\r\n", rmod_seg); */
258
  }
258
  }
259
 
259
 
260
  rmod_envseg = MK_FP(rmod_seg, RMOD_OFFSET_ENVSEG);
260
  rmod_envseg = MK_FP(rmod_seg, RMOD_OFFSET_ENVSEG);
261
  lastexitcode = MK_FP(rmod_seg, RMOD_OFFSET_LEXITCODE);
261
  lastexitcode = MK_FP(rmod_seg, RMOD_OFFSET_LEXITCODE);
262
 
262
 
263
  /* make COMPSEC point to myself */
263
  /* make COMPSEC point to myself */
264
  set_comspec_to_self(*rmod_envseg);
264
  set_comspec_to_self(*rmod_envseg);
265
 
265
 
266
  {
266
/*  {
267
    unsigned short envsiz;
267
    unsigned short envsiz;
268
    unsigned short far *sizptr = MK_FP(*rmod_envseg - 1, 3);
268
    unsigned short far *sizptr = MK_FP(*rmod_envseg - 1, 3);
269
    envsiz = *sizptr;
269
    envsiz = *sizptr;
270
    envsiz *= 16;
270
    envsiz *= 16;
271
    printf("rmod_inpbuff at %04X:%04X, env_seg at %04X:0000 (env_size = %u bytes)\r\n", rmod_seg, RMOD_OFFSET_INPBUFF, *rmod_envseg, envsiz);
271
    printf("rmod_inpbuff at %04X:%04X, env_seg at %04X:0000 (env_size = %u bytes)\r\n", rmod_seg, RMOD_OFFSET_INPBUFF, *rmod_envseg, envsiz);
272
  }
272
  }*/
273
 
273
 
274
  for (;;) {
274
  for (;;) {
275
    char far *cmdline = MK_FP(rmod_seg, RMOD_OFFSET_INPBUFF + 2);
275
    char far *cmdline = MK_FP(rmod_seg, RMOD_OFFSET_INPBUFF + 2);
276
 
276
 
277
    /* revert input history terminator to \r */
277
    /* revert input history terminator to \r */
Line 331... Line 331...
331
      pop dx
331
      pop dx
332
      pop cx
332
      pop cx
333
      pop bx
333
      pop bx
334
      pop ax
334
      pop ax
335
    }
335
    }
336
    printf("\r\n");
336
    outputnl("");
337
 
337
 
338
    /* if nothing entered, loop again */
338
    /* if nothing entered, loop again */
339
    if (cmdline[-1] == 0) continue;
339
    if (cmdline[-1] == 0) continue;
340
 
340
 
341
    /* replace \r by a zero terminator */
341
    /* replace \r by a zero terminator */
Line 357... Line 357...
357
    /* if here, then this was not an internal command */
357
    /* if here, then this was not an internal command */
358
    run_as_external(cmdline);
358
    run_as_external(cmdline);
359
 
359
 
360
    /* execvp() replaces the current process by the new one
360
    /* execvp() replaces the current process by the new one
361
    if I am still alive then external command failed to execute */
361
    if I am still alive then external command failed to execute */
362
    puts("Bad command or file name");
362
    outputnl("Bad command or file name");
363
 
363
 
364
  }
364
  }
365
 
365
 
366
  return(0);
366
  return(0);
367
}
367
}