diff lib/protocols.c @ 542:fd9ce7797984

2004-8-21 Brian Masney <masneyb@gftp.org> * lib/gftp.h lib/options.h lib/protocols.c - added gftp_protocol_default_port() that will return the default port for the current protocol * src/gtk/misc-gtk.c (update_window_info) - when updating the toolbar with the connection status, if the current connection is using the default port for it's protocol, then leave the port field blank. This should help users who want to reconnect to the current site using a different protocol * src/gtk/gftp-gtk.c (CreateConnectToolbar) - expanded the size of the Port input box
author masneyb
date Sat, 21 Aug 2004 15:49:34 +0000
parents bccfdbfaac00
children 5d13fa48c275
line wrap: on
line diff
--- a/lib/protocols.c	Sat Aug 21 14:40:41 2004 +0000
+++ b/lib/protocols.c	Sat Aug 21 15:49:34 2004 +0000
@@ -3050,3 +3050,16 @@
   return (mode);
 }
 
+
+unsigned int
+gftp_protocol_default_port (gftp_request * request)
+{
+  struct servent serv_struct;
+
+  if (r_getservbyname (gftp_protocols[request->protonum].url_prefix, "tcp",
+                       &serv_struct, NULL) == NULL)
+    return (gftp_protocols[request->protonum].default_port);
+  else
+    return (ntohs (serv_struct.s_port));
+}
+