Subversion Repositories SvarDOS

Rev

Rev 591 | Rev 593 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 591 Rev 592
1
/*
1
/*
2
 * Locales configuration for SvarDOS
2
 * Locales configuration for SvarDOS
3
 *
3
 *
4
 * Copyright (C) Mateusz Viste 2015-2022
4
 * Copyright (C) Mateusz Viste 2015-2022
5
 *
5
 *
6
 * Redistribution and use in source and binary forms, with or without
6
 * MIT license
7
 * modification, are permitted provided that the following conditions are met:
-
 
8
 *
7
 *
-
 
8
 * Permission is hereby granted, free of charge, to any person obtaining a copy
9
 * 1. Redistributions of source code must retain the above copyright notice,
9
 * of this software and associated documentation files (the "Software"), to
10
 *    this list of conditions and the following disclaimer.
10
 * deal in the Software without restriction, including without limitation the
-
 
11
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
11
 * 2. Redistributions in binary form must reproduce the above copyright
12
 * sell copies of the Software, and to permit persons to whom the Software is
12
 *    notice, this list of conditions and the following disclaimer in the
13
 * furnished to do so, subject to the following conditions:
-
 
14
 *
13
 *    documentation and/or other materials provided with the distribution.
15
 * The above copyright notice and this permission notice shall be included in
-
 
16
 * all copies or substantial portions of the Software.
-
 
17
 *
-
 
18
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-
 
19
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-
 
20
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-
 
21
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-
 
22
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-
 
23
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-
 
24
 * IN THE SOFTWARE.
14
 */
25
 */
15
 
26
 
16
#include <stdio.h>
27
#include <stdio.h>
17
#include <stdlib.h> /* atoi() */
28
#include <stdlib.h> /* atoi() */
18
#include <string.h> /* strchr */
29
#include <string.h> /* strchr */
19
 
30
 
20
#include "country.h"
31
#include "country.h"
21
 
32
 
22
#define PVER "20220202"
33
#define PVER "20220202"
23
#define PDATE "2015-2022"
34
#define PDATE "2015-2022"
24
 
35
 
25
 
36
 
26
static void about(void) {
37
static void about(void) {
27
  puts("localcfg ver " PVER " - locales configuration for DOS\n"
38
  puts("localcfg ver " PVER " - locales configuration for DOS\n"
28
       "Copyright (C) Mateusz Viste " PDATE "\n"
39
       "Copyright (C) Mateusz Viste " PDATE "\n"
29
       "\n"
40
       "\n"
30
       "localcfg creates a custom COUNTRY.SYS-like file matching your preferences.\n"
41
       "localcfg creates a custom COUNTRY.SYS-like file matching your preferences.\n"
31
       "\n"
42
       "\n"
32
       "usage: localcfg myprefs.sys [options]\n"
43
       "usage: localcfg myprefs.sys [options]\n"
33
       "\n"
44
       "\n"
34
       "options allow to configure country locales to your likening, as follows:\n"
45
       "options allow to configure country locales to your likening, as follows:\n"
35
       "  /country:XX indicates your country code is XX (1 for USA, 33 for France, etc)\n"
46
       "  /country:XX indicates your country code is XX (1 for USA, 33 for France, etc)\n"
36
       "  /cp:XXX     adapts country data for codepage XXX (example: '437')\n"
47
       "  /cp:XXX     adapts country data for codepage XXX (example: '437')\n"
37
       "  /decim:X    reconfigures the decimal symbol to be 'X'");
48
       "  /decim:X    reconfigures the decimal symbol to be 'X'");
38
  puts("  /thous:X    reconfigures the thousands symbol to be 'X'\n"
49
  puts("  /thous:X    reconfigures the thousands symbol to be 'X'\n"
39
       "  /datesep:X  sets the date separator to 'X' (for example '/')\n"
50
       "  /datesep:X  sets the date separator to 'X' (for example '/')\n"
40
       "  /datefmt:X  sets the date format, can be: MDY, DMY or YMD\n"
51
       "  /datefmt:X  sets the date format, can be: MDY, DMY or YMD\n"
41
       "  /timesep:X  sets the time separator to 'X' (for example ':')\n"
52
       "  /timesep:X  sets the time separator to 'X' (for example ':')\n"
42
       "  /timefmt:X  sets the time format: 0=12h with AM/PM or 1=24h\n"
53
       "  /timefmt:X  sets the time format: 0=12h with AM/PM or 1=24h\n"
43
       "  /curr:XXX   sets the currency to XXX (a string of 1 to 4 characters)\n"
54
       "  /curr:XXX   sets the currency to XXX (a string of 1 to 4 characters)\n"
44
       "  /currpos:X  sets the currency symbol position to X, where X is either");
55
       "  /currpos:X  sets the currency symbol position to X, where X is either");
45
  puts("              0=currency precedes the value, 1=currency follows the value and\n"
56
  puts("              0=currency precedes the value, 1=currency follows the value and\n"
46
       "              2=currency replaces the decimal sign\n"
57
       "              2=currency replaces the decimal sign\n"
47
       "  /currspc:X  space between the currency and the value (0=no, 1=yes)\n"
58
       "  /currspc:X  space between the currency and the value (0=no, 1=yes)\n"
48
       "  /currprec:X currency's precision (number of decimal digits, 0..9)\n"
59
       "  /currprec:X currency's precision (number of decimal digits, 0..9)\n"
49
       "  /yesno:XY   sets the 'Yes/No' letter to XY (default: YN)\n"
60
       "  /yesno:XY   sets the 'Yes/No' letter to XY (default: YN)\n"
50
      );
61
      );
51
}
62
}
52
 
