fix the url madness once and for all

This commit is contained in:
Daniel Micay 2012-07-20 10:34:36 -04:00
parent 4940cf4a75
commit cbfc6264f1
2 changed files with 20 additions and 33 deletions

View File

@ -4,32 +4,30 @@ GTK = gtk+-3.0
VTE = vte-2.90 VTE = vte-2.90
TERMINFO = ${PREFIX}/share/terminfo TERMINFO = ${PREFIX}/share/terminfo
CFLAGS := -std=c99 -O3 \ CXXFLAGS := -std=c++11 -O3 \
-Wall -Wextra -pedantic \ -Wall -Wextra -pedantic \
-Winit-self \ -Winit-self \
-Wshadow \ -Wshadow \
-Wformat=2 \ -Wformat=2 \
-Wmissing-declarations \ -Wmissing-declarations \
-Wstrict-overflow=4 \ -Wstrict-overflow=4 \
-Wcast-align \ -Wcast-align \
-Wcast-qual \ -Wcast-qual \
-Wconversion \ -Wconversion \
-Wc++-compat \ -Wunused-macros \
-Wbad-function-cast \ -Wwrite-strings \
-Wunused-macros \ -DTERMITE_VERSION=\"${VERSION}\" \
-Wwrite-strings \ ${shell pkg-config --cflags ${GTK} ${VTE}} \
-DTERMITE_VERSION=\"${VERSION}\" \ ${CXXFLAGS}
${shell pkg-config --cflags ${GTK} ${VTE}} \
${CFLAGS}
ifeq (${CC}, clang) ifeq (${CXX}, g++)
CFLAGS += -Wno-missing-field-initializers CXXFLAGS += -Wno-missing-field-initializers
endif endif
LDFLAGS := -s -Wl,--as-needed ${shell pkg-config --libs ${GTK} ${VTE}} ${LDFLAGS} LDFLAGS := -s -Wl,--as-needed ${shell pkg-config --libs ${GTK} ${VTE}} ${LDFLAGS}
termite: termite.c termite: termite.c
${CC} ${CFLAGS} -o $@ $< ${LDFLAGS} ${CXX} ${CXXFLAGS} -o $@ $< ${LDFLAGS}
install: termite install: termite
mkdir -p ${DESTDIR}${TERMINFO} mkdir -p ${DESTDIR}${TERMINFO}

View File

@ -14,19 +14,8 @@
#define CSI "\x1b[" #define CSI "\x1b["
#define USERCHARS "-[:alnum:]" // http://blog.dieweltistgarnichtso.net/constructing-a-regular-expression-that-matches-uris
#define USERCHARS_CLASS "[" USERCHARS "]" static const char * const url_regex = R"XXX(((?<=\()[A-Za-z][A-Za-z0-9\+\.\-]*:([A-Za-z0-9\.\-_~:/\?#\[\]@!\$&'\(\)\*\+,;=]|%[A-Fa-f0-9]{2})+(?=\)))|([A-Za-z][A-Za-z0-9\+\.\-]*:([A-Za-z0-9\.\-_~:/\?#\[\]@!\$&'\(\)\*\+,;=]|%[A-Fa-f0-9]{2})+))XXX";
#define PASSCHARS_CLASS "[-[:alnum:]\\Q,?;.:/!%$^*&~\"#'\\E]"
#define HOSTCHARS_CLASS "[-[:alnum:]]"
#define HOST HOSTCHARS_CLASS "+(\\." HOSTCHARS_CLASS "+)*"
#define PORT "(?:\\:[[:digit:]]{1,5})?"
#define PATHCHARS_CLASS "[-[:alnum:]\\Q_$.+!*,;@&=?/~#%\\E]"
#define PATHTERM_CLASS "[^\\Q]'.}>) \t\r\n,\"\\E]"
#define SCHEME "(?:news:|telnet:|nntp:|file:\\/|https?:|ftps?:|sftp:|webcal:)"
#define USERPASS USERCHARS_CLASS "+(?:" PASSCHARS_CLASS "+)?"
#define URLPATH "(?:(/" PATHCHARS_CLASS "+(?:[(]" PATHCHARS_CLASS "*[)])*" PATHCHARS_CLASS"*)*"PATHTERM_CLASS ")?"
static const char * const url_regex = SCHEME "//(?:" USERPASS "\\@)?" HOST PORT URLPATH;
typedef enum overlay_mode { typedef enum overlay_mode {
OVERLAY_HIDDEN = 0, OVERLAY_HIDDEN = 0,