X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=storage.h;h=8e07ef0ca2acbb899cb18f11ae579299438725e4;hb=4b372b0877d11330fe6b9d12ef8b5852b59754e2;hp=46e63505d4e4baa7be201bd62a19ffa1c302ec38;hpb=f6cc852c5d1c215489ccf364e581cf40fe69d9fc;p=PuTTY.git diff --git a/storage.h b/storage.h index 46e63505..8e07ef0c 100644 --- a/storage.h +++ b/storage.h @@ -9,9 +9,9 @@ /* ---------------------------------------------------------------------- * Functions to save and restore PuTTY sessions. Note that this is * only the low-level code to do the reading and writing. The - * higher-level code that translates a Config structure into a set - * of (key,value) pairs is elsewhere, since it doesn't (mostly) - * change between platforms. + * higher-level code that translates an internal Conf structure into + * a set of (key,value) pairs in their external storage format is + * elsewhere, since it doesn't (mostly) change between platforms. */ /* @@ -25,10 +25,14 @@ * A given key will be written at most once while saving a session. * Keys may be up to 255 characters long. String values have no length * limit. + * + * Any returned error message must be freed after use. */ -void *open_settings_w(const char *sessionname); +void *open_settings_w(const char *sessionname, char **errmsg); void write_setting_s(void *handle, const char *key, const char *value); void write_setting_i(void *handle, const char *key, int value); +void write_setting_filename(void *handle, const char *key, Filename *value); +void write_setting_fontspec(void *handle, const char *key, FontSpec *font); void close_settings_w(void *handle); /* @@ -37,8 +41,10 @@ void close_settings_w(void *handle); * number of calls to read_setting_s() and read_setting_i(), and * then close it using close_settings_r(). * - * read_setting_s() writes into the provided buffer and returns a - * pointer to the same buffer. + * read_setting_s() returns a dynamically allocated string which the + * caller must free. read_setting_filename() and + * read_setting_fontspec() likewise return dynamically allocated + * structures. * * If a particular string setting is not present in the session, * read_setting_s() can return NULL, in which case the caller @@ -46,8 +52,10 @@ void close_settings_w(void *handle); * present, read_setting_i() returns its provided default. */ void *open_settings_r(const char *sessionname); -char *read_setting_s(void *handle, const char *key, char *buffer, int buflen); +char *read_setting_s(void *handle, const char *key); int read_setting_i(void *handle, const char *key, int defvalue); +Filename *read_setting_filename(void *handle, const char *key); +FontSpec *read_setting_fontspec(void *handle, const char *key); void close_settings_r(void *handle); /*