2 PuTTY is copyright 1997-2004 Simon Tatham.
4 Portions copyright Robert de Bath, Joris van Rantwijk, Delian
5 Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas Barry,
6 Justin Bradford, Ben Harris, and CORE SDI S.A.
8 Permission is hereby granted, free of charge, to any person
9 obtaining a copy of this software and associated documentation files
10 (the "Software"), to deal in the Software without restriction,
11 including without limitation the rights to use, copy, modify, merge,
12 publish, distribute, sublicense, and/or sell copies of the Software,
13 and to permit persons to whom the Software is furnished to do so,
14 subject to the following conditions:
16 The above copyright notice and this permission notice shall be
17 included in all copies or substantial portions of the Software.
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE
23 FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
24 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 * Portions Copyright (c) 2004 Greg Parker. All rights reserved.
30 * Redistribution and use in source and binary forms, with or without
31 * modification, are permitted provided that the following conditions
33 * 1. Redistributions of source code must retain the above copyright
34 * notice, this list of conditions and the following disclaimer.
35 * 2. Redistributions in binary form must reproduce the above copyright
36 * notice, this list of conditions and the following disclaimer in the
37 * documentation and/or other materials provided with the distribution.
39 * THIS SOFTWARE IS PROVIDED BY GREG PARKER ``AS IS'' AND ANY EXPRESS OR
40 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
41 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
42 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
43 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
44 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
45 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
46 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
47 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
48 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
57 * Global variables. Most modules declare these `extern', but
58 * window.c will do `#define PUTTY_DO_GLOBALS' before including this
59 * module, and so will get them properly defined.
62 #ifdef PUTTY_DO_GLOBALS
71 typedef struct config_tag Config;
72 typedef struct backend_tag Backend;
73 typedef struct terminal_tag Terminal;
79 /* Three attribute types:
80 * The ATTRs (normal attributes) are stored with the characters in
81 * the main display arrays
83 * The TATTRs (temporary attributes) are generated on the fly, they
84 * can overlap with characters but not with normal attributes.
86 * The LATTRs (line attributes) are an entirely disjoint space of
89 * ATTR_INVALID is an illegal colour combination.
93 unsigned long attr; /* Character and basic attributes */
94 unsigned long color; /* Color information */
97 /* Combines char/charset/attr and color attributes into the struct */
98 #define ATTR_COMBINE(x,y) ((struct attr_tag){ x, y })
99 #define ATTR_WRAP(x) ((struct attr_tag){ x, 0 })
101 /* Stores line count and line attributes in attr_tag */
102 /* Yes, this is a hack */
103 #define LINE_COLS(x) (((x)[0]).color)
104 #define LINE_ATTRS(x) (((x)[0]).attr)
106 #define TATTR_ACTCURS 0x4UL /* active cursor (block) */
107 #define TATTR_PASCURS 0x2UL /* passive cursor (box) */
108 #define TATTR_RIGHTCURS 0x1UL /* cursor-on-RHS */
110 #define LATTR_NORM 0x00000000UL
111 #define LATTR_WIDE 0x01000000UL
112 #define LATTR_TOP 0x02000000UL
113 #define LATTR_BOT 0x03000000UL
114 #define LATTR_MODE 0x03000000UL
115 #define LATTR_WRAPPED 0x10000000UL
116 #define LATTR_WRAPPED2 0x20000000UL
118 /* Like Linux use the F000 page for direct to font. */
119 #define ATTR_OEMCP 0x0000F000UL /* OEM Codepage DTF */
120 #define ATTR_ACP 0x0000F100UL /* Ansi Codepage DTF */
122 /* These are internal use overlapping with the UTF-16 surrogates */
123 #define ATTR_ASCII 0x0000D800UL /* normal ASCII charset ESC ( B */
124 #define ATTR_LINEDRW 0x0000D900UL /* line drawing charset ESC ( 0 */
125 #define ATTR_SCOACS 0x0000DA00UL /* SCO Alternate charset */
126 #define ATTR_GBCHR 0x0000DB00UL /* UK variant charset ESC ( A */
127 #define CSET_MASK 0x0000FF00UL /* Character set mask; MUST be 0xFF00 */
129 #define DIRECT_CHAR(c) ((c&0xFC00)==0xD800)
130 #define DIRECT_FONT(c) ((c&0xFE00)==0xF000)
132 #define UCSERR (ATTR_LINEDRW|'a') /* UCS Format error character. */
134 * UCSWIDE is a special value used in the terminal data to signify
135 * the character cell containing the right-hand half of a CJK wide
136 * character. We use 0xDFFF because it's part of the surrogate
137 * range and hence won't be used for anything else (it's impossible
138 * to input it via UTF-8 because our UTF-8 decoder correctly
139 * rejects surrogates).
141 #define UCSWIDE 0xDFFF
143 #define ATTR_NARROW 0x80000000UL
144 #define ATTR_WIDE 0x40000000UL
145 #define ATTR_BOLD 0x04000000UL
146 #define ATTR_UNDER 0x08000000UL
147 #define ATTR_REVERSE 0x10000000UL
148 #define ATTR_BLINK 0x20000000UL
149 #define ATTR_CLEAR 0x00000000UL
151 #define ATTR_FGMASK 0x000001FFUL
152 #define ATTR_BGMASK 0x0003FE00UL
153 #define ATTR_COLOURS 0x0003FFFFUL
154 #define ATTR_FGSHIFT 0
155 #define ATTR_BGSHIFT 9
157 #define ATTR_DEFFG (256 << ATTR_FGSHIFT)
158 #define ATTR_DEFBG (258 << ATTR_BGSHIFT)
159 #define ATTR_DEFCOLORS (ATTR_DEFFG | ATTR_DEFBG)
161 #define ATTR_INVALID ATTR_COMBINE( ATTR_CLEAR, ATTR_COLOURS )
162 #define ATTR_INVALIDATE(x) ((x).color |= ATTR_COLOURS )
163 #define ATTR_DEFAULT ATTR_COMBINE( ATTR_CLEAR, ATTR_DEFCOLORS )
165 #define ERASE_CHAR ATTR_COMBINE( ATTR_CLEAR | ATTR_ASCII | ' ', ATTR_DEFCOLORS )
166 #define ATTR_MASK 0xFC00FF00UL
167 #define CHAR_MASK 0x000000FFUL
169 #define ATTR_CUR_AND (~(ATTR_BOLD|ATTR_REVERSE|ATTR_BLINK|ATTR_COLOURS))
170 #define ATTR_CUR_XOR 0x016A0000UL
172 #define ATTR_CHAR(x) ATTR_COMBINE((x).attr & CHAR_MASK, 0)
173 #define ATTR_CHARALL(x) ATTR_COMBINE((x).attr & (CHAR_MASK | CSET_MASK), 0)
174 #define ATTR_ATTRS(x) ATTR_COMBINE((x).attr & ATTR_MASK, (x).color)
176 #define ATTR_AND(x,y) ATTR_COMBINE((x).attr & (y).attr, (x).color & (y).color)
177 #define ATTR_OR(x,y) ATTR_COMBINE((x).attr | (y).attr, (x).color | (y).color)
178 #define ATTR_XOR(x,y) ATTR_COMBINE((x).attr ^ (y).attr, (x).color ^ (y).color)
180 #define ATTR_ZERO(x) (!((x).attr | (x).color))
181 #define ATTR_EQUAL(x,y) ATTR_ZERO(ATTR_XOR(x,y))
183 #define ATTR_ON(x,y) (ATTR_COMBINE((x).attr | (y), (x).color))
184 #define ATTR_OFF(x,y) (ATTR_COMBINE((x).attr & ~(y), (x).color))
185 #define ATTR_STATE(x,y) ((x).attr & (y))
190 char *buffer; /* so memory can be freed later */
193 struct unicode_data {
198 wchar_t unitab_scoacs[256];
199 wchar_t unitab_line[256];
200 wchar_t unitab_font[256];
201 wchar_t unitab_xterm[256];
202 wchar_t unitab_oemcp[256];
203 unsigned char unitab_ctrl[256];
206 #define LGXF_OVR 1 /* existing logfile overwrite */
207 #define LGXF_APN 0 /* existing logfile append */
208 #define LGXF_ASK -1 /* existing logfile ask */
209 #define LGTYP_NONE 0 /* logmode: no logging */
210 #define LGTYP_ASCII 1 /* logmode: pure ascii */
211 #define LGTYP_DEBUG 2 /* logmode: all chars of traffic */
212 #define LGTYP_PACKETS 3 /* logmode: SSH data packets */
215 TS_AYT, TS_BRK, TS_SYNCH, TS_EC, TS_EL, TS_GA, TS_NOP, TS_ABORT,
216 TS_AO, TS_IP, TS_SUSP, TS_EOR, TS_EOF, TS_LECHO, TS_RECHO, TS_PING,
220 struct telnet_special {
221 const char *name; /* NULL==end, ""==separator */
227 MBT_LEFT, MBT_MIDDLE, MBT_RIGHT, /* `raw' button designations */
228 MBT_SELECT, MBT_EXTEND, MBT_PASTE, /* `cooked' button designations */
229 MBT_WHEEL_UP, MBT_WHEEL_DOWN /* mouse wheel */
233 MA_NOTHING, MA_CLICK, MA_2CLK, MA_3CLK, MA_DRAG, MA_RELEASE
236 /* Keyboard modifiers -- keys the user is actually holding down */
238 #define PKM_SHIFT 0x01
239 #define PKM_CONTROL 0x02
240 #define PKM_META 0x04
243 /* Keyboard flags that aren't really modifiers */
244 #define PKF_CAPSLOCK 0x10
245 #define PKF_NUMLOCK 0x20
246 #define PKF_REPEAT 0x40
248 /* Stand-alone keysyms for function keys */
251 PK_NULL, /* No symbol for this key */
252 /* Main keypad keys */
253 PK_ESCAPE, PK_TAB, PK_BACKSPACE, PK_RETURN, PK_COMPOSE,
255 PK_HOME, PK_INSERT, PK_DELETE, PK_END, PK_PAGEUP, PK_PAGEDOWN,
257 PK_UP, PK_DOWN, PK_RIGHT, PK_LEFT, PK_REST,
258 /* Numeric keypad */ /* Real one looks like: */
259 PK_PF1, PK_PF2, PK_PF3, PK_PF4, /* PF1 PF2 PF3 PF4 */
260 PK_KPCOMMA, PK_KPMINUS, PK_KPDECIMAL, /* 7 8 9 - */
261 PK_KP0, PK_KP1, PK_KP2, PK_KP3, PK_KP4, /* 4 5 6 , */
262 PK_KP5, PK_KP6, PK_KP7, PK_KP8, PK_KP9, /* 1 2 3 en- */
263 PK_KPBIGPLUS, PK_KPENTER, /* 0 . ter */
265 PK_F1, PK_F2, PK_F3, PK_F4, PK_F5,
266 PK_F6, PK_F7, PK_F8, PK_F9, PK_F10,
267 PK_F11, PK_F12, PK_F13, PK_F14, PK_F15,
268 PK_F16, PK_F17, PK_F18, PK_F19, PK_F20,
272 #define PK_ISEDITING(k) ((k) >= PK_HOME && (k) <= PK_PAGEDOWN)
273 #define PK_ISCURSOR(k) ((k) >= PK_UP && (k) <= PK_REST)
274 #define PK_ISKEYPAD(k) ((k) >= PK_PF1 && (k) <= PK_KPENTER)
275 #define PK_ISFKEY(k) ((k) >= PK_F1 && (k) <= PK_F20)
278 VT_XWINDOWS, VT_OEMANSI, VT_OEMONLY, VT_POORMAN, VT_UNICODE
283 * SSH ciphers (both SSH1 and SSH2)
285 CIPHER_WARN, /* pseudo 'cipher' */
288 CIPHER_AES, /* (SSH 2 only) */
290 CIPHER_MAX /* no. ciphers (inc warn) */
295 * Several different bits of the PuTTY configuration seem to be
296 * three-way settings whose values are `always yes', `always
297 * no', and `decide by some more complex automated means'. This
298 * is true of line discipline options (local echo and line
299 * editing), proxy DNS, Close On Exit, and SSH server bug
300 * workarounds. Accordingly I supply a single enum here to deal
303 FORCE_ON, FORCE_OFF, AUTO
310 PROXY_NONE, PROXY_SOCKS4, PROXY_SOCKS5,
311 PROXY_HTTP, PROXY_TELNET, PROXY_CMD
316 * Line discipline options which the backend might try to control.
318 LD_EDIT, /* local line editing */
319 LD_ECHO /* local echo */
323 /* Protocol back ends. (cfg.protocol) */
324 PROT_RAW, PROT_TELNET, PROT_RLOGIN, PROT_SSH
328 /* Bell settings (cfg.beep) */
329 // GrP allow audible and visible to be set simultaneously
335 /* Taskbar flashing indication on bell (cfg.beep_ind) */
336 B_IND_DISABLED, B_IND_FLASH, B_IND_STEADY
340 /* Resize actions (cfg.resize_action) */
341 RESIZE_TERM, RESIZE_DISABLED, RESIZE_FONT, RESIZE_EITHER
345 /* Function key types (cfg.funky_type) */
355 const char *(*init) (void *frontend_handle, void **backend_handle,
357 char *host, int port, char **realhost, int nodelay);
358 void (*free) (void *handle);
359 /* back->reconfig() passes in a replacement configuration. */
360 void (*reconfig) (void *handle, Config *cfg);
361 /* back->send() returns the current amount of buffered data. */
362 int (*send_buf) (void *handle, char *buf, int len);
363 /* back->sendbuffer() does the same thing but without attempting a send */
364 int (*sendbuffer) (void *handle);
365 void (*size) (void *handle, int width, int height);
366 void (*special) (void *handle, Telnet_Special code);
367 const struct telnet_special *(*get_specials) (void *handle);
368 // Socket(*socket) (void *handle);
369 int (*exitcode) (void *handle);
370 int (*sendok) (void *handle);
371 int (*ldisc) (void *handle, int);
372 void (*provide_ldisc) (void *handle, void *ldisc);
373 void (*provide_logctx) (void *handle, void *logctx);
375 * back->unthrottle() tells the back end that the front end
376 * buffer is clearing.
378 void (*unthrottle) (void *handle, int);
382 extern struct backend_list {
389 * IMPORTANT POLICY POINT: everything in this structure which wants
390 * to be treated like an integer must be an actual, honest-to-
391 * goodness `int'. No enum-typed variables. This is because parts
392 * of the code will want to pass around `int *' pointers to them
393 * and we can't run the risk of porting to some system on which the
394 * enum comes out as a different size from int.
403 int ping_interval; /* in seconds */
406 char proxy_exclude_list[512];
408 int even_proxy_localhost;
410 char proxy_host[512];
412 char proxy_username[32];
413 char proxy_password[32];
414 char proxy_telnet_command[512];
416 char remote_cmd[512];
417 char remote_cmd2[512]; /* fallback if the first fails
418 * (used internally for scp) */
419 char *remote_cmd_ptr; /* might point to a larger command
420 * but never for loading/saving */
421 char *remote_cmd_ptr2; /* might point to a larger command
422 * but never for loading/saving */
426 int change_username; /* allow username switching in SSH2 */
427 int ssh_cipherlist[CIPHER_MAX];
429 int sshprot; /* use v1 or v2 when both available */
430 int ssh2_des_cbc; /* "des-cbc" nonstandard SSH2 cipher */
433 int ssh_subsys; /* run a subsystem rather than a command */
434 int ssh_subsys2; /* fallback to go with remote_cmd2 */
438 char environmt[1024]; /* VAR\tvalue\0VAR\tvalue\0\0 */
440 char localusername[100];
443 /* Keyboard options */
447 int no_applic_c; /* totally disable app cursor keys */
448 int no_applic_k; /* totally disable app keypad */
449 int no_mouse_rep; /* totally disable mouse reporting */
450 int no_remote_resize; /* disable remote resizing */
451 int no_alt_screen; /* disable alternate screen */
452 int no_remote_wintitle; /* disable remote retitling */
453 int no_dbackspace; /* disable destructive backspace */
454 int no_remote_charset; /* disable remote charset config */
455 int no_remote_qtitle; /* disable remote win title query */
461 int alt_f4; /* is it special? */
462 int alt_space; /* is it special? */
463 int alt_only; /* is it special? */
467 int fullscreenonaltenter;
470 int erase_to_scrollback;
473 char wintitle[256]; /* initial window title */
474 /* Terminal options */
479 int cursor_type; /* 0=block 1=underline 2=vertical */
483 int bellovl; /* bell overload protection active? */
484 int bellovl_n; /* number of bells to cause overload */
485 int bellovl_t; /* time interval for overload (seconds) */
486 int bellovl_s; /* period of silence to re-enable bell (s) */
488 int scrollbar_in_fullscreen;
500 char answerback[256];
506 unsigned char colours[22][3];
507 /* Selection options */
516 char line_codepage[128];
517 int xlat_capslockcyr;
518 /* Options for pterm. Should split out into platform-dependent part. */
521 int scrollbar_on_left;
525 FontSpec wideboldfont;
526 int shadowboldoffset;
530 * Exports from window.c.
532 void request_resize(void *frontend, int, int);
533 void do_text(Context, int, int, char *, int, struct attr_tag, unsigned long);
534 void do_cursor(Context, int, int, char *, int, struct attr_tag, unsigned long);
535 int char_width(Context ctx, unsigned int uc);
536 #ifdef OPTIMISE_SCROLL
537 void do_scroll(Context, int, int, int);
539 void set_title(void *frontend, char *);
540 void set_icon(void *frontend, char *);
541 void set_sbar(void *frontend, int, int, int);
542 Context get_ctx(void *frontend);
543 void free_ctx(Context);
544 void palette_set(void *frontend, int, int, int, int);
545 void palette_reset(void *frontend);
546 void write_aclip(void *frontend, char *, int, int);
547 void write_clip(void *frontend, char *, size_t, int);
548 void get_clip(void *frontend, wchar_t **, size_t *);
549 void optimised_move(void *frontend, int, int, int);
550 void set_raw_mouse_mode(void *frontend, int);
551 void connection_fatal(void *frontend, char *, ...);
552 void fatalbox(char *, ...);
553 void modalfatalbox(char *, ...);
555 #pragma noreturn(fatalbox)
556 #pragma noreturn(modalfatalbox)
558 void beep(void *frontend, int);
559 void begin_session(void *frontend);
560 void sys_cursor(void *frontend, int x, int y);
561 void request_paste(void *frontend);
562 void frontend_keypress(void *frontend);
563 void ldisc_update(void *frontend, int echo, int edit);
564 void update_specials_menu(void *frontend);
565 int from_backend(void *frontend, int is_stderr, const char *data, size_t len);
566 #define OPTIMISE_IS_SCROLL 1
568 void set_iconic(void *frontend, int iconic);
569 void move_window(void *frontend, int x, int y);
570 void set_zorder(void *frontend, int top);
571 void refresh_window(void *frontend);
572 void set_zoomed(void *frontend, int zoomed);
573 int is_iconic(void *frontend);
574 void get_window_pos(void *frontend, int *x, int *y);
575 void get_window_pixels(void *frontend, int *x, int *y);
576 char *get_window_title(void *frontend, int icon);
578 void cleanup_exit(int);
582 * Exports from settings.c.
584 char *save_settings(char *section, int do_host, Config * cfg);
585 void save_open_settings(void *sesskey, int do_host, Config *cfg);
586 void load_settings(char *section, int do_host, Config * cfg);
587 void load_open_settings(void *sesskey, int do_host, Config *cfg);
588 void get_sesslist(struct sesslist *, int allocate);
589 void do_defaults(char *, Config *);
590 void registry_cleanup(void);
593 * Functions used by settings.c to provide platform-specific
596 * (The integer one is expected to return `def' if it has no clear
597 * opinion of its own. This is because there's no integer value
598 * which I can reliably set aside to indicate `nil'. The string
599 * function is perfectly all right returning NULL, of course. The
600 * Filename and FontSpec functions are _not allowed_ to fail to
601 * return, since these defaults _must_ be per-platform.)
603 char *platform_default_s(const char *name);
604 int platform_default_i(const char *name, int def);
605 Filename platform_default_filename(const char *name);
606 FontSpec platform_default_fontspec(const char *name);
609 * Exports from terminal.c.
612 Terminal *term_init(Config *, struct unicode_data *, void *);
613 void term_free(Terminal *);
614 void term_size(Terminal *, int, int, int);
615 void term_out(Terminal *);
616 void term_paint(Terminal *, Context, int, int, int, int, int);
617 void term_scroll(Terminal *, int, int);
618 void term_pwron(Terminal *);
619 void term_clrsb(Terminal *);
620 void term_mouse(Terminal *, Mouse_Button, Mouse_Button, Mouse_Action,
621 int,int,int,int,int);
622 void term_key(Terminal *, Key_Sym, wchar_t *, size_t, unsigned int,
624 void term_deselect(Terminal *);
625 void term_update(Terminal *);
626 void term_invalidate(Terminal *);
627 int term_blink(Terminal *, int set_cursor);
628 void term_do_paste(Terminal *);
629 int term_paste_pending(Terminal *);
630 void term_paste(Terminal *);
631 void term_nopaste(Terminal *);
632 int term_ldisc(Terminal *, int option);
633 void term_copyall(Terminal *);
634 void term_reconfig(Terminal *, Config *);
635 void term_seen_key_event(Terminal *);
636 size_t term_data(Terminal *, int is_stderr, const char *data, size_t len);
637 void term_provide_resize_fn(Terminal *term,
638 void (*resize_fn)(void *, int, int),
640 void term_provide_logctx(Terminal *term, void *logctx);
641 void term_copy(Terminal *term);
642 int term_selection_exists(Terminal *term);
643 int term_app_cursor_keys(Terminal *term); // fixme suck
644 void term_task(Terminal *);
647 * Exports from ssh.c. (NB the getline variables have to be GLOBAL
648 * so that PuTTYtel will still compile - otherwise it would depend
652 GLOBAL int (*ssh_get_line) (const char *prompt, char *str, int maxlen,
654 GLOBAL int ssh_getline_pw_only;
655 extern Backend ssh_backend;
658 * Exports from ldisc.c.
660 void *ldisc_create(Config *, Terminal *, Backend *, void *, void *);
661 void ldisc_free(void *);
662 void ldisc_send(void *handle, char *buf, ssize_t len, int interactive);
665 * Exports from ldiscucs.c.
667 void lpage_send(void *, int codepage, char *buf, size_t len, int interactive);
668 void luni_send(void *, wchar_t * widebuf, size_t len, int interactive);
671 * Exports from unicode.c.
674 #define CP_UTF8 65001
676 /* void init_ucs(void); -- this is now in platform-specific headers */
677 int is_dbcs_leadbyte(int codepage, char byte);
678 size_t mb_to_wc(int codepage, int flags, char *mbstr, size_t mblen,
679 wchar_t *wcstr, size_t wclen);
680 size_t wc_to_mb(int codepage, int flags, wchar_t *wcstr, size_t wclen,
681 char *mbstr, size_t mblen, char *defchr, int *defused,
682 struct unicode_data *ucsdata);
683 wchar_t xlat_uskbd2cyrllic(int ch);
684 int check_compose(int first, int second);
685 int decode_codepage(char *cp_name);
686 const char *cp_enumerate (int index);
687 const char *cp_name(int codepage);
688 void get_unitab(int codepage, wchar_t * unitab, int ftype);
691 * Exports from wcwidth.c
693 int wcwidth(wchar_t ucs);
694 int wcswidth(const wchar_t *pwcs, size_t n);
697 * Exports from printing.c.
699 typedef struct printer_enum_tag printer_enum;
700 typedef struct printer_job_tag printer_job;
701 printer_enum *printer_start_enum(int *nprinters);
702 char *printer_get_name(printer_enum *, int);
703 void printer_finish_enum(printer_enum *);
704 printer_job *printer_start_job(char *printer);
705 void printer_job_data(printer_job *, void *, size_t);
706 void printer_finish_job(printer_job *);
709 * Exports from config.c.
712 void setup_config_box(struct controlbox *b, struct sesslist *sesslist,
713 int midsession, int protocol);
716 * Miscellaneous exports from the platform-specific code.
718 char *get_username(void); /* return value needs freeing */
719 char *get_random_data(int bytes); /* used in cmdgen.c */