default_description.c 794 B

1234567891011121314151617181920212223
  1. /*
  2. * Construct a description string for a backend to use as
  3. * backend_description(), or a plug as plug_description().
  4. *
  5. * For some backends this will be overridden: e.g. SSH prefers to
  6. * think in terms of _logical_ host names (i.e. the one associated
  7. * with the host key) rather than the physical details of where you're
  8. * connecting to. But this default is good for simpler backends.
  9. */
  10. #include "putty.h"
  11. char *default_description(const BackendVtable *backvt,
  12. const char *host, int port)
  13. {
  14. const char *be_name = backvt->displayname_lc;
  15. if (backvt->default_port && port == backvt->default_port)
  16. return dupprintf("%s connection to %s", be_name, host);
  17. else
  18. return dupprintf("%s connection to %s port %d", be_name, host, port);
  19. }