summaryrefslogtreecommitdiff
path: root/vchat-client.c
diff options
context:
space:
mode:
authorerdgeist <>2003-11-15 19:03:54 +0000
committererdgeist <>2003-11-15 19:03:54 +0000
commit3c75b863a628adc020062e773d7edf5bac0649fb (patch)
treeda4ea52fbb2b6cbedb6cbc3d6988bcb3c1187e15 /vchat-client.c
parentb64a6c9bc6241e77e214fa5e43975fb0fa20b336 (diff)
UTF-8 autodetection, some gcc warnings
Diffstat (limited to 'vchat-client.c')
-rwxr-xr-xvchat-client.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/vchat-client.c b/vchat-client.c
index 2fc1ea9..a3e7fd2 100755
--- a/vchat-client.c
+++ b/vchat-client.c
@@ -26,6 +26,10 @@
26#include <signal.h> 26#include <signal.h>
27#include <readline/readline.h> 27#include <readline/readline.h>
28#include <openssl/ssl.h> 28#include <openssl/ssl.h>
29#ifndef NO_LOCALE
30#include <locale.h>
31#include <langinfo.h>
32#endif
29#include "vchat.h" 33#include "vchat.h"
30 34
31/* version of this module */ 35/* version of this module */
@@ -278,8 +282,8 @@ setstroption (confopt option, unsigned char *string)
278 configoptions[i].value = strdup(string); 282 configoptions[i].value = strdup(string);
279 else 283 else
280 configoptions[i].value = NULL; 284 configoptions[i].value = NULL;
281 if (configoptions[i].localvar) 285 if (configoptions[i].localvar.pstr)
282 *configoptions[i].localvar = configoptions[i].value; 286 *configoptions[i].localvar.pstr = configoptions[i].value;
283 } 287 }
284} 288}
285 289
@@ -294,17 +298,19 @@ setnoption (unsigned char *name, unsigned char *string)
294 for (i = 0; configoptions[i].type != CO_NIL; i++) 298 for (i = 0; configoptions[i].type != CO_NIL; i++)
295 if (!strcmp(configoptions[i].varname,name)) { 299 if (!strcmp(configoptions[i].varname,name)) {
296 if (configoptions[i].type == CO_STR) { 300 if (configoptions[i].type == CO_STR) {
297 if (configoptions[i].value) 301 if (configoptions[i].value)
298 free(configoptions[i].value); 302 free(configoptions[i].value);
299 if (string) 303 if (string)
300 configoptions[i].value = strdup(string); 304 configoptions[i].value = strdup(string);
301 else 305 else
302 configoptions[i].value = NULL; 306 configoptions[i].value = NULL;
303 } else if (configoptions[i].type == CO_INT) { 307 if (configoptions[i].localvar.pstr)
304 configoptions[i].value = (char *) atoi(string); 308 *configoptions[i].localvar.pstr = configoptions[i].value;
305 } 309 } else if (configoptions[i].type == CO_INT) {
306 if (configoptions[i].localvar) 310 configoptions[i].value = (char *) atoi(string);
307 *configoptions[i].localvar = configoptions[i].value; 311 if (configoptions[i].localvar.pint)
312 *configoptions[i].localvar.pint = (int)configoptions[i].value;
313 }
308 } 314 }
309} 315}
310 316
@@ -337,8 +343,8 @@ setintoption (confopt option, int value)
337 for (i = 0; configoptions[i].type != CO_NIL; i++) 343 for (i = 0; configoptions[i].type != CO_NIL; i++)
338 if ((configoptions[i].id == option) && (configoptions[i].type == CO_INT)) { 344 if ((configoptions[i].id == option) && (configoptions[i].type == CO_INT)) {
339 configoptions[i].value = (char *) value; 345 configoptions[i].value = (char *) value;
340 if (configoptions[i].localvar) 346 if (configoptions[i].localvar.pint)
341 *configoptions[i].localvar = configoptions[i].value; 347 *configoptions[i].localvar.pint = (int)configoptions[i].value;
342 } 348 }
343} 349}
344 350
@@ -472,6 +478,10 @@ main (int argc, char **argv)
472 int pchar; 478 int pchar;
473 int cmdsunparsed = 1; 479 int cmdsunparsed = 1;
474 480
481#ifndef NO_LOCALE
482 setlocale(LC_ALL,"");
483#endif
484
475 loadconfig (GLOBAL_CONFIG_FILE); 485 loadconfig (GLOBAL_CONFIG_FILE);
476 loadconfig (getstroption (CF_CONFIGFILE)); 486 loadconfig (getstroption (CF_CONFIGFILE));
477 487