- snprintf(srvloc_url, sizeof(srvloc_url), "afp://%s:%d?NAME=%s", inet_ntoa(dsi->server.sin_addr), ntohs(dsi->server.sin_port), options->hostname);
+ /* XXX We don't want to tack on the port number if we don't have to. Why?
+ * Well, this seems to break MacOS < 10. If the user _really_ wants to
+ * use a non-default port, they can, but be aware, this server might not
+ * show up int the Network Browser. */
+ afpovertcp = getservbyname("afpovertcp", "tcp");
+ if (dsi->server.sin_port == afpovertcp->s_port) {
+ snprintf(srvloc_url, sizeof(srvloc_url), "afp://%s/?NAME=%s", inet_ntoa(dsi->server.sin_addr), options->hostname);
+ }
+ else {
+ snprintf(srvloc_url, sizeof(srvloc_url), "afp://%s:%d/?NAME=%s", inet_ntoa(dsi->server.sin_addr), ntohs(dsi->server.sin_port), options->hostname);
+ }