uxcfg.c 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * uxcfg.c - the Unix-specific parts of the PuTTY configuration
  3. * box.
  4. */
  5. #include <assert.h>
  6. #include <stdlib.h>
  7. #include "putty.h"
  8. #include "dialog.h"
  9. #include "storage.h"
  10. void unix_setup_config_box(struct controlbox *b, int midsession, int protocol)
  11. {
  12. struct controlset *s;
  13. union control *c;
  14. /*
  15. * The Conf structure contains two Unix-specific elements which
  16. * are not configured in here: stamp_utmp and login_shell. This
  17. * is because pterm does not put up a configuration box right at
  18. * the start, which is the only time when these elements would
  19. * be useful to configure.
  20. */
  21. /*
  22. * On Unix, we don't have a drop-down list for the printer
  23. * control.
  24. */
  25. s = ctrl_getset(b, "Terminal", "printing", "Remote-controlled printing");
  26. assert(s->ncontrols == 1 && s->ctrls[0]->generic.type == CTRL_EDITBOX);
  27. s->ctrls[0]->editbox.has_list = 0;
  28. /*
  29. * Unix supports a local-command proxy. This also means we must
  30. * adjust the text on the `Telnet command' control.
  31. */
  32. if (!midsession) {
  33. int i;
  34. s = ctrl_getset(b, "Connection/Proxy", "basics", NULL);
  35. for (i = 0; i < s->ncontrols; i++) {
  36. c = s->ctrls[i];
  37. if (c->generic.type == CTRL_RADIO &&
  38. c->generic.context.i == CONF_proxy_type) {
  39. assert(c->generic.handler == conf_radiobutton_handler);
  40. c->radio.nbuttons++;
  41. c->radio.buttons =
  42. sresize(c->radio.buttons, c->radio.nbuttons, char *);
  43. c->radio.buttons[c->radio.nbuttons-1] =
  44. dupstr("Local");
  45. c->radio.buttondata =
  46. sresize(c->radio.buttondata, c->radio.nbuttons, intorptr);
  47. c->radio.buttondata[c->radio.nbuttons-1] = I(PROXY_CMD);
  48. break;
  49. }
  50. }
  51. for (i = 0; i < s->ncontrols; i++) {
  52. c = s->ctrls[i];
  53. if (c->generic.type == CTRL_EDITBOX &&
  54. c->generic.context.i == CONF_proxy_telnet_command) {
  55. assert(c->generic.handler == conf_editbox_handler);
  56. sfree(c->generic.label);
  57. c->generic.label = dupstr("Telnet command, or local"
  58. " proxy command");
  59. break;
  60. }
  61. }
  62. }
  63. /*
  64. * Serial back end is available on Unix. However, we have to
  65. * mask out a couple of the configuration options: mark and
  66. * space parity are not conveniently supported, and neither is
  67. * DSR/DTR flow control.
  68. */
  69. if (!midsession || (protocol == PROT_SERIAL))
  70. ser_setup_config_box(b, midsession, 0x07, 0x07);
  71. }