*
* Copyright 2002 Project Purple
*
- * $Id: add.c,v 1.10 2003/06/04 20:57:06 noodles Exp $
+ * $Id: add.c,v 1.11 2003/10/15 21:15:20 noodles Exp $
*/
#include <errno.h>
if (ctx.buffer == NULL) {
puts("Error: No keytext to add supplied.");
} else {
- readconfig();
+ readconfig(NULL);
initlogthing("add", config.logfile);
dearmor_openpgp_stream(buffer_fetchchar,
&ctx,
*
* Copyright 2001-2002 Project Purple.
*
- * $Id: gpgwww.c,v 1.11 2003/06/08 19:04:31 noodles Exp $
+ * $Id: gpgwww.c,v 1.12 2003/10/15 21:15:20 noodles Exp $
*/
#include <inttypes.h>
to,
from);
- readconfig();
+ readconfig(NULL);
initlogthing("gpgwww", config.logfile);
initdb();
inithash();
*
* Copyright 2002 Project Purple
*
- * $Id: lookup.c,v 1.11 2003/10/04 10:21:41 noodles Exp $
+ * $Id: lookup.c,v 1.12 2003/10/15 21:15:21 noodles Exp $
*/
#include <inttypes.h>
} else if (search == NULL) {
puts("Error: No key to search for supplied.");
} else {
- readconfig();
+ readconfig(NULL);
initlogthing("lookup", config.logfile);
initdb();
switch (op) {
*
* Copyright 2001-2002 Project Purple.
*
- * $Id: maxpath.c,v 1.9 2003/06/04 20:57:10 noodles Exp $
+ * $Id: maxpath.c,v 1.10 2003/10/15 21:15:21 noodles Exp $
*/
#include <stdio.h>
int main(int argc, char *argv[])
{
- readconfig();
+ readconfig(NULL);
initdb();
inithash();
findmaxpath(30);
*
* Copyright 2002 Project Purple
*
- * $Id: onak-conf.c,v 1.7 2003/06/04 20:57:11 noodles Exp $
+ * $Id: onak-conf.c,v 1.8 2003/10/15 21:15:21 noodles Exp $
*/
#include <ctype.h>
NULL, /* pg_dbpass */
};
-void readconfig(void) {
+void readconfig(const char *configfile) {
FILE *conffile;
char curline[1024];
int i;
curline[1023] = 0;
- conffile = fopen(CONFIGFILE, "r");
+ if (configfile == NULL) {
+ conffile = fopen(CONFIGFILE, "r");
+ } else {
+ conffile = fopen(configfile, "r");
+ }
if (conffile != NULL) {
fgets(curline, 1023, conffile);
*
* Copyright 2002 Project Purple
*
- * $Id: onak-conf.h,v 1.11 2003/10/11 22:28:23 noodles Exp $
+ * $Id: onak-conf.h,v 1.12 2003/10/15 21:15:21 noodles Exp $
*/
#ifndef __ONAK_CONF_H_
/*
* readconfig - read the onak config.
+ * @configfile - the config file to read.
+ *
+ * Read in our config file. If config file is NULL read in the compile
+ * time default.
*/
-void readconfig(void);
+void readconfig(const char *configfile);
/*
* cleanupconfig - clean up the config when we're shutting down.
*
* Copyright 2002 Project Purple
*
- * $Id: onak.c,v 1.17 2003/09/30 20:40:11 noodles Exp $
+ * $Id: onak.c,v 1.18 2003/10/15 21:15:21 noodles Exp $
*/
#include <stdio.h>
struct openpgp_packet_list *packets = NULL;
struct openpgp_packet_list *list_end = NULL;
struct openpgp_publickey *keys = NULL;
+ char *configfile = NULL;
int rc = EXIT_SUCCESS;
int result = 0;
char *search = NULL;
bool fingerprint = false;
int optchar;
- while ((optchar = getopt(argc, argv, "bfuv")) != -1 ) {
+ while ((optchar = getopt(argc, argv, "bc:fuv")) != -1 ) {
switch (optchar) {
case 'b':
binary = true;
break;
+ case 'c':
+ configfile = strdup(optarg);
+ break;
case 'f':
fingerprint = true;
break;
}
}
- readconfig();
+ readconfig(configfile);
initlogthing("onak", config.logfile);
if ((argc - optind) < 1) {
*
* Copyright 2001-2002 Project Purple.
*
- * $Id: sixdegrees.c,v 1.4 2003/06/04 20:57:12 noodles Exp $
+ * $Id: sixdegrees.c,v 1.5 2003/10/15 21:15:21 noodles Exp $
*/
#include <stdio.h>
keyid = strtoll(argv[1], NULL, 16);
}
- readconfig();
+ readconfig(NULL);
initdb();
inithash();
sixdegrees(getfullkeyid(keyid));
*
* Copyright 2003 Project Purple
*
- * $Id: splitkeys.c,v 1.3 2003/10/03 23:34:06 noodles Exp $
+ * $Id: splitkeys.c,v 1.4 2003/10/15 21:15:21 noodles Exp $
*/
#include <fcntl.h>
}
}
- readconfig();
+ readconfig(NULL);
initlogthing("splitkeys", config.logfile);
do {