urltype(), urlhost(), urlport(), urluser(), urlgroup(), urlpass(), urlfn(), urloffs(), urlrest() - URL parsing functions

SYNOPSIS

#include "napi3.h"
char *urltype(char *url);
char *urlhost(char *url);
char *urlport(char *url);
char *urluser(char *url)
char *urlgroup(char *url)
char *urlpass(char *url)
char *urlfn(char *url)
long *urloffs(char *url,int *n)
char *urlrest(char *url)


DESCRIPTION
These functions parse URLs and return selected parts from them. All of these functions are passed to a URL as passed to a search callback function. They will all return alloced pointers that should be freed when no longer needed.

urltype()

returns the type field of the URL. This will always be "tfile" in a search callback.

urlhost()

returns the host field of the URL. This is the address of the host that created the URL. With this information, the same host can be contacted at a later time through a new connection.

urlport()

returns the port field of the URL. This is the port to use when contacting the host returned above.

urluser()

returns the user name field of the URL. This is empty or the user to log in as when contacting the host.

urlgroup()

returns the group name field of the URL. This is empty or the group to log in as when contacting this host.

urlpass()

returns the password field of the URL. This is empty or the password to use to log in with when contacting this host.

urlfn()

returns the filename field of the URL. This is the filename of interest as the server knows it. This can be used as the fn argument to n_openrfile().

urloffs()

returns the offsets and lengths of the hit and sub-hits within the hit. The second parameter to urloffs() is a pointer to an int to receive the size of the returned array. The returned pointer points to a list of pairs of longs. The first long in each pair is the offset of the hit or sub-hit. The second long in each pair is the offset of the hit or sub-hit. The first offset-length pair is the overall hit within the document. The remaining offset-length pairs are subhits within the overall hit.

urlrest()

returns everything after the filename field of the URL.


Copyright © Thunderstone Software     Last updated: Oct 5 2023
Copyright © 2024 Thunderstone Software LLC. All rights reserved.