Subversion Repositories SvarDOS

Rev

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

Rev 1724 Rev 1725
Line 414... Line 414...
414
      }
414
      }
415
      req->filespecptr = *argv;
415
      req->filespecptr = *argv;
416
    }
416
    }
417
  }
417
  }
418
 
418
 
419
  if (req->filespecptr == NULL) req->filespecptr = ".";
-
 
420
  return(0);
419
  return(0);
421
}
420
}
422
 
421
 
423
 
422
 
424
static enum cmd_result cmd_dir(struct cmd_funcparam *p) {
423
static enum cmd_result cmd_dir(struct cmd_funcparam *p) {
Line 437... Line 436...
437
    unsigned short orderidx[65535 / sizeof(struct TINYDTA)];
436
    unsigned short orderidx[65535 / sizeof(struct TINYDTA)];
438
  } *buf = (void *)(p->BUFFER);
437
  } *buf = (void *)(p->BUFFER);
439
  unsigned long summary_fcount = 0;
438
  unsigned long summary_fcount = 0;
440
  unsigned long summary_totsz = 0;
439
  unsigned long summary_totsz = 0;
441
  unsigned char drv = 0;
440
  unsigned char drv = 0;
442
 
-
 
443
  struct dirrequest req;
441
  struct dirrequest req;
444
 
442
 
445
  /* preload req with default values */
-
 
446
  bzero(&req, sizeof(req));
-
 
447
  req.attrfilter_may = DIR_ATTR_DEFAULT;
-
 
448
  /* req.attrfilter_must = 0;
-
 
449
  req.flags = 0; */
-
 
450
  req.format = DIR_OUTPUT_NORM;
-
 
451
 
-
 
452
  /* make sure there's no risk of buffer overflow */
443
  /* make sure there's no risk of buffer overflow */
453
  if (sizeof(buf) > p->BUFFERSZ) {
444
  if (sizeof(buf) > p->BUFFERSZ) {
454
    outputnl("INTERNAL MEM ERROR IN " __FILE__);
445
    outputnl("INTERNAL MEM ERROR IN " __FILE__);
455
    return(CMD_FAIL);
446
    return(CMD_FAIL);
456
  }
447
  }
Line 483... Line 474...
483
  if (i != 0) nls_outputnl_doserr(i);
474
  if (i != 0) nls_outputnl_doserr(i);
484
 
475
 
485
  /* disable usage of thousands separator on narrow screens */
476
  /* disable usage of thousands separator on narrow screens */
486
  if (screenw < 80) buf->nls.thousep[0] = 0;
477
  if (screenw < 80) buf->nls.thousep[0] = 0;
487
 
478
 
-
 
479
  /*** PARSING COMMAND LINE STARTS *******************************************/
-
 
480
 
-
 
481
  /* init req with some defaults */
-
 
482
  bzero(&req, sizeof(req));
-
 
483
  req.attrfilter_may = DIR_ATTR_DEFAULT;
-
 
484
  req.format = DIR_OUTPUT_NORM;
-
 
485
 
-
 
486
  /* process DIRCMD first (so it can be overidden by user's cmdline) */
-
 
487
  {
-
 
488
  const char far *dircmd = env_lookup_val(p->env_seg, "DIRCMD");
-
 
489
  if (dircmd != NULL) {
-
 
490
    const char *argvptrs[32];
-
 
491
    cmd_explode(buf->buff64, dircmd, argvptrs);
-
 
492
    if ((dir_parse_cmdline(&req, argvptrs) != 0) || (req.filespecptr != NULL)) {
-
 
493
      nls_output(255, 10);/* bad environment */
-
 
494
      output(" - ");
-
 
495
      outputnl("DIRCMD");
-
 
496
      return(CMD_FAIL);
-
 
497
    }
-
 
498
  }
-
 
499
  }
-
 
500
 
488
  /* parse command line */
501
  /* parse user's command line */
489
  if (dir_parse_cmdline(&req, p->argv) != 0) return(CMD_FAIL);
502
  if (dir_parse_cmdline(&req, p->argv) != 0) return(CMD_FAIL);
490
 
503
 
-
 
504
  /* if no filespec provided, then it's about the current directory */
-
 
505
  if (req.filespecptr == NULL) req.filespecptr = ".";
-
 
506
 
-
 
507
  /*** PARSING COMMAND LINE DONE *********************************************/
-
 
508
 
-
 
509
 
491
  availrows = screen_getheight() - 2;
510
  availrows = screen_getheight() - 2;
492
 
511
 
493
  /* special case: "DIR drive:" (truename() fails on "C:" under MS-DOS 6.0) */
512
  /* special case: "DIR drive:" (truename() fails on "C:" under MS-DOS 6.0) */
494
  if ((req.filespecptr[0] != 0) && (req.filespecptr[1] == ':') && (req.filespecptr[2] == 0)) {
513
  if ((req.filespecptr[0] != 0) && (req.filespecptr[1] == ':') && (req.filespecptr[2] == 0)) {
495
    if ((req.filespecptr[0] >= 'a') && (req.filespecptr[0] <= 'z')) {
514
    if ((req.filespecptr[0] >= 'a') && (req.filespecptr[0] <= 'z')) {