5 #define PUTTY_DO_GLOBALS
9 int main(int argc, char **argv)
15 struct unicode_data ucsdata;
18 do_defaults(NULL, conf);
19 init_ucs(&ucsdata, conf_get_str(conf, CONF_line_codepage),
20 conf_get_int(conf, CONF_utf8_override),
21 CS_NONE, conf_get_int(conf, CONF_vtmode));
23 term = term_init(conf, &ucsdata, NULL);
24 term_size(term, 24, 80, 10000);
26 /* Tell american fuzzy lop that this is a good place to fork. */
27 #ifdef __AFL_HAVE_MANUAL_CONTROL
30 while (!feof(stdin)) {
31 len = fread(blk, 1, sizeof(blk), stdin);
32 term_data(term, 0, blk, len);
38 int from_backend(void *frontend, int is_stderr, const char *data, int len)
41 /* functions required by terminal.c */
43 void request_resize(void *frontend, int x, int y) { }
44 void do_text(Context ctx, int x, int y, wchar_t * text, int len,
45 unsigned long attr, int lattr)
49 printf("TEXT[attr=%08lx,lattr=%02x]@(%d,%d):", attr, lattr, x, y);
50 for (i = 0; i < len; i++) {
51 printf(" %x", (unsigned)text[i]);
55 void do_cursor(Context ctx, int x, int y, wchar_t * text, int len,
56 unsigned long attr, int lattr)
60 printf("CURS[attr=%08lx,lattr=%02x]@(%d,%d):", attr, lattr, x, y);
61 for (i = 0; i < len; i++) {
62 printf(" %x", (unsigned)text[i]);
66 int char_width(Context ctx, int uc) { return 1; }
67 void set_title(void *frontend, char *t) { }
68 void set_icon(void *frontend, char *t) { }
69 void set_sbar(void *frontend, int a, int b, int c) { }
71 void ldisc_send(void *handle, const char *buf, int len, int interactive) {}
72 void ldisc_echoedit_update(void *handle) {}
73 Context get_ctx(void *frontend) {
78 void free_ctx(Context ctx) { }
79 void palette_set(void *frontend, int a, int b, int c, int d) { }
80 void palette_reset(void *frontend) { }
81 void write_clip(void *frontend, wchar_t *a, int *b, int c, int d) { }
82 void get_clip(void *frontend, wchar_t **w, int *i) { }
83 void set_raw_mouse_mode(void *frontend, int m) { }
84 void request_paste(void *frontend) { }
85 void do_beep(void *frontend, int a) { }
86 void sys_cursor(void *frontend, int x, int y) { }
87 void fatalbox(const char *fmt, ...) { exit(0); }
88 void modalfatalbox(const char *fmt, ...) { exit(0); }
89 void nonfatal(const char *fmt, ...) { }
91 void set_iconic(void *frontend, int iconic) { }
92 void move_window(void *frontend, int x, int y) { }
93 void set_zorder(void *frontend, int top) { }
94 void refresh_window(void *frontend) { }
95 void set_zoomed(void *frontend, int zoomed) { }
96 int is_iconic(void *frontend) { return 0; }
97 void get_window_pos(void *frontend, int *x, int *y) { *x = 0; *y = 0; }
98 void get_window_pixels(void *frontend, int *x, int *y) { *x = 0; *y = 0; }
99 char *get_window_title(void *frontend, int icon) { return "moo"; }
100 int frontend_is_utf8(void *frontend) { return TRUE; }
102 /* needed by timing.c */
103 void timer_change_notify(unsigned long next) { }
105 /* needed by config.c and sercfg.c */
107 void dlg_radiobutton_set(union control *ctrl, void *dlg, int whichbutton) { }
108 int dlg_radiobutton_get(union control *ctrl, void *dlg) { return 0; }
109 void dlg_checkbox_set(union control *ctrl, void *dlg, int checked) { }
110 int dlg_checkbox_get(union control *ctrl, void *dlg) { return 0; }
111 void dlg_editbox_set(union control *ctrl, void *dlg, char const *text) { }
112 char *dlg_editbox_get(union control *ctrl, void *dlg) { return dupstr("moo"); }
113 void dlg_listbox_clear(union control *ctrl, void *dlg) { }
114 void dlg_listbox_del(union control *ctrl, void *dlg, int index) { }
115 void dlg_listbox_add(union control *ctrl, void *dlg, char const *text) { }
116 void dlg_listbox_addwithid(union control *ctrl, void *dlg,
117 char const *text, int id) { }
118 int dlg_listbox_getid(union control *ctrl, void *dlg, int index) { return 0; }
119 int dlg_listbox_index(union control *ctrl, void *dlg) { return -1; }
120 int dlg_listbox_issel(union control *ctrl, void *dlg, int index) { return 0; }
121 void dlg_listbox_select(union control *ctrl, void *dlg, int index) { }
122 void dlg_text_set(union control *ctrl, void *dlg, char const *text) { }
123 void dlg_filesel_set(union control *ctrl, void *dlg, Filename *fn) { }
124 Filename *dlg_filesel_get(union control *ctrl, void *dlg) { return NULL; }
125 void dlg_fontsel_set(union control *ctrl, void *dlg, FontSpec *fn) { }
126 FontSpec *dlg_fontsel_get(union control *ctrl, void *dlg) { return NULL; }
127 void dlg_update_start(union control *ctrl, void *dlg) { }
128 void dlg_update_done(union control *ctrl, void *dlg) { }
129 void dlg_set_focus(union control *ctrl, void *dlg) { }
130 void dlg_label_change(union control *ctrl, void *dlg, char const *text) { }
131 union control *dlg_last_focused(union control *ctrl, void *dlg) { return NULL; }
132 void dlg_beep(void *dlg) { }
133 void dlg_error_msg(void *dlg, const char *msg) { }
134 void dlg_end(void *dlg, int value) { }
135 void dlg_coloursel_start(union control *ctrl, void *dlg,
136 int r, int g, int b) { }
137 int dlg_coloursel_results(union control *ctrl, void *dlg,
138 int *r, int *g, int *b) { return 0; }
139 void dlg_refresh(union control *ctrl, void *dlg) { }
142 void logevent(void *frontend, const char *msg) { }
143 int askappend(void *frontend, Filename *filename,
144 void (*callback)(void *ctx, int result), void *ctx) { return 0; }
146 const char *const appname = "FuZZterm";
147 const int ngsslibs = 0;
148 const char *const gsslibnames[0] = { };
149 const struct keyvalwhere gsslibkeywords[0] = { };
152 * Default settings that are specific to Unix plink.
154 char *platform_default_s(const char *name)
156 if (!strcmp(name, "TermType"))
157 return dupstr(getenv("TERM"));
158 if (!strcmp(name, "SerialLine"))
159 return dupstr("/dev/ttyS0");
163 int platform_default_i(const char *name, int def)
168 FontSpec *platform_default_fontspec(const char *name)
170 return fontspec_new("");
173 Filename *platform_default_filename(const char *name)
175 if (!strcmp(name, "LogFileName"))
176 return filename_from_str("putty.log");
178 return filename_from_str("");
181 char *x_get_default(const char *key)
183 return NULL; /* this is a stub */