Subversion Repositories SvarDOS

Rev

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

Rev 1726 Rev 1739
Line 187... Line 187...
187
 
187
 
188
 
188
 
189
static struct {
189
static struct {
190
  struct TINYDTA far *dtabuf_root;
190
  struct TINYDTA far *dtabuf_root;
191
  char order[8]; /* GNESD values (ucase = lower first ; lcase = higher first) */
191
  char order[8]; /* GNESD values (ucase = lower first ; lcase = higher first) */
-
 
192
  unsigned char sortownia[256]; /* collation table (used for NLS-aware sorts) */
192
} glob_sortcmp_dat;
193
} glob_sortcmp_dat;
193
 
194
 
194
 
195
 
195
/* translates an order string like "GNE-S" into values fed into the order[]
196
/* translates an order string like "GNE-S" into values fed into the order[]
196
 * table of glob_sortcmp_dat. returns 0 on success, non-zero otherwise. */
197
 * table of glob_sortcmp_dat. returns 0 on success, non-zero otherwise. */
Line 278... Line 279...
278
          while ((*f2 != 0) && (*f2 != '.')) f2++;
279
          while ((*f2 != 0) && (*f2 != '.')) f2++;
279
          limit = 4; /* TINYDTA structs are not nul-terminated */
280
          limit = 4; /* TINYDTA structs are not nul-terminated */
280
        }
281
        }
281
        /* cmp */
282
        /* cmp */
282
        for (i = 0; i < limit; i++) {
283
        for (i = 0; i < limit; i++) {
283
          if ((*f1 | 32) < (*f2 | 32)) return(0 - r);
284
          if ((glob_sortcmp_dat.sortownia[(unsigned char)(*f1)]) < (glob_sortcmp_dat.sortownia[(unsigned char)(*f2)])) return(0 - r);
284
          if ((*f1 | 32) > (*f2 | 32)) return(r);
285
          if ((glob_sortcmp_dat.sortownia[(unsigned char)(*f1)]) > (glob_sortcmp_dat.sortownia[(unsigned char)(*f2)])) return(r);
285
          if (*f1 == 0) break;
286
          if (*f1 == 0) break;
286
          f1++;
287
          f1++;
287
          f2++;
288
          f2++;
288
        }
289
        }
289
      }
290
      }
Line 447... Line 448...
447
  if (sizeof(buf) > p->BUFFERSZ) {
448
  if (sizeof(buf) > p->BUFFERSZ) {
448
    outputnl("INTERNAL MEM ERROR IN " __FILE__);
449
    outputnl("INTERNAL MEM ERROR IN " __FILE__);
449
    return(CMD_FAIL);
450
    return(CMD_FAIL);
450
  }
451
  }
451
 
452
 
452
  bzero(&glob_sortcmp_dat, sizeof(glob_sortcmp_dat));
-
 
453
 
-
 
454
  if (cmd_ishlp(p)) {
453
  if (cmd_ishlp(p)) {
455
    nls_outputnl(37,0); /* "Displays a list of files and subdirectories in a directory" */
454
    nls_outputnl(37,0); /* "Displays a list of files and subdirectories in a directory" */
456
    outputnl("");
455
    outputnl("");
457
    nls_outputnl(37,1); /* "DIR [drive:][path][filename] [/P] [/W] [/A[:]attributes] [/O[[:]sortorder]] [/S] [/B] [/L]" */
456
    nls_outputnl(37,1); /* "DIR [drive:][path][filename] [/P] [/W] [/A[:]attributes] [/O[[:]sortorder]] [/S] [/B] [/L]" */
458
    outputnl("");
457
    outputnl("");
Line 471... Line 470...
471
    nls_outputnl(37,11); /* "/B Uses bare format (no heading information or summary)" */
470
    nls_outputnl(37,11); /* "/B Uses bare format (no heading information or summary)" */
472
    nls_outputnl(37,12); /* "/L Uses lowercases" */
471
    nls_outputnl(37,12); /* "/L Uses lowercases" */
473
    return(CMD_OK);
472
    return(CMD_OK);
474
  }
473
  }
475
 
474
 
-
 
475
  /* zero out glob_sortcmp_dat and init the collation table */
-
 
476
  bzero(&glob_sortcmp_dat, sizeof(glob_sortcmp_dat));
-
 
477
  for (i = 0; i < 256; i++) {
-
 
478
    glob_sortcmp_dat.sortownia[i] = i;
-
 
479
    /* sorting should be case-insensitive */
-
 
480
    if ((i >= 'A') && (i <='a')) glob_sortcmp_dat.sortownia[i] |= 32;
-
 
481
  }
-
 
482
 
476
  i = nls_getpatterns(&(buf->nls));
483
  i = nls_getpatterns(&(buf->nls));
477
  if (i != 0) nls_outputnl_doserr(i);
484
  if (i != 0) nls_outputnl_doserr(i);
478
 
485
 
479
  /* disable usage of thousands separator on narrow screens */
486
  /* disable usage of thousands separator on narrow screens */
480
  if (screenw < 80) buf->nls.thousep[0] = 0;
487
  if (screenw < 80) buf->nls.thousep[0] = 0;