1 /* coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar)
2 * Understanding is not required. Only obedience.
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
27 void jambase_unpack (void) {
28 if (jambase
== NULL
) {
31 int linecount
= 1, linenum
= 0;
32 if (lzUncompress((void *)jambasepk
, &txt
, &len
) != 0) {
33 fprintf(stderr
, "FATAL: decompression error!\n");
36 //fprintf(stderr, "len=%u\n", len);
37 //fprintf(stderr, "%s\n", txt);
38 for (size_t f
= 0; f
< len
; ++f
) if (txt
[f
] == '\n') ++linecount
;
39 //fprintf(stderr, "lc=%d\n", linecount);
40 jambase
= (char **)calloc(linecount
, sizeof(char *));
43 char *e
= txt
+len
, ec
;
45 for (size_t f
= pos
; f
< len
; ++f
) {
46 if (txt
[f
] == '\n') { e
= txt
+f
+1; epos
= f
+1; break; }
50 //fprintf(stderr, "%d: %s", linenum, txt+pos);
51 jambase
[linenum
++] = strdup(txt
+pos
);
56 //fprintf(stderr, "lc=%d; ln=%d\n", linecount, linenum);
57 //fprintf(stderr, "::%s", jambase[0]);