Add a man page.
[u/mdw/putty] / unix / uxstore.c
CommitLineData
1709795f 1/*
2 * uxstore.c: Unix-specific implementation of the interface defined
3 * in storage.h.
4 */
5
6#include <stdio.h>
7#include <stdlib.h>
faec60ed 8#include <gtk/gtk.h>
9#include <gdk/gdkx.h>
10#include <X11/Xlib.h>
1709795f 11#include "putty.h"
12#include "storage.h"
13
faec60ed 14/*
15 * For the moment, the only existing Unix utility is pterm and that
16 * has no GUI configuration at all, so our write routines need do
17 * nothing. Eventually I suppose these will read and write an rc
18 * file somewhere or other.
19 */
1709795f 20
21void *open_settings_w(char *sessionname)
22{
23 return NULL;
24}
25
26void write_setting_s(void *handle, char *key, char *value)
27{
28}
29
30void write_setting_i(void *handle, char *key, int value)
31{
32}
33
34void close_settings_w(void *handle)
35{
36}
37
faec60ed 38/*
39 * Reading settings, for the moment, is done by retrieving X
40 * resources from the X display. When we introduce disk files, I
41 * think what will happen is that the X resources will override
42 * PuTTY's inbuilt defaults, but that the disk files will then
43 * override those. This isn't optimal, but it's the best I can
44 * immediately work out.
45 */
46
47static Display *display;
48
1709795f 49void *open_settings_r(char *sessionname)
50{
faec60ed 51 static int thing_to_return_an_arbitrary_non_null_pointer_to;
52 display = GDK_DISPLAY();
53 if (!display)
54 return NULL;
55 else
56 return &thing_to_return_an_arbitrary_non_null_pointer_to;
1709795f 57}
58
59char *read_setting_s(void *handle, char *key, char *buffer, int buflen)
60{
faec60ed 61 char *val = XGetDefault(display, app_name, key);
62 if (!val)
63 return NULL;
64 else {
65 strncpy(buffer, val, buflen);
66 buffer[buflen-1] = '\0';
67 return buffer;
68 }
1709795f 69}
70
71int read_setting_i(void *handle, char *key, int defvalue)
72{
faec60ed 73 char *val = XGetDefault(display, app_name, key);
74 if (!val)
75 return defvalue;
76 else
77 return atoi(val);
1709795f 78}
79
80void close_settings_r(void *handle)
81{
82}
83
84void del_settings(char *sessionname)
85{
86}
87
88void *enum_settings_start(void)
89{
90 return NULL;
91}
92
93char *enum_settings_next(void *handle, char *buffer, int buflen)
94{
95 return NULL;
96}
97
98void enum_settings_finish(void *handle)
99{
100}
101
102int verify_host_key(char *hostname, int port, char *keytype, char *key)
103{
104 return 1; /* key does not exist in registry */
105}
106
107void store_host_key(char *hostname, int port, char *keytype, char *key)
108{
109}
110
111void read_random_seed(noise_consumer_t consumer)
112{
113}
114
115void write_random_seed(void *data, int len)
116{
117}
118
119void cleanup_all(void)
120{
121}