Name

uri_absolute — determine whether a URI is relative or absolute

Library

URI parsing library (liburi, -luri)

Synopsis

#include <liburi.h>

int uri_absolute( URI *uri);

Description

The uri_absolute function determines whether a parsed URI is absolute or relative.

An absolute URI is one which does not require the use of a base URI in order to be used.

Parameters

uri

The URI to evaluate.

Return value

If successful, uri_absolute returns 1 if uri contains an absolute URI, and 0 otherwise.

If an error occurs, uri_absolute returns -1, and sets errno accordingly.

Example

URI *relative, *absolute;
int r, a;

absolute = uri_create_str("http://example.com", NULL);

relative = uri_create_str("sample?toggle=1", NULL);

/* a will be set to 1 */
a = uri_absolute(absolute);

/* r will be set to 0 */
b = uri_absolute(relative);
	

See also

liburi(3), uri_absolute_path(3).