pinosaur
/
surf.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
ad794e0
)
Surf now can handle absolute file paths. This allows better local HTML
author
Christoph Lohmann
<20h@r-36.net>
Sun, 25 Nov 2012 21:31:46 +0000
(22:31 +0100)
committer
Christoph Lohmann
<20h@r-36.net>
Sun, 25 Nov 2012 21:31:46 +0000
(22:31 +0100)
reading.
config.mk
patch
|
blob
|
history
surf.c
patch
|
blob
|
history
diff --git
a/config.mk
b/config.mk
index
e62e033
..
ee05292
100644
(file)
--- a/
config.mk
+++ b/
config.mk
@@
-19,7
+19,7
@@
LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 ${GTKLIB} -lgthread-2.0 \
-ljavascriptcoregtk-1.0
# flags
-ljavascriptcoregtk-1.0
# flags
-CPPFLAGS = -DVERSION=\"${VERSION}\"
+CPPFLAGS = -DVERSION=\"${VERSION}\"
-D_BSD_SOURCE
CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
LDFLAGS = -g ${LIBS}
CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
LDFLAGS = -g ${LIBS}
diff --git
a/surf.c
b/surf.c
index
a090dc8
..
78698b8
100644
(file)
--- a/
surf.c
+++ b/
surf.c
@@
-13,6
+13,7
@@
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
+#include <limits.h>
#include <stdlib.h>
#include <stdio.h>
#include <webkit/webkit.h>
#include <stdlib.h>
#include <stdio.h>
#include <webkit/webkit.h>
@@
-497,14
+498,23
@@
loadstatuschange(WebKitWebView *view, GParamSpec *pspec, Client *c) {
void
loaduri(Client *c, const Arg *arg) {
void
loaduri(Client *c, const Arg *arg) {
- char *u;
+ char *u
, *rp
;
const char *uri = (char *)arg->v;
Arg a = { .b = FALSE };
if(strcmp(uri, "") == 0)
return;
const char *uri = (char *)arg->v;
Arg a = { .b = FALSE };
if(strcmp(uri, "") == 0)
return;
- u = g_strrstr(uri, "://") ? g_strdup(uri)
- : g_strdup_printf("http://%s", uri);
+
+ /* In case it's a file path. */
+ if(uri[0] == '/') {
+ rp = realpath(uri, NULL);
+ u = g_strdup_printf("file://%s", rp);
+ free(rp);
+ } else {
+ u = g_strrstr(uri, "://") ? g_strdup(uri)
+ : g_strdup_printf("http://%s", uri);
+ }
+
/* prevents endless loop */
if(c->uri && strcmp(u, c->uri) == 0) {
reload(c, &a);
/* prevents endless loop */
if(c->uri && strcmp(u, c->uri) == 0) {
reload(c, &a);