diff options
author | David Hill <dhill@conformal.com> | 2013-06-14 11:41:26 -0400 |
---|---|---|
committer | David Hill <dhill@conformal.com> | 2013-06-16 18:21:53 -0400 |
commit | d45b6ceced65e0bc4ba688925903152203348bd9 (patch) | |
tree | d5cd410a946cb37642479162db5fb38b7c019d11 | |
parent | a8e2264b6a8aefc5f4b06ff30274143b2e85b2bc (diff) | |
download | xombrero-d45b6ceced65e0bc4ba688925903152203348bd9.tar.gz |
fix build on NetBSD. From Arnaud Degroote
-rw-r--r-- | netbsd/Makefile | 163 | ||||
-rw-r--r-- | netbsd/netbsd.c | 10 | ||||
-rw-r--r-- | netbsd/util.h | 3 | ||||
-rw-r--r-- | whitelist.c | 2 | ||||
-rw-r--r-- | xombrero.c | 23 |
5 files changed, 50 insertions, 151 deletions
diff --git a/netbsd/Makefile b/netbsd/Makefile index 88590a3..b31aa7a 100644 --- a/netbsd/Makefile +++ b/netbsd/Makefile @@ -1,95 +1,3 @@ -GTK_VERSION?= gtk3 -.if ${GTK_VERSION} == "gtk2" -LIBS= gtk+-2.0 webkit-1.0 -.else -LIBS= gtk+-3.0 webkitgtk-3.0 -.endif -LIBS+= libsoup-2.4 gnutls - -LDADD= -lutil -lX11 -GTK_CFLAGS!= pkg-config --cflags $(LIBS) -GTK_LDFLAGS!= pkg-config --libs $(LIBS) -CFLAGS+= $(GTK_CFLAGS) -O2 -Wall -I. -I.. -LDFLAGS+= $(GTK_LDFLAGS) - -PREFIX?= /usr/local -BINDIR?= $(PREFIX)/bin -LIBDIR?= $(PREFIX)/lib -MANDIR?= $(PREFIX)/man -RESDIR?= $(PREFIX)/share/xombrero - -CC= cc - -all: ../javascript.h ../tooltip.h xombrero - -../javascript.h: ../js-merge-helper.pl ../hinting.js ../autoscroll.js - perl ../js-merge-helper.pl ../hinting.js ../input-focus.js \ - ../autoscroll.js > ../javascript.h - -../tooltip.h: ../ascii2txt.pl ../txt2tooltip.pl ../xombrero.1 - nroff -c -Tascii -mandoc ../xombrero.1 | \ - perl ../ascii2txt.pl | \ - perl ../txt2tooltip.pl > ../tooltip.h - -xombrero.o: ../xombrero.o - -unix.o: ../unix.o - -marco.o: ../marco.o - -whitelist.o: ../whitelist.o - -settings.o: ../settings.o - -about.o: ../about.o - -inspector.o: ../inspector.o - -cookie.o: ../cookie.o - -inputfocus.o: ../inputfocus.o - -history.o: ../history.o - -completion.o: ../completion.o - -externaleditor.o: ../externaleditor.o - -tldlist.o: ../tldlist.o - -../xombrero.o: ../javascript.h ../tooltip.h - -xombrero: xombrero.o netbsd.o marco.o about.o inspector.o whitelist.o settings.o \ - cookie.o history.o completion.o inputfocus.o tldlist.o externaleditor.o \ - unix.o - $(CC) $(LDFLAGS) -o $@ *.o $+ $(LDADD) - -install: all - install -m 755 -d $(DESTDIR)$(BINDIR) - install -m 755 -d $(DESTDIR)$(LIBDIR) - install -m 755 -d $(DESTDIR)$(MANDIR)/man1 - install -m 755 -d $(DESTDIR)$(RESDIR) - install -m 755 xombrero $(DESTDIR)$(BINDIR) - install -m 644 ../xombrero.1 $(DESTDIR)$(MANDIR)/man1/xombrero.1 - install -m 644 ../xombrero.css $(DESTDIR)$(RESDIR) - install -m 644 ../xombrero.desktop $(DESTDIR)$(PREFIX)/share/applications - install -m 644 ../xombreroicon16.png $(DESTDIR)$(RESDIR) - install -m 644 ../xombreroicon32.png $(DESTDIR)$(RESDIR) - install -m 644 ../xombreroicon48.png $(DESTDIR)$(RESDIR) - install -m 644 ../xombreroicon64.png $(DESTDIR)$(RESDIR) - install -m 644 ../xombreroicon128.png $(DESTDIR)$(RESDIR) - install -m 644 ../tld-rules $(DESTDIR)$(RESDIR) - install -m 644 ../style.css $(DESTDIR)$(RESDIR) - install -m 644 ../hsts-preload $(DESTDIR)$(RESDIR) - install -m 644 ../torenabled.ico $(DESTDIR)$(RESDIR) - install -m 644 ../tordisabled.ico $(DESTDIR)$(RESDIR) - -clean: - rm -f xombrero *.o - rm -f javascript.h - rm -f tooltip.h - -.PHONY: all install clean PREFIX?=/usr/local BINDIR=${PREFIX}/bin @@ -100,10 +8,14 @@ DEBUG= -g SRCS= cookie.c inspector.c marco.c about.c whitelist.c settings.c inputfocus.c SRCS+= history.c completion.c tldlist.c externaleditor.c unix.c xombrero.c +SRCS+= netbsd.c +.PATH: ${.CURDIR}/.. + CFLAGS+= -O2 -Wall -Wno-format-extra-args -Wunused CFLAGS+= -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-sign-compare ${DEBUG} CFLAGS+= -DGTK_DISABLE_SINGLE_INCLUDES -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGSEAL_ENABLE -CFLAGS+= -I. -I${.CURDIR} +CFLAGS+= -DGDK_DISABLE_DEPRECATION_WARNINGS -DGLIB_DISABLE_DEPRECATION_WARNINGS +CFLAGS+= -I. -I.. LDADD= -lutil -lgcrypt GTK_VERSION ?= gtk3 .if ${GTK_VERSION} == "gtk2" @@ -119,64 +31,47 @@ GTK_CFLAGS!= pkg-config --cflags $(LIBS) GTK_LDFLAGS!= pkg-config --libs $(LIBS) CFLAGS+= $(GTK_CFLAGS) LDFLAGS+= $(GTK_LDFLAGS) -BUILDVERSION != sh "${.CURDIR}/buildver.sh" +BUILDVERSION != sh "${.CURDIR}/../buildver.sh" .if !${BUILDVERSION} == "" CPPFLAGS+= -DXOMBRERO_BUILDSTR=\"$(BUILDVERSION)\" .endif -MANDIR= ${PREFIX}/man/man +MANDIR= ${PREFIX}/man/ -CLEANFILES += ${.CURDIR}/javascript.h javascript.h tooltip.h xombrero.cat1 xombrero.core +CLEANFILES += ${.CURDIR}/javascript.h javascript.h tooltip.h xombrero.cat1 xombrero.core xombrero.html1 -JSFILES += hinting.js -JSFILES += input-focus.js -JSFILES += autoscroll.js +JSFILES += ../hinting.js +JSFILES += ../input-focus.js +JSFILES += ../autoscroll.js .for _js in ${JSFILES} JSCURDIR += ${.CURDIR}/${_js} .endfor -javascript.h: ${JSFILES} js-merge-helper.pl - perl ${.CURDIR}/js-merge-helper.pl \ +.NOPATH: javascript.h tooltip.h +javascript.h: ${JSFILES} ../js-merge-helper.pl + perl ${.CURDIR}/../js-merge-helper.pl \ ${JSCURDIR} > javascript.h -tooltip.h: ${MAN} ascii2txt.pl txt2tooltip.pl - mandoc -Tascii ${.CURDIR}/${MAN} | \ - perl ${.CURDIR}/ascii2txt.pl | \ - perl ${.CURDIR}/txt2tooltip.pl > tooltip.h +tooltip.h: ${MAN} ../ascii2txt.pl ../txt2tooltip.pl + mandoc -Tascii ${.CURDIR}/../${MAN} | \ + perl ${.CURDIR}/../ascii2txt.pl | \ + perl ${.CURDIR}/../txt2tooltip.pl > tooltip.h beforeinstall: install -m 755 -d ${PREFIX}/bin install -m 755 -d ${PREFIX}/man/man1/ + install -m 755 -d ${PREFIX}/man/html1/ install -m 755 -d ${PREFIX}/share/xombrero - install -m 644 $(.CURDIR)/xombrero.css ${PREFIX}/share/xombrero - install -m 644 ${.CURDIR}/xombreroicon.png ${PREFIX}/share/xombrero - install -m 644 ${.CURDIR}/xombreroicon16.png ${PREFIX}/share/xombrero - install -m 644 ${.CURDIR}/xombreroicon32.png ${PREFIX}/share/xombrero - install -m 644 ${.CURDIR}/xombreroicon48.png ${PREFIX}/share/xombrero - install -m 644 ${.CURDIR}/xombreroicon64.png ${PREFIX}/share/xombrero - install -m 644 ${.CURDIR}/xombreroicon128.png ${PREFIX}/share/xombrero - install -m 644 ${.CURDIR}/tld-rules ${PREFIX}/share/xombrero - install -m 644 ${.CURDIR}/style.css ${PREFIX}/share/xombrero - install -m 644 ${.CURDIR}/hsts-preload ${PREFIX}/share/xombrero - -${PROG} ${OBJS} beforedepend: javascript.h tooltip.h - -# clang targets -.if ${.TARGETS:M*analyze*} -CFLAGS+= -Wdeclaration-after-statement -Wshadow -CC=clang -CXX=clang++ -CPP=clang -E -CFLAGS+=--analyze -.elif ${.TARGETS:M*clang*} -CFLAGS+= -Wdeclaration-after-statement -Wshadow -CC=clang -CXX=clang++ -CPP=clang -E -.endif - -analyze: all -clang: all + install -m 644 $(.CURDIR)/../xombrero.css ${PREFIX}/share/xombrero + install -m 644 ${.CURDIR}/../xombreroicon.png ${PREFIX}/share/xombrero + install -m 644 ${.CURDIR}/../xombreroicon16.png ${PREFIX}/share/xombrero + install -m 644 ${.CURDIR}/../xombreroicon32.png ${PREFIX}/share/xombrero + install -m 644 ${.CURDIR}/../xombreroicon48.png ${PREFIX}/share/xombrero + install -m 644 ${.CURDIR}/../xombreroicon64.png ${PREFIX}/share/xombrero + install -m 644 ${.CURDIR}/../xombreroicon128.png ${PREFIX}/share/xombrero + install -m 644 ${.CURDIR}/../tld-rules ${PREFIX}/share/xombrero + install -m 644 ${.CURDIR}/../style.css ${PREFIX}/share/xombrero + install -m 644 ${.CURDIR}/../hsts-preload ${PREFIX}/share/xombrero .include <bsd.prog.mk> diff --git a/netbsd/netbsd.c b/netbsd/netbsd.c index 93c41e0..387d886 100644 --- a/netbsd/netbsd.c +++ b/netbsd/netbsd.c @@ -77,7 +77,8 @@ scan_scaled(char *scaled, long long *result) long long scale_fact = 1, whole = 0, fpart = 0; /* Skip leading whitespace */ - while (isascii(*p) && isspace(*p)) + while (isascii((unsigned char)*p) && + isspace((unsigned char)*p)) ++p; /* Then at most one leading + or - */ @@ -104,7 +105,8 @@ scan_scaled(char *scaled, long long *result) * (but note that E for Exa might look like e to some!). * Advance 'p' to end, to get scale factor. */ - for (; isascii(*p) && (isdigit(*p) || *p=='.'); ++p) { + for (; isascii((unsigned char)*p) && + (isdigit((unsigned char)*p) || *p=='.'); ++p) { if (*p == '.') { if (fract_digits > 0) { /* oops, more than one '.' */ errno = EINVAL; @@ -148,10 +150,10 @@ scan_scaled(char *scaled, long long *result) /* Are we there yet? */ if (*p == scale_chars[i] || - *p == tolower(scale_chars[i])) { + *p == tolower((unsigned char)scale_chars[i])) { /* If it ends with alphanumerics after the scale char, bad. */ - if (isalnum(*(p+1))) { + if (isalnum((unsigned char)*(p+1))) { errno = EINVAL; return -1; } diff --git a/netbsd/util.h b/netbsd/util.h index d08783f..56b0422 100644 --- a/netbsd/util.h +++ b/netbsd/util.h @@ -32,4 +32,5 @@ #endif #define FMT_SCALED_STRSIZE 7 /* minus sign, 4 digits, suffix, null byte */ -int fmt_scaled(long long number, char *result); +int fmt_scaled(long long number, char *result); +long long strtonum(const char *, long long, long long, const char **); diff --git a/whitelist.c b/whitelist.c index 25490b5..e834565 100644 --- a/whitelist.c +++ b/whitelist.c @@ -41,7 +41,7 @@ find_domain(const gchar *s, int flags) } if (flags & XT_WL_TOPLEVEL && - !isdigit(uri->host[strlen(uri->host) - 1])) + !isdigit((unsigned char)uri->host[strlen(uri->host) - 1])) p = tld_get_suffix(uri->host); else p = uri->host; diff --git a/xombrero.c b/xombrero.c index 978ca7d..55dae05 100644 --- a/xombrero.c +++ b/xombrero.c @@ -874,7 +874,7 @@ load_uri(struct tab *t, const gchar *uri) return; /* Strip leading spaces. */ - while (*uri && isspace(*uri)) + while (*uri && isspace((unsigned char)*uri)) uri++; if (strlen(uri) == 0) { @@ -1545,7 +1545,7 @@ paste_uri(struct tab *t, struct karg *args) if (uri[i] == '\n') uri[i] = ' '; - while (*uri && isspace(*uri)) + while (*uri && isspace((unsigned char)*uri)) uri++; if (strlen(uri) == 0) { show_oops(t, "empty paste buffer"); @@ -5789,7 +5789,7 @@ buffercmd_addkey(struct tab *t, guint keyval) c = -1; s[0] = '\0'; if (buffercmds[i].precount == XT_PRE_MAYBE) { - if (isdigit(bcmd[0])) { + if (isdigit((unsigned char)bcmd[0])) { if (sscanf(bcmd, "%d%s", &c, s) == 0) continue; } else { @@ -5935,7 +5935,7 @@ wv_keypress_cb(GtkEntry *w, GdkEventKey *e, struct tab *t) } else if (t->mode == XT_MODE_COMMAND || t->mode == XT_MODE_HINT) { /* prefix input */ snprintf(s, sizeof s, "%c", e->keyval); - if (CLEAN(e->state) == 0 && isdigit(s[0])) + if (CLEAN(e->state) == 0 && isdigit((unsigned char)s[0])) cmd_prefix = 10 * cmd_prefix + atoi(s); return (handle_keypress(t, e, 0)); } else { @@ -5964,7 +5964,7 @@ hint_continue(struct tab *t) goto done; } - if (isdigit(c[1])) { + if (isdigit((unsigned char)c[1])) { /* numeric input */ i = strtonum(&c[1], 1, 4096, &errstr); if (errstr) { @@ -6171,7 +6171,7 @@ cmd_getlist(int id, char *key) if (cmds[i].level < dep) break; if (cmds[i].level == dep && !strncmp(key, cmds[i].cmd, - strlen(key)) && !isdigit(cmds[i].cmd[0])) + strlen(key)) && !isdigit((unsigned char)cmds[i].cmd[0])) cmd_status.list[c++] = cmds[i].cmd; } @@ -6225,10 +6225,10 @@ cmd_complete(struct tab *t, char *str, int dir) DNPRINTF(XT_D_CMD, "%s: complete %s\n", __func__, str); /* copy prefix*/ - for (i = 0; isdigit(s[i]); i++) + for (i = 0; isdigit((unsigned char)s[i]); i++) res[i + 1] = s[i]; - for (; isspace(s[i]); i++) + for (; isspace((unsigned char)s[i]); i++) res[i + 1] = s[i]; s += i; @@ -6286,9 +6286,10 @@ parse_prefix_and_alias(const char *str, int *prefix) g_strstrip(s); sc = s; - if (isdigit(s[0])) { + if (isdigit((unsigned char)s[0])) { sscanf(s, "%d", prefix); - while (isdigit(s[0]) || isspace(s[0])) + while (isdigit((unsigned char)s[0]) || + isspace((unsigned char)s[0])) ++s; } @@ -6301,7 +6302,7 @@ parse_prefix_and_alias(const char *str, int *prefix) return (g_strdup(c->cmd)); } - if (!isspace(s[strlen(c->alias)])) + if (!isspace((unsigned char)s[strlen(c->alias)])) continue; s = g_strdup_printf("%s %s", c->cmd, &s[strlen(c->alias) + 1]); |