63
 
53
 
64
 
54
static char *datestring(struct country *c) {
65
static char *datestring(struct country *c) {
55
  static char result[16];
66
  static char result[16];
56
  switch (c->CTYINFO.datefmt) {
67
  switch (c->CTYINFO.datefmt) {
57
    case COUNTRY_DATE_MDY:
68
    case COUNTRY_DATE_MDY:
58
      sprintf(result, "12%c31%c1990", c->CTYINFO.datesep[0], c->CTYINFO.datesep[0]);
69
      sprintf(result, "12%c31%c1990", c->CTYINFO.datesep[0], c->CTYINFO.datesep[0]);
59
      break;
70
      break;
60
    case COUNTRY_DATE_DMY:
71
    case COUNTRY_DATE_DMY:
61
      sprintf(result, "31%c12%c1990", c->CTYINFO.datesep[0], c->CTYINFO.datesep[0]);
72
      sprintf(result, "31%c12%c1990", c->CTYINFO.datesep[0], c->CTYINFO.datesep[0]);
62
      break;
73
      break;
63
    case COUNTRY_DATE_YMD:
74
    case COUNTRY_DATE_YMD:
64
    default:
75
    default:
65
      sprintf(result, "1990%c12%c31", c->CTYINFO.datesep[0], c->CTYINFO.datesep[0]);
76
      sprintf(result, "1990%c12%c31", c->CTYINFO.datesep[0], c->CTYINFO.datesep[0]);
66
      break;
77
      break;
67
  }
78
  }
68
  return(result);
79
  return(result);
69
}
80
}
70
 
81
 
71
 
82
 
72
static char *timestring(struct country *c) {
83
static char *timestring(struct country *c) {
73
  static char result[16];
84
  static char result[16];
74
  if (c->CTYINFO.timefmt == COUNTRY_TIME12) {
85
  if (c->CTYINFO.timefmt == COUNTRY_TIME12) {
75
    sprintf(result, "11%c59%c59 PM", c->CTYINFO.timesep[0], c->CTYINFO.timesep[0]);
86
    sprintf(result, "11%c59%c59 PM", c->CTYINFO.timesep[0], c->CTYINFO.timesep[0]);
76
  } else {
87
  } else {
77
    sprintf(result, "23%c59%c59", c->CTYINFO.timesep[0], c->CTYINFO.timesep[0]);
88
    sprintf(result, "23%c59%c59", c->CTYINFO.timesep[0], c->CTYINFO.timesep[0]);
78
  }
89
  }
79
  return(result);
90
  return(result);
80
}
91
}
81
 
