Subversion Repositories SvarDOS

Rev

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

Rev 603 Rev 606
Line 74... Line 74...
74
  NLS_ERR_READFAIL      = 0x0902,
74
  NLS_ERR_READFAIL      = 0x0902,
75
  NLS_ERR_INVPARAM      = 0x0903
75
  NLS_ERR_INVPARAM      = 0x0903
76
};
76
};
77
 
77
 
78
 
78
 
79
static void nls_puts(enum NLS_STRINGS id) {
79
static void output(const char *s) {
-
 
80
  _asm {
80
  puts(svarlang_strid(id));
81
    /* set cx to strlen(s) */
-
 
82
    push ds
-
 
83
    pop es
-
 
84
    mov di, s
-
 
85
    xor al, al
-
 
86
    cld
-
 
87
    mov cx, 0xff
-
 
88
    repne scasb  /* compare ES:DI with AL, inc DI until match */
-
 
89
    mov cx, di
-
 
90
    sub cx, s
-
 
91
    dec cx
-
 
92
    /* output via DOS */
-
 
93
    mov ah, 0x40  /* write to handle */
-
 
94
    mov bx, 1     /* 1=stdout */
-
 
95
    mov dx, s
-
 
96
    int 0x21
-
 
97
  }
-
 
98
}
-
 
99
 
-
 
100
 
-
 
101
static void crlf(void) {
-
 
102
  output("\r\n");
-
 
103
}
-
 
104
 
-
 
105
 
-
 
106
static void outputnl(const char *s) {
-
 
107
  output(s);
-
 
108
  crlf();
81
}
109
}
82
 
110
 
83
 
111
 
84
static void nls_put(enum NLS_STRINGS id) {
112
static void nls_put(enum NLS_STRINGS id) {
85
  printf("%s", svarlang_strid(id));
113
  output(svarlang_strid(id));
86
}
114
}
87
 
115
 
88
 
116
 
89
static void crlf(void) {
117
static void nls_puts(enum NLS_STRINGS id) {
90
  puts("");
118
  nls_put(id);
-
 
119
  crlf();
91
}
120
}
92
 
121
 
93
 
122
 
94
static void about(void) {
123
static void about(void) {
95
  printf("localcfg ");
124
  output("localcfg ");
96
  nls_put(NLS_HLP_VER);
125
  nls_put(NLS_HLP_VER);
97
  puts(" " PVER ", (C) " PDATE " Mateusz Viste");
126
  outputnl(" " PVER ", (C) " PDATE " Mateusz Viste");
98
  crlf();
-
 
99
  nls_puts(NLS_HLP_DESC);
127
  nls_puts(NLS_HLP_DESC);
100
  crlf();
128
  crlf();
101
  nls_puts(NLS_HLP_USAGE);
129
  nls_puts(NLS_HLP_USAGE);
102
  crlf();
130
  crlf();
103
  nls_puts(NLS_HLP_OPTIONS);
131
  nls_puts(NLS_HLP_OPTIONS);
Line 357... Line 385...
357
 
385
 
358
int main(int argc, char **argv) {
386
int main(int argc, char **argv) {
359
  struct country cntdata;
387
  struct country cntdata;
360
  int changedflag;
388
  int changedflag;
361
  int x;
389
  int x;
362
  static char fname[130];
390
  char fname[130];
-
 
391
  char buff[128];
363
 
392
 
364
  svarlang_autoload("localcfg");
393
  svarlang_autoload("localcfg");
365
 
394
 
366
  /* scan argv looking for the path to country.sys */
395
  /* scan argv looking for the path to country.sys */
367
  for (x = 1; x < argc; x++) {
396
  for (x = 1; x < argc; x++) {
Line 401... Line 430...
401
      return(3);
430
      return(3);
402
    }
431
    }
403
  }
432
  }
404
 
433
 
405
  nls_put(NLS_INFO_COUNTRY);
434
  nls_put(NLS_INFO_COUNTRY);
406
  printf(" %03d\r\n", cntdata.CTYINFO.id);
435
  sprintf(buff, " %03d", cntdata.CTYINFO.id);
-
 
436
  outputnl(buff);
407
  nls_put(NLS_INFO_CODEPAGE);
437
  nls_put(NLS_INFO_CODEPAGE);
408
  printf(" %d\r\n", cntdata.CTYINFO.codepage);
438
  sprintf(buff, " %d", cntdata.CTYINFO.codepage);
-
 
439
  outputnl(buff);
409
  nls_put(NLS_INFO_DECSEP);
440
  nls_put(NLS_INFO_DECSEP);
410
  printf(" %c\r\n", cntdata.CTYINFO.decimal[0]);
441
  sprintf(buff, " %c", cntdata.CTYINFO.decimal[0]);
-
 
442
  outputnl(buff);
411
  nls_put(NLS_INFO_THOUSEP);
443
  nls_put(NLS_INFO_THOUSEP);
412
  printf(" %c\r\n", cntdata.CTYINFO.thousands[0]);
444
  sprintf(buff, " %c", cntdata.CTYINFO.thousands[0]);
-
 
445
  outputnl(buff);
413
  nls_put(NLS_INFO_DATEFMT);
446
  nls_put(NLS_INFO_DATEFMT);
414
  printf(" %s\r\n", datestring(&cntdata));
447
  sprintf(buff, " %s", datestring(&cntdata));
-
 
448
  outputnl(buff);
415
  nls_put(NLS_INFO_TIMEFMT);
449
  nls_put(NLS_INFO_TIMEFMT);
416
  printf(" %s\r\n", timestring(&cntdata));
450
  sprintf(buff, " %s", timestring(&cntdata));
-
 
451
  outputnl(buff);
417
  nls_put(NLS_INFO_YESNO);
452
  nls_put(NLS_INFO_YESNO);
418
  printf(" %c/%c\r\n", cntdata.YESNO.yes[0], cntdata.YESNO.no[0]);
453
  sprintf(buff, " %c/%c", cntdata.YESNO.yes[0], cntdata.YESNO.no[0]);
-
 
454
  outputnl(buff);
419
  nls_put(NLS_INFO_CURREXAMPLE);
455
  nls_put(NLS_INFO_CURREXAMPLE);
420
  printf(" %s\r\n", currencystring(&cntdata));
456
  sprintf(" %s", currencystring(&cntdata));
-
 
457
  outputnl(buff);
421
 
458
 
422
  crlf();
459
  crlf();
423
  nls_puts(NLS_MAKESURE);
460
  nls_puts(NLS_MAKESURE);
424
  printf("COUNTRY=%03d,%03d,%s", cntdata.CTYINFO.id, cntdata.CTYINFO.codepage, fname);
461
  sprintf(buff, "COUNTRY=%03d,%03d,%s", cntdata.CTYINFO.id, cntdata.CTYINFO.codepage, fname);
425
  crlf();
462
  outputnl(buff);
426
 
463
 
427
  /* if anything changed, write the new file */
464
  /* if anything changed, write the new file */
428
  if (changedflag != 0) country_write(fname, &cntdata);
465
  if (changedflag != 0) country_write(fname, &cntdata);
429
 
466
 
430
  return(0);
467
  return(0);