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"; }
101 /* needed by timing.c */
102 void timer_change_notify(unsigned long next) { }
104 /* needed by config.c and sercfg.c */
106 void dlg_radiobutton_set(union control *ctrl, void *dlg, int whichbutton) { }
107 int dlg_radiobutton_get(union control *ctrl, void *dlg) { return 0; }
108 void dlg_checkbox_set(union control *ctrl, void *dlg, int checked) { }
109 int dlg_checkbox_get(union control *ctrl, void *dlg) { return 0; }
110 void dlg_editbox_set(union control *ctrl, void *dlg, char const *text) { }
111 char *dlg_editbox_get(union control *ctrl, void *dlg) { return dupstr("moo"); }
112 void dlg_listbox_clear(union control *ctrl, void *dlg) { }
113 void dlg_listbox_del(union control *ctrl, void *dlg, int index) { }
114 void dlg_listbox_add(union control *ctrl, void *dlg, char const *text) { }
115 void dlg_listbox_addwithid(union control *ctrl, void *dlg,
116 char const *text, int id) { }
117 int dlg_listbox_getid(union control *ctrl, void *dlg, int index) { return 0; }
118 int dlg_listbox_index(union control *ctrl, void *dlg) { return -1; }
119 int dlg_listbox_issel(union control *ctrl, void *dlg, int index) { return 0; }
120 void dlg_listbox_select(union control *ctrl, void *dlg, int index) { }
121 void dlg_text_set(union control *ctrl, void *dlg, char const *text) { }
122 void dlg_filesel_set(union control *ctrl, void *dlg, Filename *fn) { }
123 Filename *dlg_filesel_get(union control *ctrl, void *dlg) { return NULL; }
124 void dlg_fontsel_set(union control *ctrl, void *dlg, FontSpec *fn) { }
125 FontSpec *dlg_fontsel_get(union control *ctrl, void *dlg) { return NULL; }
126 void dlg_update_start(union control *ctrl, void *dlg) { }
127 void dlg_update_done(union control *ctrl, void *dlg) { }
128 void dlg_set_focus(union control *ctrl, void *dlg) { }
129 void dlg_label_change(union control *ctrl, void *dlg, char const *text) { }
130 union control *dlg_last_focused(union control *ctrl, void *dlg) { return NULL; }
131 void dlg_beep(void *dlg) { }
132 void dlg_error_msg(void *dlg, const char *msg) { }
133 void dlg_end(void *dlg, int value) { }
134 void dlg_coloursel_start(union control *ctrl, void *dlg,
135 int r, int g, int b) { }
136 int dlg_coloursel_results(union control *ctrl, void *dlg,
137 int *r, int *g, int *b) { return 0; }
138 void dlg_refresh(union control *ctrl, void *dlg) { }
141 void logevent(void *frontend, const char *msg) { }
142 int askappend(void *frontend, Filename *filename,
143 void (*callback)(void *ctx, int result), void *ctx) { return 0; }
145 const char *const appname = "FuZZterm";
146 const int ngsslibs = 0;
147 const char *const gsslibnames[0] = { };
148 const struct keyvalwhere gsslibkeywords[0] = { };
151 * Default settings that are specific to Unix plink.
153 char *platform_default_s(const char *name)
155 if (!strcmp(name, "TermType"))
156 return dupstr(getenv("TERM"));
157 if (!strcmp(name, "SerialLine"))
158 return dupstr("/dev/ttyS0");
162 int platform_default_i(const char *name, int def)
167 FontSpec *platform_default_fontspec(const char *name)
169 return fontspec_new("");
172 Filename *platform_default_filename(const char *name)
174 if (!strcmp(name, "LogFileName"))
175 return filename_from_str("putty.log");
177 return filename_from_str("");
180 char *x_get_default(const char *key)
182 return NULL; /* this is a stub */