92
 
82
 
93
 
83
static char *currencystring(struct country *c) {
94
static char *currencystring(struct country *c) {
84
  static char result[16];
95
  static char result[16];
85
  char decimalpart[16];
96
  char decimalpart[16];
86
  char space[2] = {0, 0};
97
  char space[2] = {0, 0};
87
  char decsym[8];
98
  char decsym[8];
88
  char cursym[8];
99
  char cursym[8];
89
  decimalpart[0] = '1';
100
  decimalpart[0] = '1';
90
  decimalpart[1] = '2';
101
  decimalpart[1] = '2';
91
  decimalpart[2] = '3';
102
  decimalpart[2] = '3';
92
  decimalpart[3] = '4';
103
  decimalpart[3] = '4';
93
  decimalpart[4] = '5';
104
  decimalpart[4] = '5';
94
  decimalpart[5] = '6';
105
  decimalpart[5] = '6';
95
  decimalpart[6] = '7';
106
  decimalpart[6] = '7';
96
  decimalpart[7] = '8';
107
  decimalpart[7] = '8';
97
  decimalpart[8] = '9';
108
  decimalpart[8] = '9';
98
  decimalpart[9] = 0;
109
  decimalpart[9] = 0;
99
  /* prepare the decimal string first */
110
  /* prepare the decimal string first */
100
  if (c->CTYINFO.currprec < 9) {
111
  if (c->CTYINFO.currprec < 9) {
101
    decimalpart[c->CTYINFO.currprec] = 0;
112
    decimalpart[c->CTYINFO.currprec] = 0;
102
  }
113
  }
103
  /* prepare the currency space string */
114
  /* prepare the currency space string */
104
  if (c->CTYINFO.currspace != 0) {
115
  if (c->CTYINFO.currspace != 0) {
105
    space[0] = ' ';
116
    space[0] = ' ';
106
  }
117
  }
107
  /* prepare the currency and decimal symbols */
118
  /* prepare the currency and decimal symbols */
108
  if (c->CTYINFO.currdecsym != 0) { /* currency replaces the decimal point */
119
  if (c->CTYINFO.currdecsym != 0) { /* currency replaces the decimal point */
109
    sprintf(decsym, "%s", c->CTYINFO.currsym);
120
    sprintf(decsym, "%s", c->CTYINFO.currsym);
110
    cursym[0] = 0;
121
    cursym[0] = 0;
111
  } else {
122
  } else {
112
    sprintf(decsym, "%c", c->CTYINFO.decimal[0]);
123
    sprintf(decsym, "%c", c->CTYINFO.decimal[0]);
113
    sprintf(cursym, "%s", c->CTYINFO.currsym);
124
    sprintf(cursym, "%s", c->CTYINFO.currsym);
114
  }
125
  }
115
  if (c->CTYINFO.currprec == 0) decsym[0] = 0;
126
  if (c->CTYINFO.currprec == 0) decsym[0] = 0;
116
  /* compute the final string */
127
  /* compute the final string */
117
  if (c->CTYINFO.currpos == 0) { /* currency precedes value */
128
  if (c->CTYINFO.currpos == 0) { /* currency precedes value */
118
    sprintf(result, "%s%s99%s%s", cursym, space, decsym, decimalpart);
129
    sprintf(result, "%s%s99%s%s", cursym, space, decsym, decimalpart);
119
  } else { /* currency follows value or replaces decimal symbol */
130
  } else { /* currency follows value or replaces decimal symbol */
120
    sprintf(result, "99%s%s%s%s", decsym, decimalpart, space, cursym);
131
    sprintf(result, "99%s%s%s%s", decsym, decimalpart, space, cursym);
121
  }
132
  }
122
  return(result);
133
  return(result);
123
}
134
}
124
 
