2
This file is part of RoboJournal.
3
Copyright (c) 2014 by Will Kraft <pwizard@gmail.com>.
5
RoboJournal is free software: you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
10
RoboJournal is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with RoboJournal. If not, see <http://www.gnu.org/licenses/>.
19
/* ***** BEGIN LICENSE BLOCK *****
20
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
22
* The contents of this file are subject to the Mozilla Public License Version
23
* 1.1 (the "License"); you may not use this file except in compliance with
24
* the License. You may obtain a copy of the License at
25
* http://www.mozilla.org/MPL/
27
* Software distributed under the License is distributed on an "AS IS" basis,
28
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
29
* for the specific language governing rights and limitations under the
32
* The Original Code is Hunspell, based on MySpell.
34
* The Initial Developers of the Original Code are
35
* Kevin Hendricks (MySpell) and Laszlo Nemeth (Hunspell).
36
* Portions created by the Initial Developers are Copyright (C) 2002-2005
37
* the Initial Developers. All Rights Reserved.
63
* Alternatively, the contents of this file may be used under the terms of
64
* either the GNU General Public License Version 2 or later (the "GPL"), or
65
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
66
* in which case the provisions of the GPL or the LGPL are applicable instead
67
* of those above. If you wish to allow use of your version of this file only
68
* under the terms of either the GPL or the LGPL, and not to allow others to
69
* use your version of this file under the terms of the MPL, indicate your
70
* decision by deleting the provisions above and replace them with the notice
71
* and other provisions required by the GPL or the LGPL. If you do not delete
72
* the provisions above, a recipient may use your version of this file under
73
* the terms of any one of the MPL, the GPL or the LGPL.
75
* ***** END LICENSE BLOCK ***** */
77
#include "license.hunspell"
78
#include "license.myspell"
84
#include "filemgr.hxx"
86
int FileMgr::fail(const char * err, const char * par) {
87
fprintf(stderr, err, par);
91
FileMgr::FileMgr(const char * file, const char * key) {
94
fin = fopen(file, "r");
97
char * st = (char *) malloc(strlen(file) + strlen(HZIP_EXTENSION) + 1);
100
strcat(st, HZIP_EXTENSION);
101
hin = new Hunzip(st, key);
105
if (!fin && !hin) fail(MSG_OPEN, file);
110
if (fin) fclose(fin);
114
char * FileMgr::getline() {
117
if (fin) return fgets(in, BUFSIZE - 1, fin);
118
if (hin && (l = hin->getline())) return strcpy(in, l);
123
int FileMgr::getlinenum() {