[The host.name.domain/port syntax is more or less an invention specific to this patch; I'm not aware of other programs using that same syntax. Using a fixed size array for port_string is problematic, as 16 bytes could overflow on 64 bit machines. I suppose one could use sizeof (int) * CHAR_BIT or some such. -kingdon] Date: Mon, 22 Jun 1998 14:03:21 -0400 (EDT) From: Mark Hamstra To: kingdon@cyclic.com Subject: unoff-port3.txt? Content-Type: TEXT/PLAIN; charset=US-ASCII Jim, Here's my client_port patch against this morning's update from your tree. This is the one that supports the :pserver:username@host.name.domain/port:/dir/path syntax. Hmmm... a little bit of linewrap in the patch.... -Mark ============================================================================= --- ccvs/src/client.h Mon Jun 22 11:16:37 1998 +++ ccvs/src/client.h.meh Sun Jun 21 20:34:53 1998 @@ -55,6 +55,7 @@ /* Is the -P option to checkout or update specified? */ extern int client_prune_dirs; +extern int client_port; #ifdef AUTH_CLIENT_SUPPORT extern int use_authenticating_server; --- ccvs/src/client.c Mon Jun 22 11:16:36 1998 +++ ccvs/src/client.c.meh Sun Jun 21 21:21:56 1998 @@ -3456,11 +3456,19 @@ static int auth_server_port_number PROTO ((void)); +int client_port; + static int auth_server_port_number () { - struct servent *s = getservbyname ("cvspserver", "tcp"); + struct servent *s; + + /* If the user explicitly specified a port, use that one */ + if (client_port != 0) + return client_port; + s = getservbyname ("cvspserver", "tcp"); + if (s) return ntohs (s->s_port); else --- ccvs/src/root.c Mon Jun 22 11:16:40 1998 +++ ccvs/src/root.c.meh Mon Jun 22 11:11:34 1998 @@ -412,6 +412,20 @@ if (*CVSroot_hostname == '\0') CVSroot_hostname = NULL; + else + { + if ((p = strchr (CVSroot_hostname, '/'))) + { + char port_string[16]; + + *p = '\0'; + client_port = atoi (++p); + sprintf (port_string, "%d", client_port); + if ((CVSroot_method == pserver_method) && ((client_port < 0) || + (client_port > 65535) || (0 != strcmp (p, port_string)))) + error (1, 0, "Invalid port specification in CVSroot: \n\t\t%s", CVSroot); + } + } } }