Subversion Repositories SvarDOS

Rev

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

Rev 1743 Rev 1744
Line 71... Line 71...
71
/*  char fname[13]; */
71
/*  char fname[13]; */
72
  char fname[12];
72
  char fname[12];
73
};
73
};
74
 
74
 
75
 
75
 
-
 
76
/* returns current COUNTRY id (1=USA, 7=RU, 33=FR, 48=PL, 49=DE, etc) */
-
 
77
static unsigned short dir_cur_country(void) {
-
 
78
  _Packed struct { /* Extended Country Info Block */
-
 
79
    unsigned char bRecID;   /* Information ID */
-
 
80
    unsigned short wRecLen; /* size of information */
-
 
81
    unsigned short wCountryID; /* country code */
-
 
82
    unsigned short wCodePgID;  /* code page */
-
 
83
    /* the block structure is much larger, but I only need the fields above */
-
 
84
  } buff;
-
 
85
  void *buffptr = &buff;
-
 
86
 
-
 
87
  _asm {
-
 
88
    push ax
-
 
89
    push bx
-
 
90
    push cx
-
 
91
    push dx
-
 
92
    push es
-
 
93
    push di
-
 
94
 
-
 
95
    mov ax, 0x6501  /* DOS 3.3+ - Get Extended Country Information */
-
 
96
    mov bx, 0xffff  /* code page (FFFFh = current) */
-
 
97
    mov cx, 7       /* sizeof(buff) */
-
 
98
    mov dx, bx      /* country code (FFFFh = current) */
-
 
99
    push ds
-
 
100
    pop es
-
 
101
    mov di, buffptr
-
 
102
    int 0x21
-
 
103
 
-
 
104
    pop di
-
 
105
    pop es
-
 
106
    pop dx
-
 
107
    pop cx
-
 
108
    pop bx
-
 
109
    pop ax
-
 
110
  }
-
 
111
 
-
 
112
  return(buff.wCountryID);
-
 
113
}
-
 
114
 
-
 
115
 
76
/* fills freebytes with free bytes for drv (A=0, B=1, etc)
116
/* fills freebytes with free bytes for drv (A=0, B=1, etc)
77
 * returns DOS ERR code on failure */
117
 * returns DOS ERR code on failure */
78
static unsigned short cmd_dir_df(unsigned long *freebytes, unsigned char drv) {
118
static unsigned short cmd_dir_df(unsigned long *freebytes, unsigned char drv) {
79
  unsigned short res = 0;
119
  unsigned short res = 0;
80
  unsigned short sects_per_clust = 0, avail_clusts = 0, bytes_per_sect = 0;
120
  unsigned short sects_per_clust = 0, avail_clusts = 0, bytes_per_sect = 0;
Line 479... Line 519...
479
    /* sorting should be case-insensitive */
519
    /* sorting should be case-insensitive */
480
    if ((i >= 'A') && (i <= 'Z')) glob_sortcmp_dat.sortownia[i] |= 32;
520
    if ((i >= 'A') && (i <= 'Z')) glob_sortcmp_dat.sortownia[i] |= 32;
481
  }
521
  }
482
 
522
 
483
  /* try to replace (or complement) my naive collation table with an NLS-aware
523
  /* try to replace (or complement) my naive collation table with an NLS-aware
484
   * version provided by the kernel (or NLSFUNC) */
524
   * version provided by the kernel (or NLSFUNC)
-
 
525
   * do this ONLY for COUNTRY codes that are higher than 1, because zero is
-
 
526
   * invalid and value 1 can mean either "USA" or "undefined".
-
 
527
   * ref: https://github.com/SvarDOS/bugz/issues/68 */
485
  {
528
  if (dir_cur_country() > 1) {
486
    _Packed struct nlsseqtab {
529
    _Packed struct nlsseqtab {
487
      unsigned char id;
530
      unsigned char id;
488
      unsigned short taboff;
531
      unsigned short taboff;
489
      unsigned short tabseg;
532
      unsigned short tabseg;
490
    } collat;
533
    } collat;