Mercurial > hg > nnchat
comparison main.c @ 432:966c521e0954
Rename user home directory variable.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 24 May 2012 21:33:29 +0300 |
parents | a9b20b31cae1 |
children | 708a15fdf791 |
comparison
equal
deleted
inserted
replaced
431:a9b20b31cae1 | 432:966c521e0954 |
---|---|
1612 nn_editbuf_t *editBuf = nn_editbuf_new(NN_TMPBUF_SIZE); | 1612 nn_editbuf_t *editBuf = nn_editbuf_new(NN_TMPBUF_SIZE); |
1613 nn_editbuf_t *histBuf[SET_MAX_HISTORY+2]; | 1613 nn_editbuf_t *histBuf[SET_MAX_HISTORY+2]; |
1614 int histPos = 0, histMax = 0; | 1614 int histPos = 0, histMax = 0; |
1615 | 1615 |
1616 cfgitem_t *tmpcfg; | 1616 cfgitem_t *tmpcfg; |
1617 char *homeDir = NULL; | 1617 char *setHomeDir = NULL; |
1618 | 1618 |
1619 memset(histBuf, 0, sizeof(histBuf)); | 1619 memset(histBuf, 0, sizeof(histBuf)); |
1620 | 1620 |
1621 // Initialize | 1621 // Initialize |
1622 th_init("NNChat", "Newbie Nudes chat client", NN_VERSION, | 1622 th_init("NNChat", "Newbie Nudes chat client", NN_VERSION, |
1672 | 1672 |
1673 #ifdef __WIN32 | 1673 #ifdef __WIN32 |
1674 { | 1674 { |
1675 char tmpPath[MAX_PATH]; | 1675 char tmpPath[MAX_PATH]; |
1676 if (SHGetFolderPath(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, tmpPath) == S_OK) | 1676 if (SHGetFolderPath(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, tmpPath) == S_OK) |
1677 homeDir = th_strdup(tmpPath); | 1677 setHomeDir = th_strdup(tmpPath); |
1678 | 1678 |
1679 CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); | 1679 CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); |
1680 } | 1680 } |
1681 #else | 1681 #else |
1682 homeDir = th_strdup(getenv("HOME")); | 1682 setHomeDir = th_strdup(getenv("HOME")); |
1683 #endif | 1683 #endif |
1684 | 1684 |
1685 if (homeDir != NULL) | 1685 if (setHomeDir != NULL) |
1686 { | 1686 { |
1687 FILE *cfgfile; | 1687 FILE *cfgfile; |
1688 setConfigFile = th_strdup_printf("%s" SET_DIR_SEPARATOR "%s", homeDir, SET_CONFIG_FILE); | 1688 setConfigFile = th_strdup_printf("%s" SET_DIR_SEPARATOR "%s", setHomeDir, SET_CONFIG_FILE); |
1689 | 1689 |
1690 THMSG(0, "Reading configuration from '%s'.\n", setConfigFile); | 1690 THMSG(0, "Reading configuration from '%s'.\n", setConfigFile); |
1691 | 1691 |
1692 if ((cfgfile = fopen(setConfigFile, "r")) != NULL) | 1692 if ((cfgfile = fopen(setConfigFile, "r")) != NULL) |
1693 { | 1693 { |
2294 } | 2294 } |
2295 | 2295 |
2296 // Shutdown | 2296 // Shutdown |
2297 err_exit: | 2297 err_exit: |
2298 th_cfg_free(cfg); | 2298 th_cfg_free(cfg); |
2299 th_free(homeDir); | 2299 th_free(setHomeDir); |
2300 th_llist_free_func(setIdleMessages, th_free); | 2300 th_llist_free_func(setIdleMessages, th_free); |
2301 nn_userhash_free(nnUsers); | 2301 nn_userhash_free(nnUsers); |
2302 nn_editbuf_free(editBuf); | 2302 nn_editbuf_free(editBuf); |
2303 | 2303 |
2304 { | 2304 { |