aboutsummaryrefslogtreecommitdiffstats
path: root/src/cnki_caj.c
diff options
context:
space:
mode:
authoryzrh <yzrh@tuta.io>2020-08-14 22:04:26 +0000
committeryzrh <yzrh@tuta.io>2020-08-14 22:04:26 +0000
commit12ecdd71592eccf7bdb6214edbc7318246469c1c (patch)
treefda27e41c37a2345702ad3e90480154d975e426f /src/cnki_caj.c
downloadmelon-12ecdd71592eccf7bdb6214edbc7318246469c1c.tar.gz
melon-12ecdd71592eccf7bdb6214edbc7318246469c1c.tar.zst
Initial commit.
Diffstat (limited to 'src/cnki_caj.c')
-rw-r--r--src/cnki_caj.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/cnki_caj.c b/src/cnki_caj.c
new file mode 100644
index 0000000..c541064
--- /dev/null
+++ b/src/cnki_caj.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, yzrh <yzrh@tuta.io>
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#include <stdlib.h>
+
+#include "cnki.h"
+
+int
+cnki_caj(cnki_t **param)
+{
+ if (*param == NULL)
+ return 1;
+
+ if ((*param)->stat > 0)
+ printf("Begin 'CAJ' conversion\n");
+
+ if ((*param)->stat > 1)
+ printf("Reading document body address at %x\n", ADDRESS_CAJ_BODY);
+
+ int addr;
+
+ fseek((*param)->fp_i, ADDRESS_CAJ_BODY, SEEK_SET);
+ fread(&addr, 4, 1, (*param)->fp_i);
+ fseek((*param)->fp_i, addr, SEEK_SET);
+ fread(&addr, 4, 1, (*param)->fp_i);
+ fseek((*param)->fp_i, addr, SEEK_SET);
+
+ if ((*param)->stat > 0)
+ printf("Advised document body address is %x\n", addr);
+
+ cnki_pdf(param);
+
+ if ((*param)->stat > 0)
+ printf("Conversion ended\n");
+
+ return 0;
+}