135
 
125
 
136
 
126
/* checks if str starts with prefix. returns 0 if so, non-zero otherwise. */
137
/* checks if str starts with prefix. returns 0 if so, non-zero otherwise. */
127
static int stringstartswith(char *str, char *prefix) {
138
static int stringstartswith(char *str, char *prefix) {
128
  for (;;) {
139
  for (;;) {
129
    /* end of prefix means success */
140
    /* end of prefix means success */
130
    if (*prefix == 0) return(0);
141
    if (*prefix == 0) return(0);
131
    /* otherwise there is no match */
142
    /* otherwise there is no match */
132
    if (*str != *prefix) return(-1);
143
    if (*str != *prefix) return(-1);
133
    /* if match good so far, look at next char */
144
    /* if match good so far, look at next char */
134
    str += 1;
145
    str += 1;
135
    prefix += 1;
146
    prefix += 1;
136
  }
147
  }
137
}
148
}
138
 
149
 
139
 
150
 
140
/* processes an argument. returns 0 on success, non-zero otherwise. */
151
/* processes an argument. returns 0 on success, non-zero otherwise. */
141
static int processarg(char *arg, struct country *c) {
152
static int processarg(char *arg, struct country *c) {
142
  char *value;
153
  char *value;
143
  int intvalue;
154
  int intvalue;
144
  /* an option must start with a '/' */
155
  /* an option must start with a '/' */
145
  if (arg[0] != '/') return(-1);
156
  if (arg[0] != '/') return(-1);
146
  arg += 1; /* skip the slash */
157
  arg += 1; /* skip the slash */
147
  /* find where the value starts */
158
  /* find where the value starts */
148
  value = strchr(arg, ':');
159
  value = strchr(arg, ':');
149
  /* if no value present, fail */
160
  /* if no value present, fail */
150
  if (value == NULL) return(-2);
161
  if (value == NULL) return(-2);
151
  value += 1;
162
  value += 1;
152
  if (*value == 0) return(-3);
163
  if (*value == 0) return(-3);
153
  /* interpret the option now */
164
  /* interpret the option now */
154
  if (stringstartswith(arg, "country:") == 0) {
165
  if (stringstartswith(arg, "country:") == 0) {
155
    intvalue = atoi(value);
166
    intvalue = atoi(value);
156
    if ((intvalue > 0) && (intvalue < 1000)) {
167
    if ((intvalue > 0) && (intvalue < 1000)) {
157
      c->CTYINFO.id = intvalue;
168
      c->CTYINFO.id = intvalue;
158
      return(0);
169
      return(0);
159
    }
170
    }
160
  } else if (stringstartswith(arg, "cp:") == 0) {
171
  } else if (stringstartswith(arg, "cp:") == 0) {
161
    intvalue = atoi(value);
172
    intvalue = atoi(value);
162
    if ((intvalue > 0) && (intvalue < 1000)) {
173
    if ((intvalue > 0) && (intvalue < 1000)) {
163
      c->CTYINFO.codepage = intvalue;
174
      c->CTYINFO.codepage = intvalue;
164
      return(0);
175
      return(0);
165
    }
176
    }
166
  } else if (stringstartswith(arg, "decim:") == 0) {
177
  } else if (stringstartswith(arg, "decim:") == 0) {
167
    if (value[1] == 0) { /* value must be exactly one character */
178
    if (value[1] == 0) { /* value must be exactly one character */
168
      c->CTYINFO.decimal[0] = *value;
179
      c->CTYINFO.decimal[0] = *value;
169
      return(0);
180
      return(0);
170
    }
181
    }
171
  } else if (stringstartswith(arg, "thous:") == 0) {
182
  } else if (stringstartswith(arg, "thous:") == 0) {
172
    if (value[1] == 0) { /* value must be exactly one character */
183
    if (value[1] == 0) { /* value must be exactly one character */
173
      c->CTYINFO.thousands[0] = *value;
184
      c->CTYINFO.thousands[0] = *value;
174
      return(0);
185
      return(0);
175
    }
186
    }
176
  } else if (stringstartswith(arg, "datesep:") == 0) {
187
  } else if (stringstartswith(arg, "datesep:") == 0) {
177
    if (value[1] == 0) { /* value must be exactly one character */
188
    if (value[1] == 0) { /* value must be exactly one character */
178
      c->CTYINFO.datesep[0] = *value;
189
      c->CTYINFO.datesep[0] = *value;
179
      return(0);
190
      return(0);
180
    }
191
    }
181
  } else if (stringstartswith(arg, "timesep:") == 0) {
192
  } else if (stringstartswith(arg, "timesep:") == 0) {
182
    if (value[1] == 0) { /* value must be exactly one character */
193
    if (value[1] == 0) { /* value must be exactly one character */
183
      c->CTYINFO.timesep[0] = *value;
194
      c->CTYINFO.timesep[0] = *value;
184
      return(0);
195
      return(0);
185
    }
196
    }
186
  } else if (stringstartswith(arg, "datefmt:") == 0) {
197
  } else if (stringstartswith(arg, "datefmt:") == 0) {
187
    if (strcmp(value, "MDY") == 0) {
198
    if (strcmp(value, "MDY") == 0) {
188
      c->CTYINFO.datefmt = COUNTRY_DATE_MDY;
199
      c->CTYINFO.datefmt = COUNTRY_DATE_MDY;
189
      return(0);
200
      return(0);
190
    } else if (strcmp(value, "DMY") == 0) {
201
    } else if (strcmp(value, "DMY") == 0) {
191
      c->CTYINFO.datefmt = COUNTRY_DATE_DMY;
202
      c->CTYINFO.datefmt = COUNTRY_DATE_DMY;
192
      return(0);
203
      return(0);
193
    } else if (strcmp(value, "YMD") == 0) {
204
    } else if (strcmp(value, "YMD") == 0) {
194
      c->CTYINFO.datefmt = COUNTRY_DATE_YMD;
205
      c->CTYINFO.datefmt = COUNTRY_DATE_YMD;
195
      return(0);
206
      return(0);
196
    }
207
    }
197
  } else if (stringstartswith(arg, "timefmt:") == 0) {
208
  } else if (stringstartswith(arg, "timefmt:") == 0) {
198
    if (value[1] == 0) {
209
    if (value[1] == 0) {
199
      if ((value[0] >= '0') && (value[0] <= '1')) {
210
      if ((value[0] >= '0') && (value[0] <= '1')) {
200
        c->CTYINFO.timefmt = value[0] - '0';
211
        c->CTYINFO.timefmt = value[0] - '0';
201
        return(0);
212
        return(0);
202
      }
213
      }
203
    }
214
    }
204
  } else if (stringstartswith(arg, "curr:") == 0) {
215
  } else if (stringstartswith(arg, "curr:") == 0) {
205
    if (strlen(value) <= 4) {
216
    if (strlen(value) <= 4) {
206
      strcpy(c->CTYINFO.currsym, value);
217
      strcpy(c->CTYINFO.currsym, value);
207
      return(0);
218
      return(0);
208
    }
219
    }
209
  } else if (stringstartswith(arg, "currpos:") == 0) {
220
  } else if (stringstartswith(arg, "currpos:") == 0) {
210
    if (value[1] == 0) {
221
    if (value[1] == 0) {
211
      if (value[0] == '0') {
222
      if (value[0] == '0') {
212
        c->CTYINFO.currpos = 0;
223
        c->CTYINFO.currpos = 0;
213
        return(0);
224
        return(0);
214
      } else if (value[0] == '1') {
225
      } else if (value[0] == '1') {
215
        c->CTYINFO.currpos = 1;
226
        c->CTYINFO.currpos = 1;
216
        return(0);
227
        return(0);
217
      } else if (value[0] == '2') {
228
      } else if (value[0] == '2') {
218
        c->CTYINFO.currpos = 0;
229
        c->CTYINFO.currpos = 0;
219
        c->CTYINFO.currdecsym = 1;
230
        c->CTYINFO.currdecsym = 1;
220
        return(0);
231
        return(0);
221
      }
232
      }
222
    }
233
    }
223
  } else if (stringstartswith(arg, "currspc:") == 0) {
234
  } else if (stringstartswith(arg, "currspc:") == 0) {
224
    if (value[1] == 0) {
235
    if (value[1] == 0) {
225
      if ((value[0] >= '0') && (value[0] <= '1')) {
236
      if ((value[0] >= '0') && (value[0] <= '1')) {
226
        c->CTYINFO.currspace = value[0] - '0';
237
        c->CTYINFO.currspace = value[0] - '0';
227
        return(0);
238
        return(0);
228
      }
239
      }
229
    }
240
    }
230
  } else if (stringstartswith(arg, "currprec:") == 0) {
241
  } else if (stringstartswith(arg, "currprec:") == 0) {
231
    if (value[1] == 0) {
242
    if (value[1] == 0) {
232
      if ((value[0] >= '0') && (value[0] <= '9')) {
243
      if ((value[0] >= '0') && (value[0] <= '9')) {
233
        c->CTYINFO.currprec = value[0] - '0';
244
        c->CTYINFO.currprec = value[0] - '0';
234
        return(0);
245
        return(0);
235
      }
246
      }
236
    }
247
    }
237
  } else if (stringstartswith(arg, "yesno:") == 0) {
248
  } else if (stringstartswith(arg, "yesno:") == 0) {
238
    /* string must be exactly 2 characters long */
249
    /* string must be exactly 2 characters long */
239
    if ((value[0] != 0) && (value[1] != 0) && (value[2] == 0)) {
250
    if ((value[0] != 0) && (value[1] != 0) && (value[2] == 0)) {
240
      c->YESNO.yes[0] = value[0];
251
      c->YESNO.yes[0] = value[0];
241
      c->YESNO.no[0] = value[1];
252
      c->YESNO.no[0] = value[1];
242
      return(0);
253
      return(0);
243
    }
254
    }
244
  }
255
  }
245
  /* if I'm here, something went wrong */
256
  /* if I'm here, something went wrong */
246
  return(-4);
257
  return(-4);
247
}
258
}
248
 
