X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/16efd15b675c87d22a4fd9fb12d7bb26f2a36031..2685767a6125c1620719c7de6234aedf41857b7e:/key.h diff --git a/key.h b/key.h index 980c561..09bcad5 100644 --- a/key.h +++ b/key.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: key.h,v 1.7 2000/12/06 20:33:27 mdw Exp $ + * $Id: key.h,v 1.8 2001/02/03 11:57:38 mdw Exp $ * * Simple key management * @@ -30,6 +30,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: key.h,v $ + * Revision 1.8 2001/02/03 11:57:38 mdw + * Allow creating keyfiles with no file attached. + * * Revision 1.7 2000/12/06 20:33:27 mdw * Make flags be macros rather than enumerations, to ensure that they're * unsigned. @@ -168,10 +171,10 @@ typedef struct key_fetchdef { /* --- File opening options --- */ -enum { - KOPEN_READ, - KOPEN_WRITE -}; +#define KOPEN_READ 0u +#define KOPEN_WRITE 1u +#define KOPEN_MASK 0xff +#define KOPEN_NOFILE 0x100 /* --- Various other magic numbers --- */ @@ -252,7 +255,7 @@ extern int key_extract(key_file */*f*/, key */*k*/, FILE */*fp*/, * * Arguments: @key_file *f@ = pointer to file structure to initialize * @const char *file@ = pointer to the file name - * @int how@ = opening options (@KOPEN_*@). + * @unsigned how@ = opening options (@KOPEN_*@). * @key_reporter *rep@ = error reporting function * @void *arg@ = argument for function * @@ -266,7 +269,7 @@ extern int key_extract(key_file */*f*/, key */*k*/, FILE */*fp*/, * owner only. */ -extern int key_open(key_file */*f*/, const char */*file*/, int /*how*/, +extern int key_open(key_file */*f*/, const char */*file*/, unsigned /*how*/, key_reporter */*rep*/, void */*arg*/); /* --- @key_close@ --- * @@ -303,7 +306,7 @@ extern int key_save(key_file */*f*/); * * Arguments: @key_file *f@ = pointer to file structure to initialize * @const char *file@ = pointer to the file name - * @int how@ = opening options (@KOPEN_*@). + * @unsigned how@ = opening options (@KOPEN_*@). * * Returns: Zero if it worked, nonzero otherwise. * @@ -318,7 +321,8 @@ extern int key_save(key_file */*f*/); * for the private use of @key_open@. */ -extern int key_lockfile(key_file */*f*/, const char */*file*/, int /*how*/); +extern int key_lockfile(key_file */*f*/, const char */*file*/, + unsigned /*how*/); /*----- Creating and manipulating keys ------------------------------------*/