![]() |
libtld 2.0.14
A library to determine the Top-Level Domain name of any Internet URI.
|
Command line tool to validate TLDs. More...
#include "libtld/tld.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <iostream>
Go to the source code of this file.
Functions | |
| void | check_uri (char const *uri) |
| Check the parameter as a URI. | |
| void | list () |
| List the default schemes accepted. | |
| int | main (int argc, char *argv[]) |
| The validate tools. | |
| void | usage () |
| Print out the help of the tld tool. | |
Variables | |
| int | err_count = 0 |
| Number of errors so we know whether to exit with 0 or 1. | |
| const char * | schemes |
| List of schemes that we more or less support (some schemes have extensions using the semi-colon that we do not support yet.) | |
| char const * | user_schemes = nullptr |
| Hold a list of schemes as defined by the end user. | |
| int | verbose = 0 |
| Whether the user asked for verbosity, false by default. | |
This tool is used to verify URIs and emails on the command line and in scripts.
Definition in file validate_tld.cpp.
| void check_uri | ( | char const * | uri | ) |
This function verifies that the URI is valid.
| [in] | uri | The URI to be checked. |
Definition at line 70 of file validate_tld.cpp.
References err_count, tld_info::f_category, tld_info::f_country, tld_info::f_offset, tld_info::f_status, tld_info::f_tld, tld_email_list::parse(), schemes, tld_check_uri(), TLD_RESULT_SUCCESS, user_schemes, and verbose.
Referenced by main().
| void list | ( | ) |
This function lists all the schemes defined in the schemes variable.
Definition at line 125 of file validate_tld.cpp.
References schemes.
Referenced by main(), PHP_FUNCTION(), tld_email_count(), tld_email_free(), tld_email_next(), tld_email_parse(), and tld_email_rewind().
| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
The parameters can include any number of URIs and emails. The system must be told what's what using a protocol. For emails, use the name "mail".
| [in] | argc | Number of command line arguments passed in. |
| [in] | argv | The arguments passed in. |
Definition at line 172 of file validate_tld.cpp.
References check_uri(), err_count, LIBTLD_VERSION, list(), tld_version(), usage(), user_schemes, and verbose.
| void usage | ( | ) |
This function prints out the help information about the validate_tld tool. The function does not return.
Definition at line 147 of file validate_tld.cpp.
Referenced by main().
| int err_count = 0 |
Definition at line 38 of file validate_tld.cpp.
Referenced by check_uri(), and main().
| const char* schemes |
This list of schemes comes from http://en.wikipedia.org/wiki/URI_scheme and is likely not 100% valid, but it should cover a pretty large number of schemes expected to work with our system.
Definition at line 53 of file validate_tld.cpp.
Referenced by check_uri(), and list().
| char const* user_schemes = nullptr |
Definition at line 62 of file validate_tld.cpp.
Referenced by check_uri(), and main().
| int verbose = 0 |
Definition at line 41 of file validate_tld.cpp.
Referenced by check_uri(), and main().
This document is part of the Snap! Websites Project.
Copyright by Made to Order Software Corp.