Sebastian Kuschel reports that pfd_closing can be called for a socket
[u/mdw/putty] / unix / uxcfg.c
index 067fc7e..e48a9b6 100644 (file)
 #include "dialog.h"
 #include "storage.h"
 
-void unix_setup_config_box(struct controlbox *b, int midsession)
+void unix_setup_config_box(struct controlbox *b, int midsession, int protocol)
 {
     struct controlset *s;
     union control *c;
 
     /*
-     * The Config structure contains two Unix-specific elements
-     * which are not configured in here: stamp_utmp and
-     * login_shell. This is because pterm does not put up a
-     * configuration box right at the start, which is the only time
-     * when these elements would be useful to configure.
+     * The Conf structure contains two Unix-specific elements which
+     * are not configured in here: stamp_utmp and login_shell. This
+     * is because pterm does not put up a configuration box right at
+     * the start, which is the only time when these elements would
+     * be useful to configure.
      */
 
     /*
@@ -41,8 +41,8 @@ void unix_setup_config_box(struct controlbox *b, int midsession)
        for (i = 0; i < s->ncontrols; i++) {
            c = s->ctrls[i];
            if (c->generic.type == CTRL_RADIO &&
-               c->generic.context.i == offsetof(Config, proxy_type)) {
-               assert(c->generic.handler == dlg_stdradiobutton_handler);
+               c->generic.context.i == CONF_proxy_type) {
+               assert(c->generic.handler == conf_radiobutton_handler);
                c->radio.nbuttons++;
                c->radio.buttons =
                    sresize(c->radio.buttons, c->radio.nbuttons, char *);
@@ -58,9 +58,8 @@ void unix_setup_config_box(struct controlbox *b, int midsession)
        for (i = 0; i < s->ncontrols; i++) {
            c = s->ctrls[i];
            if (c->generic.type == CTRL_EDITBOX &&
-               c->generic.context.i ==
-               offsetof(Config, proxy_telnet_command)) {
-               assert(c->generic.handler == dlg_stdeditbox_handler);
+               c->generic.context.i == CONF_proxy_telnet_command) {
+               assert(c->generic.handler == conf_editbox_handler);
                sfree(c->generic.label);
                c->generic.label = dupstr("Telnet command, or local"
                                          " proxy command");
@@ -69,4 +68,12 @@ void unix_setup_config_box(struct controlbox *b, int midsession)
        }
     }
 
+    /*
+     * Serial back end is available on Unix. However, we have to
+     * mask out a couple of the configuration options: mark and
+     * space parity are not conveniently supported, and neither is
+     * DSR/DTR flow control.
+     */
+    if (!midsession || (protocol == PROT_SERIAL))
+        ser_setup_config_box(b, midsession, 0x07, 0x07);
 }