/* (see miscellaneous above) */ static const GRegex * re_host (void) { static GRegex *host_ret; if (host_ret) return host_ret; host_ret = make_re ("(" "(" HOST_URL PORT ")|(" HOST ")" ")"); return host_ret; }
static const GRegex * re_url_no_scheme (void) { static GRegex *url_ret = NULL; if (url_ret) return url_ret; url_ret = make_re ("(" HOST_URL OPT_PORT "/" "(" PATH ")?" ")"); return url_ret; }
static const GRegex * re_url (void) { static GRegex *url_ret = NULL; GString *grist_gstr; char *grist; int i; if (url_ret) return url_ret; grist_gstr = g_string_new (NULL); for (i = 0; uri[i].scheme; i++) { if (i) g_string_append (grist_gstr, "|"); g_string_append (grist_gstr, "("); g_string_append_printf (grist_gstr, "%s:", uri[i].scheme); if (uri[i].flags & URI_AUTHORITY) g_string_append (grist_gstr, "//"); if (uri[i].flags & URI_USERINFO) g_string_append (grist_gstr, USERINFO); else if (uri[i].flags & URI_OPT_USERINFO) g_string_append (grist_gstr, USERINFO "?"); if (uri[i].flags & URI_AUTHORITY) g_string_append (grist_gstr, HOST_URL_OPT_TLD OPT_PORT); if (uri[i].flags & URI_PATH) { char *sep_escaped; sep_escaped = g_regex_escape_string (uri[i].path_sep, strlen(uri[i].path_sep)); g_string_append_printf(grist_gstr, "(" "%s" PATH ")?", sep_escaped); g_free(sep_escaped); } g_string_append(grist_gstr, ")"); } grist = g_string_free (grist_gstr, FALSE); url_ret = make_re (grist); g_free (grist); return url_ret; }
static const GRegex * re_nick (void) { static GRegex *nick_ret; if (nick_ret) return nick_ret; nick_ret = make_re ("(" NICK ")"); return nick_ret; }
static const GRegex * re_channel (void) { static GRegex *channel_ret; if (channel_ret) return channel_ret; channel_ret = make_re ("(" CHANNEL ")"); return channel_ret; }
static const GRegex * re_path (void) { static GRegex *path_ret; if (path_ret) return path_ret; path_ret = make_re ("(" FS_PATH ")"); return path_ret; }
static const GRegex * re_host6 (void) { static GRegex *host6_ret; if (host6_ret) return host6_ret; host6_ret = make_re ("(" "(" IPV6ADDR ")|(" "\\[" IPV6ADDR "\\]" PORT ")" ")"); return host6_ret; }
static const GRegex * re_email (void) { static GRegex *email_ret; if (email_ret) return email_ret; email_ret = make_re ("(" EMAIL ")"); return email_ret; }
/* (see miscellaneous above) */ static GRegex * re_host (void) { static GRegex *host_ret; char *grist; grist = g_strdup_printf ( "(" /* HOST */ HOST OPT_PORT ")" ); host_ret = make_re (grist, "re_host"); return host_ret; }
static const GRegex * re_channel (void) { static GRegex *channel_ret; char *grist; if (channel_ret) return channel_ret; grist = g_strdup ( "(" CHANNEL ")" ); channel_ret = make_re (grist); return channel_ret; }
static const GRegex * re_path (void) { static GRegex *path_ret; char *grist; if (path_ret) return path_ret; grist = g_strdup ( "(" FS_PATH ")" ); path_ret = make_re (grist); return path_ret; }
static const GRegex * re_email (void) { static GRegex *email_ret; char *grist; if (email_ret) return email_ret; grist = g_strdup ( "(" EMAIL ")" ); email_ret = make_re (grist); return email_ret; }
static const GRegex * re_nick (void) { static GRegex *nick_ret; char *grist; if (nick_ret) return nick_ret; grist = g_strdup ( "(" NICK ")" ); nick_ret = make_re (grist); return nick_ret; }
/* (see miscellaneous above) */ static const GRegex * re_host (void) { static GRegex *host_ret; char *grist; if (host_ret) return host_ret; grist = g_strdup ( "(" "(" HOST_URL PORT ")|(" HOST ")" ")" ); host_ret = make_re (grist); return host_ret; }
static GRegex * re_email (void) { static GRegex *email_ret; char *grist; if (email_ret) return email_ret; grist = g_strdup_printf ( "(" /* EMAIL */ EMAIL ")" ); email_ret = make_re (grist, "re_email"); return email_ret; }
static GRegex * re_nick (void) { static GRegex *nick_ret; char *grist; if (nick_ret) return nick_ret; grist = g_strdup_printf ( "(" /* NICK */ NICK ")" ); nick_ret = make_re (grist, "re_nick"); return nick_ret; }
static GRegex * re_channel (void) { static GRegex *channel_ret; char *grist; if (channel_ret) return channel_ret; grist = g_strdup_printf ( "(" /* CHANNEL */ CHANNEL ")" ); channel_ret = make_re (grist, "re_channel"); return channel_ret; }
static GRegex * re_path (void) { static GRegex *path_ret; char *grist; if (path_ret) return path_ret; grist = g_strdup_printf ( "(" /* PATH */ PATH ")" ); path_ret = make_re (grist, "re_path"); return path_ret; }
static const GRegex * re_host6 (void) { static GRegex *host6_ret; char *grist; if (host6_ret) return host6_ret; grist = g_strdup ( "(" "(" IPV6ADDR ")|(" "\\[" IPV6ADDR "\\]" PORT ")" ")" ); host6_ret = make_re (grist); return host6_ret; }
static GRegex * re_url (void) { static GRegex *url_ret; char *grist; char *scheme; if (url_ret) return url_ret; scheme = g_strjoinv ("|", prefix); grist = g_strdup_printf ( "(" /* URL or HOST */ "(" SCHEME HOST OPT_PORT "(" /* Optional "/path?query_string#fragment_id" */ "/" /* Must start with slash */ "(" "(" LPAR NOPARENS RPAR ")" "|" "(" NOPARENS ")" ")*" /* Zero or more occurrences of either of these */ "(?<![.,?!\\]])" /* Not allowed to end with these */ ")?" /* Zero or one of this /path?query_string#fragment_id thing */ ")|(" HOST OPT_PORT "/" "(" /* Optional "path?query_string#fragment_id" */ "(" "(" LPAR NOPARENS RPAR ")" "|" "(" NOPARENS ")" ")*" /* Zero or more occurrences of either of these */ "(?<![.,?!\\]])" /* Not allowed to end with these */ ")?" /* Zero or one of this /path?query_string#fragment_id thing */ ")" ")" , scheme ); url_ret = make_re (grist, "re_url"); g_free (scheme); return url_ret; }