cscvs to tla changeset 99
[onak.git] / main.c
1 #include <stdio.h>
2 #include <sys/types.h>
3 #include <sys/uio.h>
4 #include <unistd.h>
5
6 #include "armor.h"
7 #include "keydb.h"
8 #include "keyid.h"
9 #include "keyindex.h"
10 #include "keystructs.h"
11 #include "parsekey.h"
12
13 int getnextchar(void *ctx, size_t count, unsigned char *c)
14 {
15         return (!read(0, c, count));
16 }
17
18 int putnextchar(void *ctx, size_t count, unsigned char *c)
19 {
20         return (!write(1, c, count));
21 }
22
23
24 int main(int argc, char *argv[])
25 {
26         struct openpgp_packet_list *packets = NULL; 
27 /*
28         , *newpackets = NULL;
29         struct openpgp_packet_list *list_end = NULL;
30         struct openpgp_publickey *keys = NULL;
31         struct openpgp_publickey *newkeys = NULL;
32         void *ctx = NULL;
33
34         fputs("Doing read_openpgp_stream():\n", stderr);
35         read_openpgp_stream(getnextchar, ctx, &packets, 0);
36 */
37         fputs("Doing dearmor_openpgp_stream():\n", stderr);
38         dearmor_openpgp_stream(getnextchar, NULL, &packets);
39         fputs("Doing armor_openpgp_stream():\n", stderr);
40         armor_openpgp_stream(putnextchar, NULL, packets);
41
42 /*
43         fputs("Doing parse_keys():\n", stderr);
44         parse_keys(packets, &keys);
45
46         printf("Key id is 0x%llX\n", get_keyid(keys));
47
48         key_index(keys, true, false, false);
49
50         initdb();
51         fetch_key(get_keyid(keys), &newkeys);
52         cleanupdb();
53
54         printf("New key id is 0x%llX\n", get_keyid(newkeys));
55
56         fputs("Doing flatten_publickey():\n", stderr);
57         flatten_publickey(keys, &newpackets, &list_end);
58
59         fputs("Doing write_openpgp_stream():\n", stderr);
60         write_openpgp_stream(putnextchar, ctx, newpackets);
61 */
62         return 0;
63 }