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

View File

@ -14,19 +14,8 @@
#define CSI "\x1b["
#define USERCHARS "-[:alnum:]"
#define USERCHARS_CLASS "[" USERCHARS "]"
#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;
// http://blog.dieweltistgarnichtso.net/constructing-a-regular-expression-that-matches-uris
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";
typedef enum overlay_mode {
OVERLAY_HIDDEN = 0,