Subversion Repositories SvarDOS

Rev

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

Rev 1139 Rev 1156
Line 322... Line 322...
322
  *s = 0;
322
  *s = 0;
323
  output(buff);
323
  output(buff);
324
}
324
}
325
 
325
 
326
 
326
 
-
 
327
static void dos_fname2fcb(char far *fcb, const char *cmd) {
-
 
328
  unsigned short fcb_seg, fcb_off;
-
 
329
  fcb_seg = FP_SEG(fcb);
-
 
330
  fcb_off = FP_OFF(fcb);
-
 
331
  _asm {
-
 
332
    push ax
-
 
333
    push bx
-
 
334
    push cx
-
 
335
    push dx
-
 
336
    push es
-
 
337
    push si
-
 
338
 
-
 
339
    mov ax, 0x2900   /* DOS 1+ - parse filename into FCB (DS:SI=fname, ES:DI=FCB) */
-
 
340
    mov si, cmd
-
 
341
    mov es, fcb_seg
-
 
342
    mov di, fcb_off
-
 
343
    int 0x21
-
 
344
 
-
 
345
    pop si
-
 
346
    pop es
-
 
347
    pop dx
-
 
348
    pop cx
-
 
349
    pop bx
-
 
350
    pop ax
-
 
351
  }
-
 
352
}
-
 
353
 
-
 
354
 
-
 
355
/* parses cmdtail and fills fcb1 and fcb2 with first and second arguments,
-
 
356
 * respectively. an FCB is 12 bytes long:
-
 
357
 * drive (0=default, 1=A, 2=B, etc)
-
 
358
 * fname (8 chars, blank-padded)
-
 
359
 * fext (3 chars, blank-padded) */
-
 
360
static void cmdtail_to_fcb(char far *fcb1, char far *fcb2, const char *cmdtail) {
-
 
361
 
-
 
362
  /* skip any leading spaces */
-
 
363
  while (*cmdtail == ' ') cmdtail++;
-
 
364
 
-
 
365
  /* convert first arg */
-
 
366
  dos_fname2fcb(fcb1, cmdtail);
-
 
367
 
-
 
368
  /* skip to next arg */
-
 
369
  while ((*cmdtail != ' ') && (*cmdtail != 0)) cmdtail++;
-
 
370
  while (*cmdtail == ' ') cmdtail++;
-
 
371
 
-
 
372
  /* convert second arg */
-
 
373
  dos_fname2fcb(fcb2, cmdtail);
-
 
374
}
-
 
375
 
-
 
376
 
327
/* a few internal flags */
377
/* a few internal flags */
328
#define DELETE_STDIN_FILE 1
378
#define DELETE_STDIN_FILE 1
329
#define CALL_FLAG         2
379
#define CALL_FLAG         2
330
 
380
 
331
static void run_as_external(char *buff, const char *cmdline, unsigned short envseg, struct rmod_props far *rmod, struct redir_data *redir, unsigned char flags) {
381
static void run_as_external(char *buff, const char *cmdline, unsigned short envseg, struct rmod_props far *rmod, struct redir_data *redir, unsigned char flags) {
Line 506... Line 556...
506
 
556
 
507
  /* set up rmod to execute the command */
557
  /* set up rmod to execute the command */
508
 
558
 
509
  ExecParam->envseg = envseg;
559
  ExecParam->envseg = envseg;
510
  ExecParam->cmdtail = (unsigned long)MK_FP(rmod->rmodseg, 0x80); /* farptr, must be in PSP format (lenbyte args \r) */
560
  ExecParam->cmdtail = (unsigned long)MK_FP(rmod->rmodseg, 0x80); /* farptr, must be in PSP format (lenbyte args \r) */
-
 
561
  /* far pointers to unopened FCB entries (stored in RMOD's own PSP) */
-
 
562
  {
-
 
563
    char far *farptr;
-
 
564
    /* prep the unopened FCBs */
-
 
565
    farptr = MK_FP(rmod->rmodseg, 0x5C);
-
 
566
    _fmemset(farptr, 0, 36); /* first FCB is 16 bytes long, second is 20 bytes long */
-
 
567
    cmdtail_to_fcb(farptr, farptr + 16, cmdtail);
-
 
568
    /* set (far) pointers in the ExecParam block */
511
  ExecParam->fcb1 = 0; /* TODO farptr */
569
    ExecParam->fcb1 = (unsigned long)MK_FP(rmod->rmodseg, 0x5C);
512
  ExecParam->fcb2 = 0; /* TODO farptr */
570
    ExecParam->fcb2 = (unsigned long)MK_FP(rmod->rmodseg, 0x6C);
-
 
571
  }
513
  exit(0); /* let rmod do the job now */
572
  exit(0); /* let rmod do the job now */
514
}
573
}
515
 
574
 
516
 
575
 
517
static void set_comspec_to_self(unsigned short envseg) {
576
static void set_comspec_to_self(unsigned short envseg) {