Subversion Repositories SvarDOS

Rev

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

Rev 1351 Rev 1352
Line 493... Line 493...
493
}
493
}
494
 
494
 
495
 
495
 
496
/* a custom argv-parsing routine that looks directly inside the PSP, avoids the need
496
/* a custom argv-parsing routine that looks directly inside the PSP, avoids the need
497
 * of argc and argv, saves some 330 bytes of binary size */
497
 * of argc and argv, saves some 330 bytes of binary size */
498
static char *parseargv(void) {
498
static const char *parseargv(void) {
499
  char *tail = (void *)0x81; /* THIS WORKS ONLY IN SMALL MEMORY MODEL */
499
  char *tail = (void *)0x81; /* THIS WORKS ONLY IN SMALL MEMORY MODEL */
500
  unsigned short count = 0;
500
  unsigned short count = 0;
501
  char *argv[4];
501
  char *argv[2];
502
 
502
 
503
  while (count < 4) {
503
  while (count < 2) {
504
    /* jump to nearest arg */
504
    /* jump to nearest arg */
505
    while (*tail == ' ') {
505
    while (*tail == ' ') {
506
      *tail = 0;
506
      *tail = 0;
507
      tail++;
507
      tail++;
508
    }
508
    }
Line 518... Line 518...
518
    while ((*tail != ' ') && (*tail != '\r')) tail++;
518
    while ((*tail != ' ') && (*tail != '\r')) tail++;
519
  }
519
  }
520
 
520
 
521
  /* check args now */
521
  /* check args now */
522
  if (count == 0) return("");
522
  if (count == 0) return("");
-
 
523
  if (count == 1) return(argv[0]);
523
 
524
 
524
  return(argv[0]);
525
  return(NULL);
525
}
526
}
526
 
527
 
527
 
528
 
528
/* returns 0 on success, 1 on file not found, 2 on other error */
529
/* returns 0 on success, 1 on file not found, 2 on other error */
529
static unsigned char loadfile(struct file *db, const char *fname) {
530
static unsigned char loadfile(struct file *db, const char *fname) {