projects
/
onak.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Define OpenPGP constants and use them rather than magic numbers
[onak.git]
/
splitkeys.c
diff --git
a/splitkeys.c
b/splitkeys.c
index a2daac673bbe1a6c2f13dc751deed7dc68921b35..86a83632a3baf786fac8b9cf2373cae03de041c0 100644
(file)
--- a/
splitkeys.c
+++ b/
splitkeys.c
@@
-4,8
+4,6
@@
* Jonathan McDowell <noodles@earth.li>
*
* Copyright 2003 Project Purple
* Jonathan McDowell <noodles@earth.li>
*
* Copyright 2003 Project Purple
- *
- * $Id: splitkeys.c,v 1.1 2003/09/30 21:16:14 noodles Exp $
*/
#include <fcntl.h>
*/
#include <fcntl.h>
@@
-16,7
+14,10
@@
#include "charfuncs.h"
#include "keystructs.h"
#include "charfuncs.h"
#include "keystructs.h"
+#include "log.h"
#include "mem.h"
#include "mem.h"
+#include "onak-conf.h"
+#include "openpgp.h"
#include "parsekey.h"
int main(int argc, char *argv[])
#include "parsekey.h"
int main(int argc, char *argv[])
@@
-36,10
+37,13
@@
int main(int argc, char *argv[])
fprintf(stderr,
"Couldn't parse %s as a number of keys!\n",
argv[1]);
fprintf(stderr,
"Couldn't parse %s as a number of keys!\n",
argv[1]);
- exit(
1
);
+ exit(
EXIT_FAILURE
);
}
}
}
}
+ readconfig(NULL);
+ initlogthing("splitkeys", config.logfile);
+
do {
result = read_openpgp_stream(stdin_getchar, NULL,
&packets, maxkeys);
do {
result = read_openpgp_stream(stdin_getchar, NULL,
&packets, maxkeys);
@@
-49,10
+53,14
@@
int main(int argc, char *argv[])
tmp = list_end;
list_end = list_end->next;
if (list_end->next == NULL &&
tmp = list_end;
list_end = list_end->next;
if (list_end->next == NULL &&
- list_end->packet->tag == 6) {
+ list_end->packet->tag ==
+ OPENPGP_PACKET_PUBLICKEY) {
tmp->next = NULL;
}
}
tmp->next = NULL;
}
}
+ if (tmp->next != NULL) {
+ list_end = NULL;
+ }
snprintf(splitfile, 1023, "splitfile-%d.pgp", count);
outfd = open(splitfile, O_WRONLY | O_CREAT, 0664);
snprintf(splitfile, 1023, "splitfile-%d.pgp", count);
outfd = open(splitfile, O_WRONLY | O_CREAT, 0664);
@@
-65,5
+73,8
@@
int main(int argc, char *argv[])
}
} while (packets != NULL);
}
} while (packets != NULL);
+ cleanuplogthing();
+ cleanupconfig();
+
return 0;
}
return 0;
}