pterm.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. CmdlineArgList *arglist = cmdline_arg_list_from_GetCommandLineW();
  15. size_t arglistpos = 0;
  16. while (arglist->args[arglistpos]) {
  17. CmdlineArg *arg = arglist->args[arglistpos++];
  18. CmdlineArg *nextarg = arglist->args[arglistpos];
  19. const char *argstr = cmdline_arg_to_str(arg);
  20. int retd = cmdline_process_param(arg, nextarg, 1, conf);
  21. if (retd == -2) {
  22. cmdline_error("option \"%s\" requires an argument", argstr);
  23. } else if (retd == 2) {
  24. arglistpos++; /* skip next argument */
  25. } else if (retd == 1) {
  26. continue; /* nothing further needs doing */
  27. } else if (!strcmp(argstr, "-e")) {
  28. if (nextarg) {
  29. /* The command to execute is taken to be the unparsed
  30. * version of the whole remainder of the command line. */
  31. char *cmd = cmdline_arg_remainder_utf8(nextarg);
  32. conf_set_utf8(conf, CONF_remote_cmd, cmd);
  33. sfree(cmd);
  34. return;
  35. } else {
  36. cmdline_error("option \"%s\" requires an argument", argstr);
  37. }
  38. } else if (argstr[0] == '-') {
  39. cmdline_error("unrecognised option \"%s\"", argstr);
  40. } else {
  41. cmdline_error("unexpected non-option argument \"%s\"", argstr);
  42. }
  43. }
  44. cmdline_run_saved(conf);
  45. conf_set_int(conf, CONF_sharrow_type, SHARROW_BITMAP);
  46. }
  47. const struct BackendVtable *backend_vt_from_conf(Conf *conf)
  48. {
  49. return &conpty_backend;
  50. }
  51. const wchar_t *get_app_user_model_id(void)
  52. {
  53. return L"SimonTatham.Pterm";
  54. }
  55. void gui_terminal_ready(HWND hwnd, Seat *seat, Backend *backend)
  56. {
  57. }