MCPcopy Index your code
hub / github.com/RsyncProject/rsync / check_for_hostspec

Function check_for_hostspec

options.c:3130–3156  ·  view source on GitHub ↗

Look for a HOST specification of the form "HOST:PATH", "HOST::PATH", or * "rsync://HOST:PORT/PATH". If found, *host_ptr will be set to some allocated * memory with the HOST. If a daemon-accessing spec was specified, the value * of *port_ptr will contain a non-0 port number, otherwise it will be set to * 0. The return value is a pointer to the PATH. Note that the HOST spec can * be an IPv6

Source from the content-addressed store, hash-verified

3128 * be an IPv6 literal address enclosed in '[' and ']' (such as "[::1]" or
3129 * "[::ffff:127.0.0.1]") which is returned without the '[' and ']'. */
3130char *check_for_hostspec(char *s, char **host_ptr, int *port_ptr)
3131{
3132 char *path;
3133
3134 if (port_ptr && strncasecmp(URL_PREFIX, s, strlen(URL_PREFIX)) == 0) {
3135 *host_ptr = parse_hostspec(s + strlen(URL_PREFIX), &path, port_ptr);
3136 if (*host_ptr) {
3137 if (!*port_ptr)
3138 *port_ptr = -1; /* -1 indicates they want the default */
3139 return path;
3140 }
3141 }
3142
3143 *host_ptr = parse_hostspec(s, &path, NULL);
3144 if (!*host_ptr)
3145 return NULL;
3146
3147 if (*path == ':') {
3148 if (port_ptr && !*port_ptr)
3149 *port_ptr = -1;
3150 return path + 1;
3151 }
3152 if (port_ptr)
3153 *port_ptr = 0;
3154
3155 return path;
3156}

Callers 3

parse_argumentsFunction · 0.85
write_batch_shell_fileFunction · 0.85
start_clientFunction · 0.85

Calls 1

parse_hostspecFunction · 0.85

Tested by

no test coverage detected