259
 
249
 
260
 
250
/* converts a path to its canonic representation, returns 0 on success
261
/* converts a path to its canonic representation, returns 0 on success
251
 * or DOS err on failure (invalid drive) */
262
 * or DOS err on failure (invalid drive) */
252
static unsigned short file_truename(const char *dst, char *src) {
263
static unsigned short file_truename(const char *dst, char *src) {
253
  unsigned short res = 0;
264
  unsigned short res = 0;
254
  _asm {
265
  _asm {
255
    push es
266
    push es
256
    mov ah, 0x60  /* query truename, DS:SI=src, ES:DI=dst */
267
    mov ah, 0x60  /* query truename, DS:SI=src, ES:DI=dst */
257
    push ds
268
    push ds
258
    pop es
269
    pop es
259
    mov si, src
270
    mov si, src
260
    mov di, dst
271
    mov di, dst
261
    int 0x21
272
    int 0x21
262
    jnc DONE
273
    jnc DONE
263
    mov [res], ax
274
    mov [res], ax
264
    DONE:
275
    DONE:
265
    pop es
276
    pop es
266
  }
277
  }
267
  return(res);
278
  return(res);
268
}
279
}
269
 
280
 
270
 
281
 
271
int main(int argc, char **argv) {
282
int main(int argc, char **argv) {
272
  struct country cntdata;
283
  struct country cntdata;
273
  int changedflag;
284
  int changedflag;
274
  int x;
285
  int x;
275
  static char fname[130];
286
  static char fname[130];
276
 
287
 
277
  if ((argc < 2) || (argv[1][0] == '/')) {
288
  if ((argc < 2) || (argv[1][0] == '/')) {
278
    about();
289
    about();
279
    return(1);
290
    return(1);
280
  }
291
  }
281
 
292
 
282
  if (file_truename(fname, argv[1]) != 0) {
293
  if (file_truename(fname, argv[1]) != 0) {
283
    puts("ERROR: bad file path");
294
    puts("ERROR: bad file path");
284
    return(1);
295
    return(1);
285
  }
296
  }
286
 
297
 
287
  x = country_read(&cntdata, fname);
298
  x = country_read(&cntdata, fname);
288
  if (x != 0) {
299
  if (x != 0) {
289
    printf("ERROR: failed to read the preference file [%d]\n", x);
300
    printf("ERROR: failed to read the preference file [%d]\n", x);
290
    return(2);
301
    return(2);
291
  }
302
  }
292
 
303
 
293
  changedflag = argc - 2;
304
  changedflag = argc - 2;
294
 
305
 
295
  /* process command line arguments */
306
  /* process command line arguments */
296
  while (--argc > 1) {
307
  while (--argc > 1) {
297
    if (processarg(argv[argc], &cntdata) != 0) {
308
    if (processarg(argv[argc], &cntdata) != 0) {
298
      about();
309
      about();
299
      return(3);
310
      return(3);
300
    }
311
    }
301
  }
312
  }
302
 
313
 
303
  printf("Country intl code.....: %03d\n", cntdata.CTYINFO.id);
314
  printf("Country intl code.....: %03d\n", cntdata.CTYINFO.id);
304
  printf("Codepage..............: %d\n", cntdata.CTYINFO.codepage);
315
  printf("Codepage..............: %d\n", cntdata.CTYINFO.codepage);
305
  printf("Decimal separator.....: %c\n", cntdata.CTYINFO.decimal[0]);
316
  printf("Decimal separator.....: %c\n", cntdata.CTYINFO.decimal[0]);
306
  printf("Thousands separator...: %c\n", cntdata.CTYINFO.thousands[0]);
317
  printf("Thousands separator...: %c\n", cntdata.CTYINFO.thousands[0]);
307
  printf("Date format...........: %s\n", datestring(&cntdata));
318
  printf("Date format...........: %s\n", datestring(&cntdata));
308
  printf("Time format...........: %s\n", timestring(&cntdata));
319
  printf("Time format...........: %s\n", timestring(&cntdata));
309
  printf("Yes/No letters........: %c/%c\n", cntdata.YESNO.yes[0], cntdata.YESNO.no[0]);
320
  printf("Yes/No letters........: %c/%c\n", cntdata.YESNO.yes[0], cntdata.YESNO.no[0]);
310
  printf("Currency example......: %s\n", currencystring(&cntdata));
321
  printf("Currency example......: %s\n", currencystring(&cntdata));
311
 
322
 
312
  printf("\n"
323
  printf("\n"
313
         "Please make sure your CONFIG.SYS contains a COUNTRY directive that points to\n"
324
         "Please make sure your CONFIG.SYS contains a COUNTRY directive that points to\n"
314
         "your custom preferences file:\n"
325
         "your custom preferences file:\n"
315
         "COUNTRY=%03d,%03d,%s\n\n", cntdata.CTYINFO.id, cntdata.CTYINFO.codepage, fname);
326
         "COUNTRY=%03d,%03d,%s\n\n", cntdata.CTYINFO.id, cntdata.CTYINFO.codepage, fname);
316
 
327
 
317
  /* if anything changed, write the new file */
328
  /* if anything changed, write the new file */
318
  if (changedflag != 0) country_write(fname, &cntdata);
329
  if (changedflag != 0) country_write(fname, &cntdata);
319
 
330
 
320
  return(0);
331
  return(0);
321
}
332
}
322
 
333