summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/main.c b/main.c
index 60aa90f..1679cb4 100644
--- a/main.c
+++ b/main.c
@@ -10,11 +10,11 @@
*
* WordExtract is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with WordExtract. If not, see <http://www.gnu.org/licenses/>.
+ * along with WordExtract. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
@@ -24,14 +24,17 @@
#include "mainwin.h"
#include "dict.h"
+Language lang;
+SaveOpt save_user_words = {2, 40};
char optpath[PATH_LENGTH] = {0};
char dictfile[PATH_LENGTH] = {0};
-Language lang;
static void fill_vars();
int main(int argc, char *argv[])
{
+ FILE *fdict;
+
gtk_init(&argc, &argv);
fill_vars();
dict = load_dict();
@@ -39,7 +42,25 @@ int main(int argc, char *argv[])
create_main_window();
gtk_widget_show(main_window);
gtk_main();
- free_words(dict); /*Where to put?*/
+
+ /*termination*/
+ if (!(fdict = fopen(dictfile, "w")))
+ perror(dictfile);
+ else {
+ save_dict(fdict, dict);
+ fclose(fdict);
+ }
+ if (dict_words.by_az)
+ free(dict_words.by_az);
+ if (user_words.by_az)
+ free(user_words.by_az);
+ if (dict) {
+ if (dict->lsibl)
+ free_words(dict->lsibl);
+ if (dict->rsibl)
+ free_words(dict->rsibl);
+ free(dict->word);
+ }
return 0;
}