* [Edbrowse-dev] [PATCH 1/2] Allow opening of existing files containing #
@ 2011-12-19 14:15 Tyler Spivey
2011-12-19 14:15 ` [Edbrowse-dev] [PATCH 2/2] Only check for sql if compiled in Tyler Spivey
2011-12-19 18:55 ` [Edbrowse-dev] [PATCH 1/2] Allow opening of existing files containing # chris
0 siblings, 2 replies; 3+ messages in thread
From: Tyler Spivey @ 2011-12-19 14:15 UTC (permalink / raw)
To: edbrowse-dev
If a filename contains # and already exists, edit it.
---
src/buffers.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/buffers.c b/src/buffers.c
index a203006..6ba5ada 100644
--- a/src/buffers.c
+++ b/src/buffers.c
@@ -1119,6 +1119,7 @@ readFile(const char *filename, const char *post)
bool rc; /* return code */
bool is8859, isutf8;
char *nopound;
+char filetype;
serverData = 0;
serverDataLen = 0;
@@ -1195,9 +1196,10 @@ readFile(const char *filename, const char *post)
}
fromdisk:
+ filetype = fileTypeByName(filename, false);
/* reading a file from disk */
fileSize = 0;
- if(fileTypeByName(filename, false) == 'd') {
+ if(filetype == 'd') {
/* directory scan */
int len, j, start, end;
cw->baseDirName = cloneString(filename);
@@ -1273,7 +1275,7 @@ readFile(const char *filename, const char *post)
nopound = cloneString(filename);
rbuf = strchr(nopound, '#');
- if(rbuf)
+ if (rbuf && !filetype)
*rbuf = 0;
rc = fileIntoMemory(nopound, &rbuf, &fileSize);
nzFree(nopound);
--
1.7.7.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Edbrowse-dev] [PATCH 2/2] Only check for sql if compiled in
2011-12-19 14:15 [Edbrowse-dev] [PATCH 1/2] Allow opening of existing files containing # Tyler Spivey
@ 2011-12-19 14:15 ` Tyler Spivey
2011-12-19 18:55 ` [Edbrowse-dev] [PATCH 1/2] Allow opening of existing files containing # chris
1 sibling, 0 replies; 3+ messages in thread
From: Tyler Spivey @ 2011-12-19 14:15 UTC (permalink / raw)
To: edbrowse-dev
If SQL isn't compiled in, isSQL returns false.
This fixes problems with editing files with ] in the name,
without having to put ./ at the beginning.
---
src/makefile | 2 ++
src/stringfile.c | 3 +++
2 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/makefile b/src/makefile
index 93f29a5..b4d7b3b 100644
--- a/src/makefile
+++ b/src/makefile
@@ -78,11 +78,13 @@ dbinfx.o : dbinfx.ec
esql -c dbinfx.ec
# Informix executable
+edbrowseinf: CFLAGS += -DHAVE_SQL
edbrowseinf: $(EBOBJS) tcp.o dbops.o dbinfx.o
esql $(ESQLDFLAGS) -o edbrowseinf $(EBOBJS) tcp.o dbops.o dbinfx.o $(LDLIBS)
# odbc access
edbrowseodbc: LDLIBS += -lodbc
+edbrowseodbc: CFLAGS += -DHAVE_SQL
edbrowseodbc: $(EBOBJS) tcp.o dbops.o dbodbc.o
$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
diff --git a/src/stringfile.c b/src/stringfile.c
index 832d744..4920272 100644
--- a/src/stringfile.c
+++ b/src/stringfile.c
@@ -399,6 +399,9 @@ isSQL(const char *s)
char c;
const char *c1 = 0, *c2 = 0;
c = *s;
+#ifndef HAVE_SQL
+ return false;
+#endif
if(isURL(s))
return false;
if(!isalphaByte(c))
--
1.7.7.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Edbrowse-dev] [PATCH 1/2] Allow opening of existing files containing #
2011-12-19 14:15 [Edbrowse-dev] [PATCH 1/2] Allow opening of existing files containing # Tyler Spivey
2011-12-19 14:15 ` [Edbrowse-dev] [PATCH 2/2] Only check for sql if compiled in Tyler Spivey
@ 2011-12-19 18:55 ` chris
1 sibling, 0 replies; 3+ messages in thread
From: chris @ 2011-12-19 18:55 UTC (permalink / raw)
To: edbrowse-dev
Tyler Spivey <tspivey@pcdesk.net> writes:
> If a filename contains # and already exists, edit it.
Yes, I like it! Both of these look good; I applied them locally. I'll
probably push later today.
Thank you for contributing,
-- Chris
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-12-19 18:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-19 14:15 [Edbrowse-dev] [PATCH 1/2] Allow opening of existing files containing # Tyler Spivey
2011-12-19 14:15 ` [Edbrowse-dev] [PATCH 2/2] Only check for sql if compiled in Tyler Spivey
2011-12-19 18:55 ` [Edbrowse-dev] [PATCH 1/2] Allow opening of existing files containing # chris
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).