5 #define PUTTY_DO_GLOBALS
9 /* For Unix in particular, but harmless if this main() is reused elsewhere */
10 const int buildinfo_gtk_relevant = FALSE;
12 int main(int argc, char **argv)
18 struct unicode_data ucsdata;
21 do_defaults(NULL, conf);
22 init_ucs(&ucsdata, conf_get_str(conf, CONF_line_codepage),
23 conf_get_int(conf, CONF_utf8_override),
24 CS_NONE, conf_get_int(conf, CONF_vtmode));
26 term = term_init(conf, &ucsdata, NULL);
27 term_size(term, 24, 80, 10000);
29 /* Tell american fuzzy lop that this is a good place to fork. */
30 #ifdef __AFL_HAVE_MANUAL_CONTROL
33 while (!feof(stdin)) {
34 len = fread(blk, 1, sizeof(blk), stdin);
35 term_data(term, 0, blk, len);
41 int from_backend(void *frontend, int is_stderr, const char *data, int len)
44 /* functions required by terminal.c */
46 void request_resize(void *frontend, int x, int y) { }
47 void do_text(Context ctx, int x, int y, wchar_t * text, int len,
48 unsigned long attr, int lattr)
52 printf("TEXT[attr=%08lx,lattr=%02x]@(%d,%d):", attr, lattr, x, y);
53 for (i = 0; i < len; i++) {
54 printf(" %x", (unsigned)text[i]);
58 void do_cursor(Context ctx, int x, int y, wchar_t * text, int len,
59 unsigned long attr, int lattr)
63 printf("CURS[attr=%08lx,lattr=%02x]@(%d,%d):", attr, lattr, x, y);
64 for (i = 0; i < len; i++) {
65 printf(" %x", (unsigned)text[i]);
69 int char_width(Context ctx, int uc) { return 1; }
70 void set_title(void *frontend, char *t) { }
71 void set_icon(void *frontend, char *t) { }
72 void set_sbar(void *frontend, int a, int b, int c) { }
74 void ldisc_send(void *handle, const char *buf, int len, int interactive) {}
75 void ldisc_echoedit_update(void *handle) {}
76 Context get_ctx(void *frontend) {
81 void free_ctx(Context ctx) { }
82 void palette_set(void *frontend, int a, int b, int c, int d) { }
83 void palette_reset(void *frontend) { }
84 void write_clip(void *frontend, wchar_t *a, int *b, int c, int d) { }
85 void get_clip(void *frontend, wchar_t **w, int *i) { }
86 void set_raw_mouse_mode(void *frontend, int m) { }
87 void request_paste(void *frontend) { }
88 void do_beep(void *frontend, int a) { }
89 void sys_cursor(void *frontend, int x, int y) { }
90 void fatalbox(const char *fmt, ...) { exit(0); }
91 void modalfatalbox(const char *fmt, ...) { exit(0); }
92 void nonfatal(const char *fmt, ...) { }
94 void set_iconic(void *frontend, int iconic) { }
95 void move_window(void *frontend, int x, int y) { }
96 void set_zorder(void *frontend, int top) { }
97 void refresh_window(void *frontend) { }
98 void set_zoomed(void *frontend, int zoomed) { }
99 int is_iconic(void *frontend) { return 0; }
100 void get_window_pos(void *frontend, int *x, int *y) { *x = 0; *y = 0; }
101 void get_window_pixels(void *frontend, int *x, int *y) { *x = 0; *y = 0; }
102 char *get_window_title(void *frontend, int icon) { return "moo"; }
103 int frontend_is_utf8(void *frontend) { return TRUE; }
105 /* needed by timing.c */
106 void timer_change_notify(unsigned long next) { }
108 /* needed by config.c and sercfg.c */
110 void dlg_radiobutton_set(union control *ctrl, void *dlg, int whichbutton) { }
111 int dlg_radiobutton_get(union control *ctrl, void *dlg) { return 0; }
112 void dlg_checkbox_set(union control *ctrl, void *dlg, int checked) { }
113 int dlg_checkbox_get(union control *ctrl, void *dlg) { return 0; }
114 void dlg_editbox_set(union control *ctrl, void *dlg, char const *text) { }
115 char *dlg_editbox_get(union control *ctrl, void *dlg) { return dupstr("moo"); }
116 void dlg_listbox_clear(union control *ctrl, void *dlg) { }
117 void dlg_listbox_del(union control *ctrl, void *dlg, int index) { }
118 void dlg_listbox_add(union control *ctrl, void *dlg, char const *text) { }
119 void dlg_listbox_addwithid(union control *ctrl, void *dlg,
120 char const *text, int id) { }
121 int dlg_listbox_getid(union control *ctrl, void *dlg, int index) { return 0; }
122 int dlg_listbox_index(union control *ctrl, void *dlg) { return -1; }
123 int dlg_listbox_issel(union control *ctrl, void *dlg, int index) { return 0; }
124 void dlg_listbox_select(union control *ctrl, void *dlg, int index) { }
125 void dlg_text_set(union control *ctrl, void *dlg, char const *text) { }
126 void dlg_filesel_set(union control *ctrl, void *dlg, Filename *fn) { }
127 Filename *dlg_filesel_get(union control *ctrl, void *dlg) { return NULL; }
128 void dlg_fontsel_set(union control *ctrl, void *dlg, FontSpec *fn) { }
129 FontSpec *dlg_fontsel_get(union control *ctrl, void *dlg) { return NULL; }
130 void dlg_update_start(union control *ctrl, void *dlg) { }
131 void dlg_update_done(union control *ctrl, void *dlg) { }
132 void dlg_set_focus(union control *ctrl, void *dlg) { }
133 void dlg_label_change(union control *ctrl, void *dlg, char const *text) { }
134 union control *dlg_last_focused(union control *ctrl, void *dlg) { return NULL; }
135 void dlg_beep(void *dlg) { }
136 void dlg_error_msg(void *dlg, const char *msg) { }
137 void dlg_end(void *dlg, int value) { }
138 void dlg_coloursel_start(union control *ctrl, void *dlg,
139 int r, int g, int b) { }
140 int dlg_coloursel_results(union control *ctrl, void *dlg,
141 int *r, int *g, int *b) { return 0; }
142 void dlg_refresh(union control *ctrl, void *dlg) { }
145 void logevent(void *frontend, const char *msg) { }
146 int askappend(void *frontend, Filename *filename,
147 void (*callback)(void *ctx, int result), void *ctx) { return 0; }
149 const char *const appname = "FuZZterm";
150 const int ngsslibs = 0;
151 const char *const gsslibnames[0] = { };
152 const struct keyvalwhere gsslibkeywords[0] = { };
155 * Default settings that are specific to Unix plink.
157 char *platform_default_s(const char *name)
159 if (!strcmp(name, "TermType"))
160 return dupstr(getenv("TERM"));
161 if (!strcmp(name, "SerialLine"))
162 return dupstr("/dev/ttyS0");
166 int platform_default_i(const char *name, int def)
171 FontSpec *platform_default_fontspec(const char *name)
173 return fontspec_new("");
176 Filename *platform_default_filename(const char *name)
178 if (!strcmp(name, "LogFileName"))
179 return filename_from_str("putty.log");
181 return filename_from_str("");
184 char *x_get_default(const char *key)
186 return NULL; /* this is a stub */