--- pgp/src/config.c 2018/04/24 16:38:44 1.1.1.2 +++ pgp/src/config.c 2018/04/24 16:41:09 1.1.1.5 @@ -1,522 +1,587 @@ -/* config.c - config file parser by Peter Gutmann - Parses config file for PGP - - Modified 24 Jun 92 - HAJK - Misc fixes for VAX C restrictions. - -*/ - -#include -#include -#include -#include -#include "usuals.h" -#include "fileio.h" -#include "pgp.h" -/* The external config variables we can set here are referenced in pgp.h */ - -/* Return values */ - -#define ERROR -1 -#define OK 0 - -/* The types of error we check for */ - -enum { NO_ERROR, ILLEGAL_CHAR_ERROR, LINELENGTH_ERROR }; - -#define CPM_EOF 0x1A /* ^Z = CPM EOF char */ - -#define MAX_ERRORS 3 /* Max.no.errors before we give up */ - -#define LINEBUF_SIZE 100 /* Size of input buffer */ - -int line; /* The line on which an error occurred */ -int errCount; /* Total error count */ -boolean hasError; /* Whether this line has an error in it */ - -/* The settings parsed out by getAssignment() */ - -char str[ LINEBUF_SIZE ]; -int value; -boolean flag; -char *errtag; /* prefix for printing error messages */ -char optstr[100]; /* option being processed */ - -/* A .CFG file roughly follows the format used in the world-famous HPACK - archiver and is as follows: - - - Leading spaces/tabs (whitespace) are ignored. - - - Lines with a '#' as the first non-whitespace character are treated as - comment lines. - - - All other lines are treated as config options for the program. - - - Lines may be terminated by either linefeeds, carriage returns, or - carriage return/linefeed pairs (the latter being the DOS default method - of storing text files). - - - Config options have the form: - -