pterm.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #include "putty.h"
  2. #include "storage.h"
  3. const unsigned cmdline_tooltype =
  4. TOOLTYPE_NONNETWORK |
  5. TOOLTYPE_NO_VERBOSE_OPTION;
  6. void gui_term_process_cmdline(Conf *conf, char *cmdline)
  7. {
  8. do_defaults(NULL, conf);
  9. conf_set_str(conf, CONF_remote_cmd, "");
  10. cmdline = handle_restrict_acl_cmdline_prefix(cmdline);
  11. if (handle_special_sessionname_cmdline(cmdline, conf) ||
  12. handle_special_filemapping_cmdline(cmdline, conf))
  13. return;
  14. int argc;
  15. char **argv, **argstart;
  16. split_into_argv(cmdline, false, &argc, &argv, &argstart);
  17. for (int i = 0; i < argc; i++) {
  18. char *arg = argv[i];
  19. int retd = cmdline_process_param(
  20. arg, i+1<argc?argv[i+1]:NULL, 1, conf);
  21. if (retd == -2) {
  22. cmdline_error("option \"%s\" requires an argument", arg);
  23. } else if (retd == 2) {
  24. i++; /* skip next argument */
  25. } else if (retd == 1) {
  26. continue; /* nothing further needs doing */
  27. } else if (!strcmp(arg, "-e")) {
  28. if (i+1 < argc) {
  29. /* The command to execute is taken to be the unparsed
  30. * version of the whole remainder of the command line. */
  31. conf_set_str(conf, CONF_remote_cmd, argstart[i+1]);
  32. return;
  33. } else {
  34. cmdline_error("option \"%s\" requires an argument", arg);
  35. }
  36. } else if (arg[0] == '-') {
  37. cmdline_error("unrecognised option \"%s\"", arg);
  38. } else {
  39. cmdline_error("unexpected non-option argument \"%s\"", arg);
  40. }
  41. }
  42. cmdline_run_saved(conf);
  43. conf_set_int(conf, CONF_sharrow_type, SHARROW_BITMAP);
  44. }
  45. const struct BackendVtable *backend_vt_from_conf(Conf *conf)
  46. {
  47. return &conpty_backend;
  48. }
  49. const wchar_t *get_app_user_model_id(void)
  50. {
  51. return L"SimonTatham.Pterm";
  52. }
  53. void gui_terminal_ready(HWND hwnd, Seat *seat, Backend *backend)
  54. {
  55. }