* [Edbrowse-dev] [PATCH 1/4] Add check to eb.h so functions work in c++
@ 2013-12-24 15:38 Adam Thompson
2013-12-24 15:38 ` [Edbrowse-dev] [PATCH 2/4] Alter bool typedef to eb_bool in eb.h Adam Thompson
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Adam Thompson @ 2013-12-24 15:38 UTC (permalink / raw)
To: edbrowse-dev
---
src/eb.h | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/eb.h b/src/eb.h
index 03cda4e..c5f2098 100644
--- a/src/eb.h
+++ b/src/eb.h
@@ -5,7 +5,10 @@
#ifndef EB_H
#define EB_H 1
-
+/* needed when compiling under c++ */
+#ifdef __cplusplus
+extern "C" {
+#endif
/* the symbol DOSLIKE is used to conditionally compile those constructs
* that are common to DOS and NT, but not typical of Unix. */
#ifdef MSDOS
@@ -377,4 +380,7 @@ extern void *jdoc; /* javascript document object */
/* Symbolic constants for language independent messages */
#include "messages.h"
+#ifdef __cplusplus
+}
+#endif
#endif
--
1.8.5.2.297.g3e57c29
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Edbrowse-dev] [PATCH 2/4] Alter bool typedef to eb_bool in eb.h
2013-12-24 15:38 [Edbrowse-dev] [PATCH 1/4] Add check to eb.h so functions work in c++ Adam Thompson
@ 2013-12-24 15:38 ` Adam Thompson
2013-12-24 15:38 ` [Edbrowse-dev] [PATCH 3/4] Alter c files to use new eb_bool typedef Adam Thompson
2013-12-24 15:38 ` [Edbrowse-dev] [PATCH 4/4] Add ifdef guard to js.h Adam Thompson
2 siblings, 0 replies; 4+ messages in thread
From: Adam Thompson @ 2013-12-24 15:38 UTC (permalink / raw)
To: edbrowse-dev
---
src/eb.h | 76 ++++++++++++++++++++++++++++++++--------------------------------
1 file changed, 38 insertions(+), 38 deletions(-)
diff --git a/src/eb.h b/src/eb.h
index c5f2098..dfe51c0 100644
--- a/src/eb.h
+++ b/src/eb.h
@@ -76,9 +76,9 @@ typedef unsigned long ulong;
typedef unsigned char uchar;
/* We use uchar for boolean fields. */
-typedef uchar bool;
-#define true 1
-#define false 0
+typedef uchar eb_bool;
+#define eb_true 1
+#define eb_false 0
typedef ushort idNameCode;
@@ -175,7 +175,7 @@ struct MACCOUNT { /* pop3 account */
struct MIMETYPE {
char *type, *desc;
char *suffix, *prot, *program;
- bool stream;
+ eb_bool stream;
};
struct DBTABLE {
@@ -193,22 +193,22 @@ extern int debugLevel; /* 0 to 9 */
extern int displayLength; /* when printing a line */
extern int webTimeout, mailTimeout;
extern int browseLine; /* line number, for error reporting */
-extern bool ismc; /* Is the program running as a mail client? */
-extern bool cons_utf8; /* does the console expect utf8? */
-extern bool iuConvert; /* perform iso utf8 conversions automatically */
+extern eb_bool ismc; /* Is the program running as a mail client? */
+extern eb_bool cons_utf8; /* does the console expect utf8? */
+extern eb_bool iuConvert; /* perform iso utf8 conversions automatically */
extern char type8859; /* 1 through 15 */
-extern bool js_redirects; /* window.location = new_url */
+extern eb_bool js_redirects; /* window.location = new_url */
extern uchar browseLocal; /* browsing a local file */
-extern bool parsePage; /* parsing the html page, and any java therein */
-extern bool htmlAttrVal_nl; /* allow nl in the attribute of an html tag */
-extern bool passMail; /* pass mail across the filters */
-extern bool errorExit; /* exit on any error, for scripting purposes */
-extern bool isInteractive;
-extern volatile bool intFlag; /* set this when interrupt signal is caught */
-extern bool binaryDetect;
-extern bool inputReadLine;
-extern bool listNA; /* list nonascii chars */
-extern bool inInput; /* reading line from standard in */
+extern eb_bool parsePage; /* parsing the html page, and any java therein */
+extern eb_bool htmlAttrVal_nl; /* allow nl in the attribute of an html tag */
+extern eb_bool passMail; /* pass mail across the filters */
+extern eb_bool errorExit; /* exit on any error, for scripting purposes */
+extern eb_bool isInteractive;
+extern volatile eb_bool intFlag; /* set this when interrupt signal is caught */
+extern eb_bool binaryDetect;
+extern eb_bool inputReadLine;
+extern eb_bool listNA; /* list nonascii chars */
+extern eb_bool inInput; /* reading line from standard in */
extern int fileSize; /* when reading/writing files */
extern int maxFileSize; /* max size of an editable file */
extern int mssock; /* mail server socket */
@@ -227,15 +227,15 @@ extern struct MACCOUNT accounts[]; /* all the email accounts */
extern int maxMime; /* how many mime types specified */
extern struct MIMETYPE mimetypes[];
extern char *dbarea, *dblogin, *dbpw; /* to log into the database */
-extern bool fetchBlobColumns;
+extern eb_bool fetchBlobColumns;
extern char *proxy_host;
-extern bool caseInsensitive, searchStringsAll;
-extern bool undoable; /* an undoable operation is taking place */
-extern bool allowRedirection; /* from http code 301, or http refresh */
-extern bool sendReferrer; /* in the http header */
-extern bool allowJS; /* javascript on */
-extern bool helpMessagesOn; /* no need to type h */
-extern bool showHiddenFiles; /* during directory scan */
+extern eb_bool caseInsensitive, searchStringsAll;
+extern eb_bool undoable; /* an undoable operation is taking place */
+extern eb_bool allowRedirection; /* from http code 301, or http refresh */
+extern eb_bool sendReferrer; /* in the http header */
+extern eb_bool allowJS; /* javascript on */
+extern eb_bool helpMessagesOn; /* no need to type h */
+extern eb_bool showHiddenFiles; /* during directory scan */
extern uchar dirWrite; /* directory write mode, e.g. rename files */
extern uchar endMarks; /* do we print ^ $ at the start and end of lines? */
extern int context; /* which session (buffer) are we in? */
@@ -337,19 +337,19 @@ struct ebWindow {
* Number 0 means the label is not set. */
int labels[26], r_labels[26];
/* Yeah, these could be bit fields in the structure :1; but who cares. */
- bool lhs_yes, rhs_yes;
- bool binMode; /* binary file */
- bool nlMode; /* newline at the end */
- bool rnlMode;
+ eb_bool lhs_yes, rhs_yes;
+ eb_bool binMode; /* binary file */
+ eb_bool nlMode; /* newline at the end */
+ eb_bool rnlMode;
/* Two text modes; these are incompatible with binMode */
- bool utf8Mode;
- bool iso8859Mode;
- bool browseMode; /* browsing html */
- bool changeMode; /* something has changed in this file */
- bool dirMode; /* directory mode */
- bool firstOpMode; /* first change has been made, undo is possible */
- bool jsdead; /* javascript is dead, for this window */
- bool sqlMode; /* accessing a table */
+ eb_bool utf8Mode;
+ eb_bool iso8859Mode;
+ eb_bool browseMode; /* browsing html */
+ eb_bool changeMode; /* something has changed in this file */
+ eb_bool dirMode; /* directory mode */
+ eb_bool firstOpMode; /* first change has been made, undo is possible */
+ eb_bool jsdead; /* javascript is dead, for this window */
+ eb_bool sqlMode; /* accessing a table */
char *dw; /* document.write string */
int dw_l; /* length of the above */
void *tags; /* array of html tags, when browsing */
--
1.8.5.2.297.g3e57c29
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Edbrowse-dev] [PATCH 3/4] Alter c files to use new eb_bool typedef
2013-12-24 15:38 [Edbrowse-dev] [PATCH 1/4] Add check to eb.h so functions work in c++ Adam Thompson
2013-12-24 15:38 ` [Edbrowse-dev] [PATCH 2/4] Alter bool typedef to eb_bool in eb.h Adam Thompson
@ 2013-12-24 15:38 ` Adam Thompson
2013-12-24 15:38 ` [Edbrowse-dev] [PATCH 4/4] Add ifdef guard to js.h Adam Thompson
2 siblings, 0 replies; 4+ messages in thread
From: Adam Thompson @ 2013-12-24 15:38 UTC (permalink / raw)
To: edbrowse-dev
---
src/auth.c | 20 +-
src/buffers.c | 1014 +++++++++++++++++++++++++++---------------------------
src/cookies.c | 66 ++--
src/dbodbc.c | 200 +++++------
src/dbops.c | 164 ++++-----
src/dbstubs.c | 16 +-
src/eb.p | 178 +++++-----
src/fetchmail.c | 186 +++++-----
src/format.c | 140 ++++----
src/html.c | 470 ++++++++++++-------------
src/http.c | 114 +++---
src/jsdom.c | 160 ++++-----
src/jsloc.c | 88 ++---
src/main.c | 180 +++++-----
src/messages.c | 20 +-
src/sendmail.c | 206 +++++------
src/stringfile.c | 178 +++++-----
src/url.c | 98 +++---
18 files changed, 1749 insertions(+), 1749 deletions(-)
diff --git a/src/auth.c b/src/auth.c
index a4a81c7..9b686f6 100644
--- a/src/auth.c
+++ b/src/auth.c
@@ -23,14 +23,14 @@ struct httpAuth {
char *directory;
char *user_password;
int port;
- bool proxy;
+ eb_bool proxy;
uchar realm;
};
static struct listHead authlist = { &authlist, &authlist };
-bool
-getUserPass(const char *url, char *creds, bool find_proxy)
+eb_bool
+getUserPass(const char *url, char *creds, eb_bool find_proxy)
{
const char *host = getHostURL(url);
int port = getPortURL(url);
@@ -64,22 +64,22 @@ getUserPass(const char *url, char *creds, bool find_proxy)
return (found != NULL);
} /* getUserPass */
-bool
+eb_bool
addWebAuthorization(const char *url,
- int realm, const char *credentials, bool proxy)
+ int realm, const char *credentials, eb_bool proxy)
{
struct httpAuth *a;
const char *host;
const char *dir = 0, *dirend;
int port, dl;
- bool urlProx = isProxyURL(url);
- bool updated = true;
+ eb_bool urlProx = isProxyURL(url);
+ eb_bool updated = eb_true;
char *p;
if(proxy) {
if(!urlProx) {
setError(MSG_ProxyAuth);
- return false;
+ return eb_false;
}
} else if(urlProx)
url = getDataURL(url);
@@ -105,7 +105,7 @@ addWebAuthorization(const char *url,
}
if(a == (struct httpAuth *)&authlist) {
- updated = false;
+ updated = eb_false;
a = allocZeroMem(sizeof (struct httpAuth));
addToListFront(&authlist, a);
}
@@ -121,5 +121,5 @@ addWebAuthorization(const char *url,
a->user_password = cloneString(credentials);
debugPrint(3, "%s authorization for %s%s",
updated ? "updated" : "new", a->host, a->directory);
- return true;
+ return eb_true;
} /* addWebAuthorization */
diff --git a/src/buffers.c b/src/buffers.c
index 6f07d0d..a7faa19 100644
--- a/src/buffers.c
+++ b/src/buffers.c
@@ -40,9 +40,9 @@ static int destLine; /* as in 57,89m226 */
static int last_z = 1;
static char cmd, icmd, scmd;
static uchar subPrint; /* print lines after substitutions */
-static bool noStack; /* don't stack up edit sessions */
-static bool globSub; /* in the midst of a g// command */
-static bool inscript; /* run from inside an edbrowse function */
+static eb_bool noStack; /* don't stack up edit sessions */
+static eb_bool globSub; /* in the midst of a g// command */
+static eb_bool inscript; /* run from inside an edbrowse function */
static int lastq, lastqq;
static char icmd; /* input command, usually the same as cmd */
@@ -169,7 +169,7 @@ fetchLine(int n, int show)
} /* fetchLine */
static int
-apparentSize(int cx, bool browsing)
+apparentSize(int cx, eb_bool browsing)
{
char c;
int i, ln, size;
@@ -242,9 +242,9 @@ displayLine(int n)
printf("^");
while((c = *s++) != '\n') {
- bool expand = false;
+ eb_bool expand = eb_false;
if(c == 0 || c == '\r' || c == '\x1b')
- expand = true;
+ expand = eb_true;
if(cmd == 'l') {
/* show tabs and backspaces, ed style */
if(c == '\b')
@@ -252,7 +252,7 @@ displayLine(int n)
if(c == '\t')
c = '>';
if(c < ' ' || c == 0x7f || c >= 0x80 && listNA)
- expand = true;
+ expand = eb_true;
} /* list */
if(expand)
printf("~%02X", c), cnt += 3;
@@ -327,8 +327,8 @@ inputLine(void)
uchar *s;
top:
- intFlag = false;
- inInput = true;
+ intFlag = eb_false;
+ inInput = eb_true;
nzFree(last_rl);
last_rl = 0;
s = 0;
@@ -346,8 +346,8 @@ inputLine(void)
i_puts(MSG_EndFile);
ebClose(1);
}
- inInput = false;
- intFlag = false;
+ inInput = eb_false;
+ intFlag = eb_false;
i = j = 0;
if(last_rl) {
@@ -389,7 +389,7 @@ inputLine(void)
static struct {
char lhs[MAXRE], rhs[MAXRE];
- bool lhs_yes, rhs_yes;
+ eb_bool lhs_yes, rhs_yes;
} globalSubs;
static void
@@ -551,33 +551,33 @@ This is how the user edits multiple sessions, or browses multiple
web pages, simultaneously.
*********************************************************************/
-bool
+eb_bool
cxCompare(int cx)
{
if(cx == 0) {
setError(MSG_Session0);
- return false;
+ return eb_false;
}
if(cx >= MAXSESSION) {
setError(MSG_SessionHigh, cx, MAXSESSION - 1);
- return false;
+ return eb_false;
}
if(cx != context)
- return true; /* ok */
+ return eb_true; /* ok */
setError(MSG_SessionCurrent, cx);
- return false;
+ return eb_false;
} /*cxCompare */
/* is a context active? */
-bool
+eb_bool
cxActive(int cx)
{
if(cx <= 0 || cx >= MAXSESSION)
i_printfExit(MSG_SessionOutRange, cx);
if(sessionList[cx].lw)
- return true;
+ return eb_true;
setError(MSG_SessionInactive, cx);
- return false;
+ return eb_false;
} /* cxActive */
static void
@@ -589,7 +589,7 @@ cxInit(int cx)
sessionList[cx].fw = sessionList[cx].lw = lw;
} /* cxInit */
-bool
+eb_bool
cxQuit(int cx, int action)
{
struct ebWindow *w = sessionList[cx].lw;
@@ -604,11 +604,11 @@ cxQuit(int cx, int action)
setError(MSG_ExpectW);
if(cx != context)
setError(MSG_ExpectWX, cx);
- return false;
+ return eb_false;
}
if(!action)
- return true; /* just a test */
+ return eb_true; /* just a test */
if(cx == context) {
/* Don't need to retain the undo lines. */
@@ -631,21 +631,21 @@ cxQuit(int cx, int action)
if(cx == context)
cw = 0;
- return true;
+ return eb_true;
} /* cxQuit */
/* Switch to another edit session.
* This assumes cxCompare has succeeded - we're moving to a different context.
* Pass the context number and an interactive flag. */
void
-cxSwitch(int cx, bool interactive)
+cxSwitch(int cx, eb_bool interactive)
{
- bool created = false;
+ eb_bool created = eb_false;
struct ebWindow *nw = sessionList[cx].lw; /* the new window */
if(!nw) {
cxInit(cx);
nw = sessionList[cx].lw;
- created = true;
+ created = eb_true;
} else {
saveSubstitutionStrings();
restoreSubstitutionStrings(nw);
@@ -653,7 +653,7 @@ cxSwitch(int cx, bool interactive)
if(cw) {
freeUndoLines(cw->map);
- cw->firstOpMode = false;
+ cw->firstOpMode = eb_false;
}
cw = nw;
cs = sessionList + cx;
@@ -687,13 +687,13 @@ linesReset(void)
textLinesCount = textLinesMax = 0;
} /* linesReset */
-bool
+eb_bool
linesComing(int n)
{
int need = textLinesCount + n;
if(need > LNMAX) {
setError(MSG_LineLimit);
- return false;
+ return eb_false;
}
if(need > textLinesMax) {
int newmax = textLinesMax * 3 / 2;
@@ -712,18 +712,18 @@ linesComing(int n)
/* overflow requires realloc */
/* We now have room for n new lines, but you have to add n
* to textLines Count, once you have brought in the lines. */
- return true;
+ return eb_true;
} /* linesComing */
/* This function is called for web redirection, by the refresh command,
* or by window.location = new_url. */
static char *newlocation;
static int newloc_d; /* possible delay */
-static bool newloc_rf; /* refresh the buffer */
-bool js_redirects;
+static eb_bool newloc_rf; /* refresh the buffer */
+eb_bool js_redirects;
void
-gotoLocation(char *url, int delay, bool rf)
+gotoLocation(char *url, int delay, eb_bool rf)
{
if(newlocation && delay >= newloc_d) {
nzFree(url);
@@ -734,7 +734,7 @@ gotoLocation(char *url, int delay, bool rf)
newloc_d = delay;
newloc_rf = rf;
if(!delay)
- js_redirects = true;
+ js_redirects = eb_true;
} /* gotoLocation */
/* Adjust the map of line numbers -- we have inserted text.
@@ -776,14 +776,14 @@ addToMap(int start, int end, int destl)
strcat(newmap, cw->map + j);
nzFree(cw->map);
cw->map = newmap;
- cw->firstOpMode = undoable = true;
+ cw->firstOpMode = undoable = eb_true;
if(!cw->browseMode)
- cw->changeMode = true;
+ cw->changeMode = eb_true;
} /* addToMap */
/* Add a block of text into the buffer; uses addToMap(). */
-bool
-addTextToBuffer(const pst inbuf, int length, int destl, bool onside)
+eb_bool
+addTextToBuffer(const pst inbuf, int length, int destl, eb_bool onside)
{
int i, j, linecount = 0;
int start, end;
@@ -791,14 +791,14 @@ addTextToBuffer(const pst inbuf, int length, int destl, bool onside)
if(inbuf[i] == '\n')
++linecount;
if(!linesComing(linecount + 1))
- return false;
+ return eb_false;
if(destl == cw->dol)
- cw->nlMode = false;
+ cw->nlMode = eb_false;
if(inbuf[length - 1] != '\n') {
/* doesn't end in newline */
++linecount; /* last line wasn't counted */
if(destl == cw->dol) {
- cw->nlMode = true;
+ cw->nlMode = eb_true;
if(cmd != 'b' && !cw->binMode && !ismc && !onside)
i_puts(MSG_NoTrailing);
}
@@ -823,12 +823,12 @@ addTextToBuffer(const pst inbuf, int length, int destl, bool onside)
} /* loop breaking inbuf into lines */
textLinesCount = end;
addToMap(start, end, destl);
- return true;
+ return eb_true;
} /* addTextToBuffer */
/* Pass input lines straight into the buffer, until the user enters . */
-static bool
+static eb_bool
inputLinesIntoBuffer(void)
{
int start = textLinesCount;
@@ -840,7 +840,7 @@ inputLinesIntoBuffer(void)
line = inputLine();
while(line[0] != '.' || line[1] != '\n') {
if(!linesComing(1))
- return false;
+ return eb_false;
textLines[end++] = clonePstring(line);
line = inputLine();
}
@@ -848,13 +848,13 @@ inputLinesIntoBuffer(void)
cw->dot = endRange;
if(!cw->dot && cw->dol)
cw->dot = 1;
- return true;
+ return eb_true;
}
if(endRange == cw->dol)
- cw->nlMode = false;
+ cw->nlMode = eb_false;
textLinesCount = end;
addToMap(start, end, endRange);
- return true;
+ return eb_true;
} /* inputLinesIntoBuffer */
/* Delete a block of text. */
@@ -864,7 +864,7 @@ delText(int start, int end)
{
int i, j;
if(end == cw->dol)
- cw->nlMode = false;
+ cw->nlMode = eb_false;
j = end - start + 1;
strmove(cw->map + start * LNWIDTH, cw->map + (end + 1) * LNWIDTH);
/* move the labels */
@@ -887,9 +887,9 @@ delText(int start, int end)
free(cw->map);
cw->map = 0;
}
- cw->firstOpMode = undoable = true;
+ cw->firstOpMode = undoable = eb_true;
if(!cw->browseMode)
- cw->changeMode = true;
+ cw->changeMode = eb_true;
} /* delText */
/* Delete files from a directory as you delete lines.
@@ -908,19 +908,19 @@ makeAbsPath(char *f)
return path;
} /* makeAbsPath */
-static bool
+static eb_bool
delFiles(void)
{
int ln, cnt;
if(!dirWrite) {
setError(MSG_DirNoWrite);
- return false;
+ return eb_false;
}
if(dirWrite == 1 && !recycleBin) {
setError(MSG_NoRecycle);
- return false;
+ return eb_false;
}
ln = startRange;
@@ -935,14 +935,14 @@ delFiles(void)
path = makeAbsPath(file);
if(!path) {
free(file);
- return false;
+ return eb_false;
}
ftype = dirSuffix(ln);
if(dirWrite == 2 && *ftype == '/') {
setError(MSG_NoDirDelete);
free(file);
- return false;
+ return eb_false;
}
if(dirWrite == 2 || *ftype && strchr("@<*^|", *ftype)) {
@@ -950,7 +950,7 @@ delFiles(void)
if(unlink(path)) {
setError(MSG_NoRemove, file);
free(file);
- return false;
+ return eb_false;
}
} else {
char bin[ABSPATH];
@@ -962,17 +962,17 @@ delFiles(void)
if(*ftype == '/') {
setError(MSG_CopyMoveDir);
free(file);
- return false;
+ return eb_false;
}
if(!fileIntoMemory(path, &rmbuf, &rmlen)) {
free(file);
- return false;
+ return eb_false;
}
if(!memoryOutToFile(bin, rmbuf, rmlen,
MSG_TempNoCreate2, MSG_NoWrite2)) {
free(file);
nzFree(rmbuf);
- return false;
+ return eb_false;
}
nzFree(rmbuf);
goto unlink;
@@ -980,7 +980,7 @@ delFiles(void)
setError(MSG_NoMoveToTrash, file);
free(file);
- return false;
+ return eb_false;
}
}
@@ -988,12 +988,12 @@ delFiles(void)
delText(ln, ln);
}
- return true;
+ return eb_true;
} /* delFiles */
/* Move or copy a block of text. */
/* Uses range variables, hence no parameters. */
-static bool
+static eb_bool
moveCopy(void)
{
int sr = startRange;
@@ -1009,25 +1009,25 @@ moveCopy(void)
if(dl > sr && dl < er) {
setError(MSG_DestInBlock);
- return false;
+ return eb_false;
}
if(cmd == 'm' && (dl == er || dl == sr)) {
if(globSub)
setError(MSG_NoChange);
- return false;
+ return eb_false;
}
if(cmd == 't') {
if(!linesComing(n_lines))
- return false;
+ return eb_false;
for(i = sr; i < er; ++i)
textLines[textLinesCount++] = fetchLine(i, 0);
addToMap(textLinesCount - n_lines, textLinesCount, destLine);
- return true;
+ return eb_true;
}
/* copy */
if(destLine == cw->dol || endRange == cw->dol)
- cw->nlMode = false;
+ cw->nlMode = eb_false;
/* All we really need do is rearrange the map. */
newmap = allocMem((cw->dol + 1) * LNWIDTH + 1);
strcpy(newmap, map);
@@ -1067,24 +1067,24 @@ moveCopy(void)
cw->dot = endRange;
cw->dot += (dl < sr ? -diff : diff);
- cw->firstOpMode = undoable = true;
+ cw->firstOpMode = undoable = eb_true;
if(!cw->browseMode)
- cw->changeMode = true;
- return true;
+ cw->changeMode = eb_true;
+ return eb_true;
} /* moveCopy */
/* Join lines from startRange to endRange. */
-static bool
+static eb_bool
joinText(void)
{
int j, size;
pst newline, t;
if(startRange == endRange) {
setError(MSG_Join1);
- return false;
+ return eb_false;
}
if(!linesComing(1))
- return false;
+ return eb_false;
size = 0;
for(j = startRange; j <= endRange; ++j)
size += pstLength(fetchLine(j, -1));
@@ -1105,19 +1105,19 @@ joinText(void)
++textLinesCount;
delText(startRange + 1, endRange);
cw->dot = startRange;
- return true;
+ return eb_true;
} /* joinText */
/* Read a file, or url, into the current buffer.
* Post/get data is passed, via the second parameter, if it's a URL. */
-bool
+eb_bool
readFile(const char *filename, const char *post)
{
char *rbuf; /* read buffer */
int readSize; /* should agree with fileSize */
int fh; /* file handle */
- bool rc; /* return code */
- bool is8859, isutf8;
+ eb_bool rc; /* return code */
+ eb_bool is8859, isutf8;
char *nopound;
char filetype;
@@ -1128,7 +1128,7 @@ char filetype;
filename += 7;
if(!*filename) {
setError(MSG_MissingFileName);
- return false;
+ return eb_false;
}
goto fromdisk;
}
@@ -1136,10 +1136,10 @@ char filetype;
if(isURL(filename)) {
const char *domain = getHostURL(filename);
if(!domain)
- return false; /* some kind of error */
+ return eb_false; /* some kind of error */
if(!*domain) {
setError(MSG_DomainEmpty);
- return false;
+ return eb_false;
}
rc = httpConnect(0, filename);
@@ -1148,7 +1148,7 @@ char filetype;
/* The error could have occured after redirection */
nzFree(changeFileName);
changeFileName = 0;
- return false;
+ return eb_false;
}
/* We got some data. Any warnings along the way have been printed,
@@ -1159,7 +1159,7 @@ char filetype;
if(fileSize == 0) { /* empty file */
nzFree(rbuf);
cw->dot = endRange;
- return true;
+ return eb_true;
}
goto gotdata;
@@ -1169,34 +1169,34 @@ char filetype;
const char *t1, *t2;
if(!cw->sqlMode) {
setError(MSG_DBOtherFile);
- return false;
+ return eb_false;
}
t1 = strchr(cw->fileName, ']');
t2 = strchr(filename, ']');
if(t1 - cw->fileName != t2 - filename ||
memcmp(cw->fileName, filename, t2 - filename)) {
setError(MSG_DBOtherTable);
- return false;
+ return eb_false;
}
rc = sqlReadRows(filename, &rbuf);
if(!rc) {
nzFree(rbuf);
if(!cw->dol && cmd != 'r') {
- cw->sqlMode = false;
+ cw->sqlMode = eb_false;
nzFree(cw->fileName);
cw->fileName = 0;
}
- return false;
+ return eb_false;
}
serverData = rbuf;
fileSize = strlen(rbuf);
if(rbuf == EMPTYSTRING)
- return true;
+ return eb_true;
goto intext;
}
fromdisk:
- filetype = fileTypeByName(filename, false);
+ filetype = fileTypeByName(filename, eb_false);
/* reading a file from disk */
fileSize = 0;
if(filetype == 'd') {
@@ -1210,15 +1210,15 @@ char filetype;
/* Understand that the empty string now means / */
/* get the files, or fail if there is a problem */
if(!sortedDirList(filename, &start, &end))
- return false;
+ return eb_false;
if(!cw->dol) {
- cw->dirMode = true;
+ cw->dirMode = eb_true;
i_puts(MSG_DirMode);
}
if(start == end) { /* empty directory */
cw->dot = endRange;
fileSize = 0;
- return true;
+ return eb_true;
}
addToMap(start, end, endRange);
@@ -1239,7 +1239,7 @@ char filetype;
fileSize += len + 1;
if(!abspath)
continue; /* should never happen */
- ftype = fileTypeByName(abspath, true);
+ ftype = fileTypeByName(abspath, eb_true);
if(!ftype)
continue;
s = cw->map + (endRange + 1 + j - start) * LNWIDTH + LNDIR;
@@ -1270,7 +1270,7 @@ char filetype;
*s++ = c;
++fileSize;
} /* loop fixing files in the directory scan */
- return true;
+ return eb_true;
}
nopound = cloneString(filename);
@@ -1280,12 +1280,12 @@ char filetype;
rc = fileIntoMemory(nopound, &rbuf, &fileSize);
nzFree(nopound);
if(!rc)
- return false;
+ return eb_false;
serverData = rbuf;
if(fileSize == 0) { /* empty file */
free(rbuf);
cw->dot = endRange;
- return true;
+ return eb_true;
}
/* empty */
gotdata:
@@ -1324,30 +1324,30 @@ char filetype;
}
if(!cw->dol) {
if(isutf8) {
- cw->utf8Mode = true;
+ cw->utf8Mode = eb_true;
debugPrint(3, "setting utf8 mode");
}
if(is8859) {
- cw->iso8859Mode = true;
+ cw->iso8859Mode = eb_true;
debugPrint(3, "setting 8859 mode");
}
}
}
} else if(binaryDetect & !cw->binMode) {
i_puts(MSG_BinaryData);
- cw->binMode = true;
+ cw->binMode = eb_true;
}
intext:
- rc = addTextToBuffer((const pst)rbuf, fileSize, endRange, false);
+ rc = addTextToBuffer((const pst)rbuf, fileSize, endRange, eb_false);
free(rbuf);
if(cw->sqlMode)
- undoable = false;
+ undoable = eb_false;
return rc;
} /* readFile */
/* Write a range to a file. */
-static bool
+static eb_bool
writeFile(const char *name, int mode)
{
int i;
@@ -1360,22 +1360,22 @@ writeFile(const char *name, int mode)
if(!*name) {
setError(MSG_MissingFileName);
- return false;
+ return eb_false;
}
if(isURL(name)) {
setError(MSG_NoWriteURL);
- return false;
+ return eb_false;
}
if(isSQL(name)) {
setError(MSG_WriteDB);
- return false;
+ return eb_false;
}
if(!cw->dol) {
setError(MSG_WriteEmpty);
- return false;
+ return eb_false;
}
/* mode should be TRUNC or APPEND */
@@ -1392,7 +1392,7 @@ writeFile(const char *name, int mode)
if(fh == NULL) {
setError(MSG_NoCreate2, name);
- return false;
+ return eb_false;
}
if(name == cw->fileName && iuConvert) {
@@ -1412,8 +1412,8 @@ writeFile(const char *name, int mode)
char *suf = dirSuffix(i);
char *tp;
int tlen;
- bool alloc_p = cw->browseMode;
- bool rc = true;
+ eb_bool alloc_p = cw->browseMode;
+ eb_bool rc = eb_true;
if(!suf[0]) {
if(i == cw->dol && cw->nlMode)
@@ -1424,10 +1424,10 @@ writeFile(const char *name, int mode)
utf2iso((char *)p, len, &tp, &tlen);
if(alloc_p)
free(p);
- alloc_p = true;
+ alloc_p = eb_true;
p = (pst) tp;
if(fwrite(p, 1, tlen, fh) < tlen)
- rc = false;
+ rc = eb_false;
goto endline;
}
@@ -1435,16 +1435,16 @@ writeFile(const char *name, int mode)
iso2utf((char *)p, len, &tp, &tlen);
if(alloc_p)
free(p);
- alloc_p = true;
+ alloc_p = eb_true;
p = (pst) tp;
if(fwrite(p, 1, tlen, fh) < tlen)
- rc = false;
+ rc = eb_false;
goto endline;
}
}
if(fwrite(p, 1, len, fh) < len)
- rc = false;
+ rc = eb_false;
goto endline;
}
@@ -1452,7 +1452,7 @@ writeFile(const char *name, int mode)
--len;
if(fwrite(p, 1, len, fh) < len) {
badwrite:
- rc = false;
+ rc = eb_false;
goto endline;
}
fileSize += len;
@@ -1467,7 +1467,7 @@ writeFile(const char *name, int mode)
if(!rc) {
setError(MSG_NoWrite2, name);
fclose(fh);
- return false;
+ return eb_false;
}
fileSize += len;
} /* loop over lines */
@@ -1476,28 +1476,28 @@ writeFile(const char *name, int mode)
/* This is not an undoable operation, nor does it change data.
* In fact the data is "no longer modified" if we have written all of it. */
if(startRange == 1 && endRange == cw->dol)
- cw->changeMode = false;
- return true;
+ cw->changeMode = eb_false;
+ return eb_true;
} /* writeFile */
-static bool
+static eb_bool
readContext(int cx)
{
struct ebWindow *lw;
int i, start, end, fardol;
if(!cxCompare(cx))
- return false;
+ return eb_false;
if(!cxActive(cx))
- return false;
+ return eb_false;
fileSize = 0;
lw = sessionList[cx].lw;
fardol = lw->dol;
if(!fardol)
- return true;
+ return eb_true;
if(!linesComing(fardol))
- return false;
+ return eb_false;
if(cw->dol == endRange)
- cw->nlMode = false;
+ cw->nlMode = eb_false;
start = end = textLinesCount;
for(i = 1; i <= fardol; ++i) {
pst p = fetchLineContext(i, (lw->dirMode ? -1 : 1), cx);
@@ -1521,16 +1521,16 @@ readContext(int cx)
if(lw->nlMode) {
--fileSize;
if(cw->dol == endRange)
- cw->nlMode = true;
+ cw->nlMode = eb_true;
}
if(binaryDetect & !cw->binMode && lw->binMode) {
- cw->binMode = true;
+ cw->binMode = eb_true;
i_puts(MSG_BinaryData);
}
- return true;
+ return eb_true;
} /* readContext */
-static bool
+static eb_bool
writeContext(int cx)
{
struct ebWindow *lw;
@@ -1541,11 +1541,11 @@ writeContext(int cx)
if(!startRange)
fardol = 0;
if(!linesComing(fardol))
- return false;
+ return eb_false;
if(!cxCompare(cx))
- return false;
+ return eb_false;
if(cxActive(cx) && !cxQuit(cx, 2))
- return false;
+ return eb_false;
cxInit(cx);
lw = sessionList[cx].lw;
@@ -1574,13 +1574,13 @@ writeContext(int cx)
lw->map = newmap;
lw->binMode = cw->binMode;
if(cw->nlMode && endRange == cw->dol) {
- lw->nlMode = true;
+ lw->nlMode = eb_true;
--fileSize;
}
} /* nonempty range */
lw->dot = lw->dol = fardol;
- return true;
+ return eb_true;
} /* writeContext */
static void
@@ -1597,7 +1597,7 @@ debrowseSuffix(char *s)
}
} /* debrowseSuffix */
-static bool
+static eb_bool
shellEscape(const char *line)
{
char *newline, *s;
@@ -1618,7 +1618,7 @@ shellEscape(const char *line)
/* interactive shell */
if(!isInteractive) {
setError(MSG_SessionBackground);
- return false;
+ return eb_false;
}
/* Ignoring of SIGPIPE propagates across fork-exec. */
/* So stop ignoring it for the duration of system(). */
@@ -1631,7 +1631,7 @@ shellEscape(const char *line)
#endif
signal(SIGPIPE, SIG_IGN);
i_puts(MSG_OK);
- return true;
+ return eb_true;
}
/* Make substitutions within the command line. */
@@ -1666,7 +1666,7 @@ shellEscape(const char *line)
++n;
if(n > cw->dol || n == 0) {
setError(MSG_OutOfRange, key);
- return false;
+ return eb_false;
}
frombuf:
++t;
@@ -1678,7 +1678,7 @@ shellEscape(const char *line)
if(perl2c((char *)p)) {
free(p);
setError(MSG_ShellNull);
- return false;
+ return eb_false;
}
strcpy(s, (char *)p);
s += strlen(s);
@@ -1691,7 +1691,7 @@ shellEscape(const char *line)
n = cw->labels[key - 'a'];
if(!n) {
setError(MSG_NoLabel, key);
- return false;
+ return eb_false;
}
goto frombuf;
}
@@ -1717,7 +1717,7 @@ shellEscape(const char *line)
signal(SIGPIPE, SIG_IGN);
i_puts(MSG_OK);
free(newline);
- return true;
+ return eb_true;
} /* shellEscape */
/* Valid delimiters for search/substitute.
@@ -1734,8 +1734,8 @@ static const char valid_laddr[] = "0123456789-'.$+/?";
* A pointer to the second delimiter is returned, along with the
* (possibly reformatted) regular expression. */
-static bool
-regexpCheck(const char *line, bool isleft, bool ebmuck,
+static eb_bool
+regexpCheck(const char *line, eb_bool isleft, eb_bool ebmuck,
char **rexp, const char **split)
{ /* result parameters */
static char re[MAXRE + 20];
@@ -1743,9 +1743,9 @@ regexpCheck(const char *line, bool isleft, bool ebmuck,
char *e = re;
char c, d;
/* Remember whether a char is "on deck", ready to be modified by * etc. */
- bool ondeck = false;
- bool was_ques = true; /* previous modifier was ? */
- bool cc = false; /* are we in a [...] character class */
+ eb_bool ondeck = eb_false;
+ eb_bool was_ques = eb_true; /* previous modifier was ? */
+ eb_bool cc = eb_false; /* are we in a [...] character class */
int mod; /* length of modifier */
int paren = 0; /* nesting level of parentheses */
/* We wouldn't be here if the line was empty. */
@@ -1754,7 +1754,7 @@ regexpCheck(const char *line, bool isleft, bool ebmuck,
*rexp = re;
if(!strchr(valid_delim, delim)) {
setError(MSG_BadDelimit);
- return false;
+ return eb_false;
}
start = line;
@@ -1764,34 +1764,34 @@ regexpCheck(const char *line, bool isleft, bool ebmuck,
if(c == delim || c == 0) {
if(!cw->lhs_yes) {
setError(MSG_NoSearchString);
- return false;
+ return eb_false;
}
strcpy(re, cw->lhs);
*split = line;
- return true;
+ return eb_true;
}
/* Interpret lead * or lone [ as literal */
if(strchr("*?+", c) || c == '[' && !line[1]) {
*e++ = '\\';
*e++ = c;
++line;
- ondeck = true;
+ ondeck = eb_true;
}
} else if(c == '%' && (line[1] == delim || line[1] == 0)) {
if(!cw->rhs_yes) {
setError(MSG_NoReplaceString);
- return false;
+ return eb_false;
}
strcpy(re, cw->rhs);
*split = line + 1;
- return true;
+ return eb_true;
}
}
/* ebmuck tricks */
while(c = *line) {
if(e >= re + MAXRE - 3) {
setError(MSG_RexpLong);
- return false;
+ return eb_false;
}
d = line[1];
@@ -1799,22 +1799,22 @@ regexpCheck(const char *line, bool isleft, bool ebmuck,
line += 2;
if(d == 0) {
setError(MSG_LineBackslash);
- return false;
+ return eb_false;
}
- ondeck = true;
- was_ques = false;
+ ondeck = eb_true;
+ was_ques = eb_false;
/* I can't think of any reason to remove the escaping \ from any character,
* except ()|, where we reverse the sense of escape. */
if(ebmuck && isleft && !cc && (d == '(' || d == ')' || d == '|')) {
if(d == '|')
- ondeck = false, was_ques = true;
+ ondeck = eb_false, was_ques = eb_true;
if(d == '(')
- ++paren, ondeck = false, was_ques = false;
+ ++paren, ondeck = eb_false, was_ques = eb_false;
if(d == ')')
--paren;
if(paren < 0) {
setError(MSG_UnexpectedRight);
- return false;
+ return eb_false;
}
*e++ = d;
continue;
@@ -1847,7 +1847,7 @@ regexpCheck(const char *line, bool isleft, bool ebmuck,
if(c == '$' && !isleft && isdigitByte(d)) {
if(d == '0' || isdigitByte(line[2])) {
setError(MSG_RexpDollar);
- return false;
+ return eb_false;
}
}
/* dollar digit on the right */
@@ -1868,11 +1868,11 @@ regexpCheck(const char *line, bool isleft, bool ebmuck,
if(cc) { /* character class */
if(c == ']')
- cc = false;
+ cc = eb_false;
continue;
}
if(c == '[')
- cc = true;
+ cc = eb_true;
/* Skip all these checks for javascript,
* it probably has the expression right anyways. */
@@ -1882,8 +1882,8 @@ regexpCheck(const char *line, bool isleft, bool ebmuck,
/* Modifiers must have a preceding character.
* Except ? which can reduce the greediness of the others. */
if(c == '?' && !was_ques) {
- ondeck = false;
- was_ques = true;
+ ondeck = eb_false;
+ was_ques = eb_true;
continue;
}
@@ -1911,14 +1911,14 @@ regexpCheck(const char *line, bool isleft, bool ebmuck,
if(!ondeck) {
*e = 0;
setError(MSG_RexpModifier, e - mod - 1);
- return false;
+ return eb_false;
}
- ondeck = false;
+ ondeck = eb_false;
continue;
}
/* modifier */
- ondeck = true;
- was_ques = false;
+ ondeck = eb_true;
+ was_ques = eb_false;
} /* loop over chars in the pattern */
*e = 0;
@@ -1927,35 +1927,35 @@ regexpCheck(const char *line, bool isleft, bool ebmuck,
if(ebmuck) {
if(cc) {
setError(MSG_NoBracket);
- return false;
+ return eb_false;
}
if(paren) {
setError(MSG_NoParen);
- return false;
+ return eb_false;
}
if(isleft) {
- cw->lhs_yes = true;
+ cw->lhs_yes = eb_true;
strcpy(cw->lhs, re);
} else {
- cw->rhs_yes = true;
+ cw->rhs_yes = eb_true;
strcpy(cw->rhs, re);
}
}
debugPrint(7, "%s regexp %s", (isleft ? "search" : "replace"), re);
- return true;
+ return eb_true;
} /* regexpCheck */
/* regexp variables */
static int re_count;
static int re_vector[11 * 3];
static pcre *re_cc; /* compiled */
-static bool re_utf8 = true;
+static eb_bool re_utf8 = eb_true;
static void
-regexpCompile(const char *re, bool ci)
+regexpCompile(const char *re, eb_bool ci)
{
static char try8 = 0; /* 1 is utf8 on, -1 is utf8 off */
const char *re_error;
@@ -1998,7 +1998,7 @@ regexpCompile(const char *re, bool ci)
/* Get the start or end of a range.
* Pass the line containing the address. */
-static bool
+static eb_bool
getRangePart(const char *line, int *lineno, const char **split)
{ /* result parameters */
int ln = cw->dot; /* this is where we start */
@@ -2016,36 +2016,36 @@ getRangePart(const char *line, int *lineno, const char **split)
ln = cw->labels[line[1] - 'a'];
if(!ln) {
setError(MSG_NoLabel, line[1]);
- return false;
+ return eb_false;
}
line += 2;
} else if(first == '/' || first == '?') {
char *re; /* regular expression */
- bool ci = caseInsensitive;
+ eb_bool ci = caseInsensitive;
char incr; /* forward or back */
/* Don't look through an empty buffer. */
if(cw->dol == 0) {
setError(MSG_EmptyBuffer);
- return false;
+ return eb_false;
}
- if(!regexpCheck(line, true, true, &re, &line))
- return false;
+ if(!regexpCheck(line, eb_true, eb_true, &re, &line))
+ return eb_false;
if(*line == first) {
++line;
if(*line == 'i')
- ci = true, ++line;
+ ci = eb_true, ++line;
}
/* second delimiter */
regexpCompile(re, ci);
if(!re_cc)
- return false;
+ return eb_false;
/* We should probably study the pattern, if the file is large.
* But then again, it's probably not worth it,
* since the expressions are simple, and the lines are short. */
incr = (first == '/' ? 1 : -1);
- while(true) {
+ while(eb_true) {
char *subject;
ln += incr;
if(ln > cw->dol)
@@ -2060,14 +2060,14 @@ getRangePart(const char *line, int *lineno, const char **split)
if(re_count < -1) {
pcre_free(re_cc);
setError(MSG_RexpError2, ln);
- return (globSub = false);
+ return (globSub = eb_false);
}
if(re_count >= 0)
break;
if(ln == cw->dot) {
pcre_free(re_cc);
setError(MSG_NotFound);
- return false;
+ return eb_false;
}
} /* loop over lines */
pcre_free(re_cc);
@@ -2086,27 +2086,27 @@ getRangePart(const char *line, int *lineno, const char **split)
if(ln > cw->dol) {
setError(MSG_LineHigh);
- return false;
+ return eb_false;
}
if(ln < 0) {
setError(MSG_LineLow);
- return false;
+ return eb_false;
}
*lineno = ln;
*split = line;
- return true;
+ return eb_true;
} /* getRangePart */
/* Apply a regular expression to each line, and then execute
* a command for each matching, or nonmatching, line.
* This is the global feature, g/re/p, which gives us the word grep. */
-static bool
+static eb_bool
doGlobal(const char *line)
{
int gcnt = 0; /* global count */
- bool ci = caseInsensitive;
- bool change;
+ eb_bool ci = caseInsensitive;
+ eb_bool change;
char delim = *line;
char *t;
char *re; /* regular expression */
@@ -2114,18 +2114,18 @@ doGlobal(const char *line)
if(!delim) {
setError(MSG_RexpMissing, icmd);
- return false;
+ return eb_false;
}
- if(!regexpCheck(line, true, true, &re, &line))
- return false;
+ if(!regexpCheck(line, eb_true, eb_true, &re, &line))
+ return eb_false;
if(*line != delim) {
setError(MSG_NoDelimit);
- return false;
+ return eb_false;
}
++line;
if(*line == 'i')
- ++line, ci = true;
+ ++line, ci = eb_true;
skipWhite(&line);
/* clean up any previous stars */
@@ -2135,7 +2135,7 @@ doGlobal(const char *line)
/* Find the lines that match the pattern. */
regexpCompile(re, ci);
if(!re_cc)
- return false;
+ return eb_false;
for(i = startRange; i <= endRange; ++i) {
char *subject = (char *)fetchLine(i, 1);
re_count =
@@ -2145,7 +2145,7 @@ doGlobal(const char *line)
if(re_count < -1) {
pcre_free(re_cc);
setError(MSG_RexpError2, i);
- return false;
+ return eb_false;
}
if(re_count < 0 && cmd == 'v' || re_count >= 0 && cmd == 'g') {
++gcnt;
@@ -2156,26 +2156,26 @@ doGlobal(const char *line)
if(!gcnt) {
setError((cmd == 'v') + MSG_NoMatchG);
- return false;
+ return eb_false;
}
/* apply the subcommand to every line with a star */
- globSub = true;
+ globSub = eb_true;
setError(-1);
if(!*line)
line = "p";
origdot = cw->dot;
yesdot = nodot = 0;
- change = true;
+ change = eb_true;
while(gcnt && change) {
- change = false; /* kinda like bubble sort */
+ change = eb_false; /* kinda like bubble sort */
for(i = 1; i <= cw->dol; ++i) {
t = cw->map + i * LNWIDTH + LNGLOB;
if(*t != '*')
continue;
if(intFlag)
goto done;
- change = true, --gcnt;
+ change = eb_true, --gcnt;
*t = ' ';
cw->dot = i; /* so we can run the command at this line */
if(runCommand(line)) {
@@ -2194,7 +2194,7 @@ doGlobal(const char *line)
} /* loop making changes */
done:
- globSub = false;
+ globSub = eb_false;
/* yesdot could be 0, even on success, if all lines are deleted via g/re/d */
if(yesdot || !cw->dol) {
cw->dot = yesdot;
@@ -2240,7 +2240,7 @@ static char *replaceLineEnd;
static int replaceLineLen;
static int
replaceText(const char *line, int len, const char *rhs,
- bool ebmuck, int nth, bool global, int ln)
+ eb_bool ebmuck, int nth, eb_bool global, int ln)
{
int offset = 0, lastoffset, instance = 0;
int span;
@@ -2249,7 +2249,7 @@ replaceText(const char *line, int len, const char *rhs,
const char *s = line, *s_end, *t;
char c, d;
- while(true) {
+ while(eb_true) {
/* find the next match */
re_count = pcre_exec(re_cc, 0, line, len, offset, 0, re_vector, 33);
if(re_count < -1) {
@@ -2376,9 +2376,9 @@ replaceText(const char *line, int len, const char *rhs,
} /* loop matching the regular expression */
if(!instance)
- return false;
+ return eb_false;
if(!global &&instance < nth)
- return false;
+ return eb_false;
/* We got a match, copy the last span. */
s_end = line + len;
@@ -2389,7 +2389,7 @@ replaceText(const char *line, int len, const char *rhs,
r += span;
replaceLineEnd = r;
replaceLineLen = r - replaceLine;
- return true;
+ return eb_true;
longvar:
setError(MSG_SubLong, REPLACELINELEN);
@@ -2401,7 +2401,7 @@ replaceText(const char *line, int len, const char *rhs,
* If so, we'll call infReplace().
* Also, we might be indirectory mode, whence we must rename the file.
* This is a complicated function!
- * The return can be true or false, with the usual meaning,
+ * The return can be eb_true or eb_false, with the usual meaning,
* but also a return of -1, which is failure,
* and an indication that we need to abort any g// in progress.
* It's a serious problem. */
@@ -2410,10 +2410,10 @@ static int
substituteText(const char *line)
{
int whichField = 0;
- bool bl_mode = false; /* running the bl command */
- bool g_mode = false; /* s/x/y/g */
- bool ci = caseInsensitive;
- bool save_nlMode;
+ eb_bool bl_mode = eb_false; /* running the bl command */
+ eb_bool g_mode = eb_false; /* s/x/y/g */
+ eb_bool ci = caseInsensitive;
+ eb_bool save_nlMode;
char c, *s, *t;
int nth = 0; /* s/x/y/7 */
int lastSubst = 0; /* last successful substitution */
@@ -2425,7 +2425,7 @@ substituteText(const char *line)
subPrint = 1; /* default is to print the last line substituted */
re_cc = 0;
if(stringEqual(line, "`bl"))
- bl_mode = true, breakLineSetup();
+ bl_mode = eb_true, breakLineSetup();
if(!bl_mode) {
/* watch for s2/x/y/ for the second input field */
@@ -2441,14 +2441,14 @@ substituteText(const char *line)
return -1;
}
- if(!regexpCheck(line, true, true, &re, &line))
+ if(!regexpCheck(line, eb_true, eb_true, &re, &line))
return -1;
strcpy(lhs, re);
if(!*line) {
setError(MSG_NoDelimit);
return -1;
}
- if(!regexpCheck(line, false, true, &re, &line))
+ if(!regexpCheck(line, eb_false, eb_true, &re, &line))
return -1;
strcpy(rhs, re);
@@ -2457,12 +2457,12 @@ substituteText(const char *line)
subPrint = 0;
while(c = *line) {
if(c == 'g') {
- g_mode = true;
+ g_mode = eb_true;
++line;
continue;
}
if(c == 'i') {
- ci = true;
+ ci = eb_true;
++line;
continue;
}
@@ -2542,9 +2542,9 @@ substituteText(const char *line)
t = strstr(s, searchend);
if(!t)
continue;
- j = replaceText(s, t - s, rhs, true, nth, g_mode, ln);
+ j = replaceText(s, t - s, rhs, eb_true, nth, g_mode, ln);
} else {
- j = replaceText(p, len - 1, rhs, true, nth, g_mode, ln);
+ j = replaceText(p, len - 1, rhs, eb_true, nth, g_mode, ln);
}
if(j < 0)
goto abort;
@@ -2599,7 +2599,7 @@ substituteText(const char *line)
if(!dest)
goto abort;
if(!stringEqual(src, dest)) {
- if(fileTypeByName(dest, true)) {
+ if(fileTypeByName(dest, eb_true)) {
setError(MSG_DestFileExists);
goto abort;
}
@@ -2640,7 +2640,7 @@ substituteText(const char *line)
save_nlMode = cw->nlMode;
delText(ln, ln);
addTextToBuffer((pst) replaceLine, replaceLineLen + 1, ln - 1,
- false);
+ eb_false);
cw->nlMode = save_nlMode;
endRange += linecount;
ln += linecount;
@@ -2657,9 +2657,9 @@ substituteText(const char *line)
if(subPrint == 2)
displayLine(ln);
lastSubst = ln;
- cw->firstOpMode = undoable = true;
+ cw->firstOpMode = undoable = eb_true;
if(!cw->browseMode)
- cw->changeMode = true;
+ cw->changeMode = eb_true;
} /* loop over lines in the range */
if(re_cc)
pcre_free(re_cc);
@@ -2674,12 +2674,12 @@ substituteText(const char *line)
if(!errorMsg[0])
setError(bl_mode + MSG_NoMatch);
}
- return false;
+ return eb_false;
}
cw->dot = lastSubst;
if(subPrint == 1 && !globSub)
printDot();
- return true;
+ return eb_true;
abort:
if(re_cc)
@@ -2704,7 +2704,7 @@ twoLetter(const char *line, const char **runThis)
{
static char shortline[60];
char c;
- bool rc, ub;
+ eb_bool rc, ub;
int i, n;
*runThis = shortline;
@@ -2718,7 +2718,7 @@ twoLetter(const char *line, const char **runThis)
curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, 1);
else
curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, 0);
- return true;
+ return eb_true;
}
if(line[0] == 'u' && line[1] == 'a' && isdigitByte(line[2]) && !line[3]) {
@@ -2726,13 +2726,13 @@ twoLetter(const char *line, const char **runThis)
cmd = 'e';
if(!t) {
setError(MSG_NoAgent, line[2]);
- return false;
+ return eb_false;
}
currentAgent = t;
curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, currentAgent);
if(helpMessagesOn || debugLevel >= 1)
puts(currentAgent);
- return true;
+ return eb_true;
}
if(stringEqual(line, "re") || stringEqual(line, "rea")) {
@@ -2740,14 +2740,14 @@ twoLetter(const char *line, const char **runThis)
undoWindow.map = 0;
nzFree(preWindow.map);
preWindow.map = 0;
- cw->firstOpMode = undoable = false;
+ cw->firstOpMode = undoable = eb_false;
cmd = 'e'; /* so error messages are printed */
rc = setupReply(line[2] == 'a');
- cw->firstOpMode = undoable = false;
+ cw->firstOpMode = undoable = eb_false;
if(rc && cw->browseMode) {
cw->iplist = 0;
- ub = false;
- cw->browseMode = false;
+ ub = eb_false;
+ cw->browseMode = eb_false;
goto et_go;
}
return rc;
@@ -2776,17 +2776,17 @@ twoLetter(const char *line, const char **runThis)
pwd:
if(!getcwd(cwdbuf, sizeof (cwdbuf))) {
setError(c ? MSG_CDGetError : MSG_CDSetError);
- return false;
+ return eb_false;
}
puts(cwdbuf);
- return true;
+ return eb_true;
}
if(!envFile(t, &t))
- return false;
+ return eb_false;
if(!chdir(t))
goto pwd;
setError(MSG_CDInvalid);
- return false;
+ return eb_false;
}
}
@@ -2796,22 +2796,22 @@ twoLetter(const char *line, const char **runThis)
const struct MIMETYPE *mt;
char *cmd;
const char *suffix = 0;
- bool trailPercent = false;
+ eb_bool trailPercent = eb_false;
if(!cw->dol) {
setError(MSG_AudioEmpty);
- return false;
+ return eb_false;
}
if(cw->browseMode) {
setError(MSG_AudioBrowse);
- return false;
+ return eb_false;
}
if(cw->dirMode) {
setError(MSG_AudioDir);
- return false;
+ return eb_false;
}
if(cw->sqlMode) {
setError(MSG_AudioDB);
- return false;
+ return eb_false;
}
if(c == '.') {
suffix = line + 3;
@@ -2820,21 +2820,21 @@ twoLetter(const char *line, const char **runThis)
suffix = strrchr(cw->fileName, '.');
if(!suffix) {
setError(MSG_NoSuffix);
- return false;
+ return eb_false;
}
++suffix;
}
if(strlen(suffix) > 5) {
setError(MSG_SuffixLong);
- return false;
+ return eb_false;
}
mt = findMimeBySuffix(suffix);
if(!mt) {
setError(MSG_SuffixBad, suffix);
- return false;
+ return eb_false;
}
if(mt->program[strlen(mt->program) - 1] == '%')
- trailPercent = true;
+ trailPercent = eb_true;
cmd = pluginCommand(mt, 0, suffix);
rc = bufferToProgram(cmd, suffix, trailPercent);
nzFree(cmd);
@@ -2846,11 +2846,11 @@ twoLetter(const char *line, const char **runThis)
cmd = 'e';
if(!cw->fileName) {
setError(MSG_NoRefresh);
- return false;
+ return eb_false;
}
if(cw->browseMode)
cmd = 'b';
- noStack = true;
+ noStack = eb_true;
allocatedLine = allocMem(strlen(cw->fileName) + 3);
sprintf(allocatedLine, "%c %s", cmd, cw->fileName);
debrowseSuffix(allocatedLine);
@@ -2861,41 +2861,41 @@ twoLetter(const char *line, const char **runThis)
if(stringEqual(line, "shc")) {
if(!cw->sqlMode) {
setError(MSG_NoDB);
- return false;
+ return eb_false;
}
showColumns();
- return true;
+ return eb_true;
}
if(stringEqual(line, "shf")) {
if(!cw->sqlMode) {
setError(MSG_NoDB);
- return false;
+ return eb_false;
}
showForeign();
- return true;
+ return eb_true;
}
if(stringEqual(line, "sht")) {
if(!ebConnect())
- return false;
+ return eb_false;
return showTables();
}
if(stringEqual(line, "ub") || stringEqual(line, "et")) {
ub = (line[0] == 'u');
- rc = true;
+ rc = eb_true;
cmd = 'e';
if(!cw->browseMode) {
setError(MSG_NoBrowse);
- return false;
+ return eb_false;
}
freeUndoLines(cw->map);
undoWindow.map = 0;
nzFree(preWindow.map);
preWindow.map = 0;
- cw->firstOpMode = undoable = false;
- cw->browseMode = false;
+ cw->firstOpMode = undoable = eb_false;
+ cw->browseMode = eb_false;
cw->iplist = 0;
if(ub) {
debrowseSuffix(cw->fileName);
@@ -2928,7 +2928,7 @@ twoLetter(const char *line, const char **runThis)
nzFree(cw->mailInfo);
cw->mailInfo = 0;
if(ub)
- fileSize = apparentSize(context, false);
+ fileSize = apparentSize(context, eb_false);
return rc;
}
@@ -2945,7 +2945,7 @@ twoLetter(const char *line, const char **runThis)
puts(tcp_ip_dots(ip));
}
}
- return true;
+ return eb_true;
}
if(stringEqual(line, "f/") || stringEqual(line, "w/")) {
@@ -2953,17 +2953,17 @@ twoLetter(const char *line, const char **runThis)
cmd = line[0];
if(!cw->fileName) {
setError(MSG_NoRefresh);
- return false;
+ return eb_false;
}
t = strrchr(cw->fileName, '/');
if(!t) {
setError(MSG_NoSlash);
- return false;
+ return eb_false;
}
++t;
if(!*t) {
setError(MSG_YesSlash);
- return false;
+ return eb_false;
}
allocatedLine = allocMem(strlen(t) + 4);
/* ` prevents wildcard expansion, which normally happens on an f command */
@@ -2979,7 +2979,7 @@ twoLetter(const char *line, const char **runThis)
cmd = 'e';
if(!cw->browseMode) {
setError(MSG_NoBrowse);
- return false;
+ return eb_false;
}
if(line[1] == 't')
s = cw->ft, t = MSG_NoTitle;
@@ -2991,16 +2991,16 @@ twoLetter(const char *line, const char **runThis)
puts(s);
else
i_puts(t);
- return true;
+ return eb_true;
}
if(line[0] == 's' && line[1] == 'm') {
const char *t = line + 2;
- bool dosig = true;
+ eb_bool dosig = eb_true;
int account = 0;
cmd = 'e';
if(*t == '-') {
- dosig = false;
+ dosig = eb_false;
++t;
}
if(isdigitByte(*t))
@@ -3010,57 +3010,57 @@ twoLetter(const char *line, const char **runThis)
return sendMailCurrent(account, dosig);
} else {
setError(MSG_SMBadChar);
- return false;
+ return eb_false;
}
}
if(stringEqual(line, "sg")) {
- searchStringsAll = true;
+ searchStringsAll = eb_true;
if(helpMessagesOn)
i_puts(MSG_SubGlobal);
- return true;
+ return eb_true;
}
if(stringEqual(line, "sl")) {
- searchStringsAll = false;
+ searchStringsAll = eb_false;
if(helpMessagesOn)
i_puts(MSG_SubLocal);
- return true;
+ return eb_true;
}
if(stringEqual(line, "ci")) {
- caseInsensitive = true;
+ caseInsensitive = eb_true;
if(helpMessagesOn)
i_puts(MSG_CaseIns);
- return true;
+ return eb_true;
}
if(stringEqual(line, "cs")) {
- caseInsensitive = false;
+ caseInsensitive = eb_false;
if(helpMessagesOn)
i_puts(MSG_CaseSen);
- return true;
+ return eb_true;
}
if(stringEqual(line, "dr")) {
dirWrite = 0;
if(helpMessagesOn)
i_puts(MSG_DirReadonly);
- return true;
+ return eb_true;
}
if(stringEqual(line, "dw")) {
dirWrite = 1;
if(helpMessagesOn)
i_puts(MSG_DirWritable);
- return true;
+ return eb_true;
}
if(stringEqual(line, "dx")) {
dirWrite = 2;
if(helpMessagesOn)
i_puts(MSG_DirX);
- return true;
+ return eb_true;
}
if(stringEqual(line, "hr")) {
@@ -3070,14 +3070,14 @@ twoLetter(const char *line, const char **runThis)
*/
if(helpMessagesOn || debugLevel >= 1)
i_puts(allowRedirection + MSG_RedirectionOff);
- return true;
+ return eb_true;
}
if(stringEqual(line, "iu")) {
iuConvert ^= 1;
if(helpMessagesOn || debugLevel >= 1)
i_puts(iuConvert + MSG_IUConvertOff);
- return true;
+ return eb_true;
}
if(stringEqual(line, "sr")) {
@@ -3086,40 +3086,40 @@ twoLetter(const char *line, const char **runThis)
curl_easy_setopt(curl_handle, CURLOPT_AUTOREFERER, sendReferrer);
if(helpMessagesOn || debugLevel >= 1)
i_puts(sendReferrer + MSG_RefererOff);
- return true;
+ return eb_true;
}
if(stringEqual(line, "js")) {
allowJS ^= 1;
if(helpMessagesOn || debugLevel >= 1)
i_puts(allowJS + MSG_JavaOff);
- return true;
+ return eb_true;
}
if(stringEqual(line, "bd")) {
binaryDetect ^= 1;
if(helpMessagesOn || debugLevel >= 1)
i_puts(binaryDetect + MSG_BinaryIgnore);
- return true;
+ return eb_true;
}
if(stringEqual(line, "rl")) {
inputReadLine ^= 1;
if(helpMessagesOn || debugLevel >= 1)
i_puts(inputReadLine + MSG_InputTTY);
- return true;
+ return eb_true;
}
if(stringEqual(line, "lna")) {
listNA ^= 1;
if(helpMessagesOn || debugLevel >= 1)
i_puts(listNA + MSG_ListControl);
- return true;
+ return eb_true;
}
if(line[0] == 'f' && line[1] == 'm' &&
line[2] && strchr("pa", line[2]) && !line[3]) {
- bool doHelp = helpMessagesOn || debugLevel >= 1;
+ eb_bool doHelp = helpMessagesOn || debugLevel >= 1;
/* Can't support passive/active mode with libcurl, or at least not easily. */
if(line[2] == 'p') {
curl_easy_setopt(curl_handle, CURLOPT_FTPPORT, NULL);
@@ -3133,7 +3133,7 @@ twoLetter(const char *line, const char **runThis)
/* See "man curl_easy_setopt.3" for info on CURLOPT_FTPPORT. Supplying
* "-" makes libcurl select the best IP address for active ftp.
*/
- return true;
+ return eb_true;
}
if(stringEqual(line, "vs")) {
@@ -3143,21 +3143,21 @@ twoLetter(const char *line, const char **runThis)
if(helpMessagesOn || debugLevel >= 1)
i_puts(verifyCertificates + MSG_CertifyOff);
ssl_verify_setting();
- return true;
+ return eb_true;
}
if(stringEqual(line, "hf")) {
showHiddenFiles ^= 1;
if(helpMessagesOn || debugLevel >= 1)
i_puts(showHiddenFiles + MSG_HiddenOff);
- return true;
+ return eb_true;
}
if(stringEqual(line, "su8")) {
re_utf8 ^= 1;
if(helpMessagesOn || debugLevel >= 1)
i_puts(re_utf8 + MSG_ReAscii);
- return true;
+ return eb_true;
}
if(!strncmp(line, "ds=", 3)) {
@@ -3172,39 +3172,39 @@ twoLetter(const char *line, const char **runThis)
printf(",%s", dbpw);
nl();
}
- return true;
+ return eb_true;
}
dbClose();
setDataSource(cloneString(line + 3));
- return true;
+ return eb_true;
}
if(stringEqual(line, "fbc")) {
fetchBlobColumns ^= 1;
if(helpMessagesOn || debugLevel >= 1)
i_puts(MSG_FetchBlobOff + fetchBlobColumns);
- return true;
+ return eb_true;
}
if(stringEqual(line, "eo")) {
endMarks = 0;
if(helpMessagesOn)
i_puts(MSG_MarkOff);
- return true;
+ return eb_true;
}
if(stringEqual(line, "el")) {
endMarks = 1;
if(helpMessagesOn)
i_puts(MSG_MarkList);
- return true;
+ return eb_true;
}
if(stringEqual(line, "ep")) {
endMarks = 2;
if(helpMessagesOn)
i_puts(MSG_MarkOn);
- return true;
+ return eb_true;
}
*runThis = line;
@@ -3218,12 +3218,12 @@ unbalanced(char c, char d, int ln, int *back_p, int *for_p)
{ /* result parameters */
char *t, *open;
char *p = (char *)fetchLine(ln, 1);
- bool change;
+ eb_bool change;
int backward, forward;
- change = true;
+ change = eb_true;
while(change) {
- change = false;
+ change = eb_false;
open = 0;
for(t = p; *t != '\n'; ++t) {
if(*t == c)
@@ -3231,7 +3231,7 @@ unbalanced(char c, char d, int ln, int *back_p, int *for_p)
if(*t == d && open) {
*open = 0;
*t = 0;
- change = true;
+ change = eb_true;
open = 0;
}
}
@@ -3251,7 +3251,7 @@ unbalanced(char c, char d, int ln, int *back_p, int *for_p)
} /* unbalanced */
/* Find the line that balances the unbalanced punctuation. */
-static bool
+static eb_bool
balanceLine(const char *line)
{
char c, d; /* open and close */
@@ -3266,7 +3266,7 @@ balanceLine(const char *line)
if(c = *line) {
if(!strchr(alllist, c) || line[1]) {
setError(MSG_BalanceChar, alllist);
- return false;
+ return eb_false;
}
if(t = strchr(openlist, c)) {
d = closelist[t - openlist];
@@ -3281,12 +3281,12 @@ balanceLine(const char *line)
if(direction > 0) {
if((level = forward) == 0) {
setError(MSG_BalanceNoOpen, c);
- return false;
+ return eb_false;
}
} else {
if((level = backward) == 0) {
setError(MSG_BalanceNoOpen, d);
- return false;
+ return eb_false;
}
}
} else {
@@ -3298,7 +3298,7 @@ balanceLine(const char *line)
unbalanced(c, d, endRange, &backward, &forward);
if(backward && forward) {
setError(MSG_BalanceAmbig, c, d, c, d);
- return false;
+ return eb_false;
}
level = backward + forward;
if(!level)
@@ -3310,7 +3310,7 @@ balanceLine(const char *line)
}
if(!level) {
setError(MSG_BalanceNothing);
- return false;
+ return eb_false;
}
} /* explicit character passed in, or look for one */
@@ -3324,33 +3324,33 @@ balanceLine(const char *line)
direction < 0 && forward >= level) {
cw->dot = i;
printDot();
- return true;
+ return eb_true;
}
level += (forward - backward) * direction;
} /* loop over lines */
setError(MSG_Unbalanced, selected);
- return false;
+ return eb_false;
} /* balanceLine */
/* Unfold the buffer into one long, allocated string. */
-bool
-unfoldBuffer(int cx, bool cr, char **data, int *len)
+eb_bool
+unfoldBuffer(int cx, eb_bool cr, char **data, int *len)
{
char *buf;
int l, ln;
struct ebWindow *w;
- int size = apparentSize(cx, false);
+ int size = apparentSize(cx, eb_false);
if(size < 0)
- return false;
+ return eb_false;
w = sessionList[cx].lw;
if(w->browseMode) {
setError(MSG_SessionBrowse, cx);
- return false;
+ return eb_false;
}
if(w->dirMode) {
setError(MSG_SessionDir, cx);
- return false;
+ return eb_false;
}
if(cr)
size += w->dol;
@@ -3377,7 +3377,7 @@ unfoldBuffer(int cx, bool cr, char **data, int *len)
}
*len = size;
(*data)[size] = 0;
- return true;
+ return eb_true;
} /* unfoldBuffer */
static char *
@@ -3385,7 +3385,7 @@ showLinks(void)
{
int a_l;
char *a = initString(&a_l);
- bool click, dclick;
+ eb_bool click, dclick;
char c, *p, *s, *t, *q, *line, *h;
int j, k = 0, tagno;
void *ev;
@@ -3511,15 +3511,15 @@ readyUndo(void)
* We assume it has been turned into a C string.
* This means no embeded nulls.
* If you want to use null in a search or substitute, use \0. */
-bool
+eb_bool
runCommand(const char *line)
{
int i, j, n;
int writeMode = O_TRUNC;
struct ebWindow *w = NULL;
void *ev = NULL; /* event variables */
- bool nogo = true, rc = true;
- bool postSpace = false, didRange = false;
+ eb_bool nogo = eb_true, rc = eb_true;
+ eb_bool postSpace = eb_false, didRange = eb_false;
char first;
int cx = 0; /* numeric suffix as in s/x/y/3 or w2 */
int tagno;
@@ -3532,7 +3532,7 @@ runCommand(const char *line)
}
nzFree(currentReferrer);
currentReferrer = cloneString(cw->fileName);
- js_redirects = false;
+ js_redirects = eb_false;
cmd = icmd = 'p';
skipWhite(&line);
@@ -3542,13 +3542,13 @@ runCommand(const char *line)
/* Allow things like comment, or shell escape, but not if we're
* in the midst of a global substitute, as in g/x/ !echo hello world */
if(first == '#')
- return true;
+ return eb_true;
if(first == '!')
return shellEscape(line + 1);
/* Watch for successive q commands. */
lastq = lastqq, lastqq = 0;
- noStack = false;
+ noStack = eb_false;
/* special 2 letter commands - most of these change operational modes */
j = twoLetter(line, &line);
@@ -3560,16 +3560,16 @@ runCommand(const char *line)
/* Just hit return to read the next line. */
first = *line;
if(first == 0) {
- didRange = true;
+ didRange = eb_true;
++startRange, ++endRange;
if(endRange > cw->dol) {
setError(MSG_EndBuffer);
- return false;
+ return eb_false;
}
}
if(first == ',') {
- didRange = true;
+ didRange = eb_true;
++line;
startRange = 1;
if(cw->dol == 0)
@@ -3578,29 +3578,29 @@ runCommand(const char *line)
}
if(first == ';') {
- didRange = true;
+ didRange = eb_true;
++line;
startRange = cw->dot;
endRange = cw->dol;
}
if(first == 'j' || first == 'J') {
- didRange = true;
+ didRange = eb_true;
endRange = startRange + 1;
if(endRange > cw->dol) {
setError(MSG_EndJoin);
- return false;
+ return eb_false;
}
}
if(first == '=') {
- didRange = true;
+ didRange = eb_true;
startRange = endRange = cw->dol;
}
if(first == 'w' || first == 'v' || first == 'g' &&
line[1] && strchr(valid_delim, line[1])) {
- didRange = true;
+ didRange = eb_true;
startRange = 1;
if(cw->dol == 0)
startRange = 0;
@@ -3609,7 +3609,7 @@ runCommand(const char *line)
if(!didRange) {
if(!getRangePart(line, &startRange, &line))
- return (globSub = false);
+ return (globSub = eb_false);
endRange = startRange;
if(line[0] == ',') {
++line;
@@ -3617,13 +3617,13 @@ runCommand(const char *line)
first = *line;
if(first && strchr(valid_laddr, first)) {
if(!getRangePart(line, &endRange, &line))
- return (globSub = false);
+ return (globSub = eb_false);
}
}
}
if(endRange < startRange) {
setError(MSG_BadRange);
- return false;
+ return eb_false;
}
/* change uc into a substitute command, converting the whole line */
@@ -3639,15 +3639,15 @@ runCommand(const char *line)
if(stringEqual(line, "bl")) {
if(cw->dirMode) {
setError(MSG_BreakDir);
- return false;
+ return eb_false;
}
if(cw->sqlMode) {
setError(MSG_BreakDB);
- return false;
+ return eb_false;
}
if(cw->browseMode) {
setError(MSG_BreakBrowse);
- return false;
+ return eb_false;
}
line = "s`bl";
}
@@ -3662,7 +3662,7 @@ runCommand(const char *line)
if(!strchr(valid_cmd, cmd)) {
setError(MSG_UnknownCommand, cmd);
- return (globSub = false);
+ return (globSub = eb_false);
}
first = *line;
@@ -3671,26 +3671,26 @@ runCommand(const char *line)
if(cw->dirMode && !strchr(dir_cmd, cmd)) {
setError(MSG_DirCommand, icmd);
- return (globSub = false);
+ return (globSub = eb_false);
}
if(cw->sqlMode && !strchr(sql_cmd, cmd)) {
setError(MSG_DBCommand, icmd);
- return (globSub = false);
+ return (globSub = eb_false);
}
if(cw->browseMode && !strchr(browse_cmd, cmd)) {
setError(MSG_BrowseCommand, icmd);
- return (globSub = false);
+ return (globSub = eb_false);
}
if(startRange == 0 && !strchr(zero_cmd, cmd)) {
setError(MSG_AtLine0);
- return (globSub = false);
+ return (globSub = eb_false);
}
while(isspaceByte(first))
- postSpace = true, first = *++line;
+ postSpace = eb_true, first = *++line;
if(strchr(spaceplus_cmd, cmd) && !postSpace && first) {
s = line;
@@ -3698,13 +3698,13 @@ runCommand(const char *line)
++s;
if(*s) {
setError(MSG_NoSpaceAfter);
- return (globSub = false);
+ return (globSub = eb_false);
}
}
if(globSub && !strchr(global_cmd, cmd)) {
setError(MSG_GlobalCommand, icmd);
- return (globSub = false);
+ return (globSub = eb_false);
}
/* move/copy destination, the third address */
@@ -3714,10 +3714,10 @@ runCommand(const char *line)
} else {
if(!strchr(valid_laddr, first)) {
setError(MSG_BadDest);
- return (globSub = false);
+ return (globSub = eb_false);
}
if(!getRangePart(line, &destLine, &line))
- return (globSub = false);
+ return (globSub = eb_false);
first = *line;
} /* was there something after m or t */
}
@@ -3726,7 +3726,7 @@ runCommand(const char *line)
if(strchr("brewf", cmd) && first && !isURL(line) && !isSQL(line)) {
if(cmd != 'r' || !cw->sqlMode) {
if(!envFile(line, &line))
- return false;
+ return eb_false;
first = *line;
}
}
@@ -3743,7 +3743,7 @@ runCommand(const char *line)
if(startRange > cw->dol) {
startRange = endRange = 0;
setError(MSG_LineHigh);
- return false;
+ return eb_false;
}
cmd = 'p';
endRange += last_z - 1;
@@ -3762,24 +3762,24 @@ runCommand(const char *line)
if(first && strchr(nofollow_cmd, cmd)) {
setError(MSG_TextAfter, icmd);
- return (globSub = false);
+ return (globSub = eb_false);
}
if(cmd == 'h') {
showError();
- return true;
+ return eb_true;
}
if(cmd == 'H') {
if(helpMessagesOn ^= 1)
if(debugLevel >= 1)
i_puts(MSG_HelpOn);
- return true;
+ return eb_true;
}
if(cmd == 'X') {
cw->dot = endRange;
- return true;
+ return eb_true;
}
if(strchr("Llpn", cmd)) {
@@ -3789,12 +3789,12 @@ runCommand(const char *line)
if(intFlag)
break;
}
- return true;
+ return eb_true;
}
if(cmd == '=') {
printf("%d\n", endRange);
- return true;
+ return eb_true;
}
if(cmd == 'B') {
@@ -3806,7 +3806,7 @@ runCommand(const char *line)
char *swapmap;
if(!cw->firstOpMode) {
setError(MSG_NoUndo);
- return false;
+ return eb_false;
}
/* swap, so we can undo our undo, if need be */
i = uw->dot, uw->dot = cw->dot, cw->dot = i;
@@ -3815,20 +3815,20 @@ runCommand(const char *line)
i = uw->labels[j], uw->labels[j] = cw->labels[j], cw->labels[j] = i;
}
swapmap = uw->map, uw->map = cw->map, cw->map = swapmap;
- return true;
+ return eb_true;
}
if(cmd == 'k') {
if(!islowerByte(first) || line[1]) {
setError(MSG_EnterKAZ);
- return false;
+ return eb_false;
}
if(startRange < endRange) {
setError(MSG_RangeLabel);
- return false;
+ return eb_false;
}
cw->labels[first - 'a'] = endRange;
- return true;
+ return eb_true;
}
/* k */
@@ -3837,7 +3837,7 @@ runCommand(const char *line)
cx = stringIsNum(line);
if(!cx) {
setError((cmd == '^') ? MSG_Backup0 : MSG_Session0);
- return false;
+ return eb_false;
}
if(cx < 0)
cx = 0;
@@ -3846,40 +3846,40 @@ runCommand(const char *line)
if(cmd == 'q') {
if(cx) {
if(!cxCompare(cx))
- return false;
+ return eb_false;
if(!cxActive(cx))
- return false;
+ return eb_false;
} else {
cx = context;
if(first) {
setError(MSG_QAfter);
- return false;
+ return eb_false;
}
}
saveSubstitutionStrings();
if(!cxQuit(cx, 2))
- return false;
+ return eb_false;
if(cx != context)
- return true;
+ return eb_true;
/* look around for another active session */
- while(true) {
+ while(eb_true) {
if(++cx == MAXSESSION)
cx = 1;
if(cx == context)
ebClose(0);
if(!sessionList[cx].lw)
continue;
- cxSwitch(cx, true);
- return true;
+ cxSwitch(cx, eb_true);
+ return eb_true;
} /* loop over sessions */
}
if(cmd == 'f') {
if(cx) {
if(!cxCompare(cx))
- return false;
+ return eb_false;
if(!cxActive(cx))
- return false;
+ return eb_false;
s = sessionList[cx].lw->fileName;
if(s)
printf("%s", s);
@@ -3888,16 +3888,16 @@ runCommand(const char *line)
if(sessionList[cx].lw->binMode)
i_printf(MSG_BinaryBrackets);
nl();
- return true;
+ return eb_true;
} /* another session */
if(first) {
if(cw->dirMode) {
setError(MSG_DirRename);
- return false;
+ return eb_false;
}
if(cw->sqlMode) {
setError(MSG_TableRename);
- return false;
+ return eb_false;
}
nzFree(cw->fileName);
cw->fileName = cloneString(line);
@@ -3910,14 +3910,14 @@ runCommand(const char *line)
if(cw->binMode)
i_printf(MSG_BinaryBrackets);
nl();
- return true;
+ return eb_true;
}
if(cmd == 'w') {
if(cx) { /* write to another buffer */
if(writeMode == O_APPEND) {
setError(MSG_BufferAppend);
- return false;
+ return eb_false;
}
return writeContext(cx);
}
@@ -3925,15 +3925,15 @@ runCommand(const char *line)
line = cw->fileName;
if(!line) {
setError(MSG_NoFileSpecified);
- return false;
+ return eb_false;
}
if(cw->dirMode && stringEqual(line, cw->fileName)) {
setError(MSG_NoDirWrite);
- return false;
+ return eb_false;
}
if(cw->sqlMode && stringEqual(line, cw->fileName)) {
setError(MSG_NoDBWrite);
- return false;
+ return eb_false;
}
return writeFile(line, writeMode);
}
@@ -3941,7 +3941,7 @@ runCommand(const char *line)
if(cmd == '^') { /* back key, pop the stack */
if(first && !cx) {
setError(MSG_ArrowAfter);
- return false;
+ return eb_false;
}
if(!cx)
cx = 1;
@@ -3949,64 +3949,64 @@ runCommand(const char *line)
struct ebWindow *prev = cw->prev;
if(!prev) {
setError(MSG_NoPrevious);
- return false;
+ return eb_false;
}
saveSubstitutionStrings();
if(!cxQuit(context, 1))
- return false;
+ return eb_false;
sessionList[context].lw = cw = prev;
restoreSubstitutionStrings(cw);
--cx;
}
printDot();
- return true;
+ return eb_true;
}
if(cmd == 'M') { /* move this to another session */
if(first && !cx) {
setError(MSG_MAfter);
- return false;
+ return eb_false;
}
if(!first) {
setError(MSG_NoDestSession);
- return false;
+ return eb_false;
}
if(!cw->prev) {
setError(MSG_NoBackup);
- return false;
+ return eb_false;
}
if(!cxCompare(cx))
- return false;
+ return eb_false;
if(cxActive(cx) && !cxQuit(cx, 2))
- return false;
+ return eb_false;
/* Magic with pointers, hang on to your hat. */
sessionList[cx].fw = sessionList[cx].lw = cw;
cs->lw = cw->prev;
cw->prev = 0;
cw = cs->lw;
printDot();
- return true;
+ return eb_true;
}
/* M */
if(cmd == 'A') {
char *a;
if(!cxQuit(context, 0))
- return false;
+ return eb_false;
if(!(a = showLinks()))
- return false;
+ return eb_false;
freeUndoLines(cw->map);
undoWindow.map = 0;
nzFree(preWindow.map);
preWindow.map = 0;
- cw->firstOpMode = cw->changeMode = false;
+ cw->firstOpMode = cw->changeMode = eb_false;
w = createWindow();
w->prev = cw;
cw = w;
cs->lw = w;
- rc = addTextToBuffer((pst) a, strlen(a), 0, false);
+ rc = addTextToBuffer((pst) a, strlen(a), 0, eb_false);
nzFree(a);
- undoable = cw->changeMode = false;
- fileSize = apparentSize(context, false);
+ undoable = cw->changeMode = eb_false;
+ fileSize = apparentSize(context, eb_false);
return rc;
}
/* A */
@@ -4020,7 +4020,7 @@ runCommand(const char *line)
char *p, *dirline, *endline;
if(endRange > startRange) {
setError(MSG_RangeG);
- return false;
+ return eb_false;
}
p = (char *)fetchLine(endRange, -1);
j = pstLength((pst) p);
@@ -4030,7 +4030,7 @@ runCommand(const char *line)
p[j] = '\n';
cmd = 'e';
if(!dirline)
- return false;
+ return eb_false;
/* I don't think we need to make a copy here. */
line = dirline;
first = *line;
@@ -4039,13 +4039,13 @@ runCommand(const char *line)
if(cmd == 'e') {
if(cx) {
if(!cxCompare(cx))
- return false;
- cxSwitch(cx, true);
- return true;
+ return eb_false;
+ cxSwitch(cx, eb_true);
+ return eb_true;
}
if(!first) {
i_printf(MSG_SessionX, context);
- return true;
+ return eb_true;
}
/* more e to come */
}
@@ -4054,8 +4054,8 @@ runCommand(const char *line)
if(cmd == 'g' && !(cw->sqlMode | cw->binMode)) {
char *p, *h;
int tagno;
- bool click, dclick, over;
- bool jsh, jsgo, jsdead;
+ eb_bool click, dclick, over;
+ eb_bool jsh, jsgo, jsdead;
/* Check to see if g means run an sql command. */
if(!first) {
@@ -4067,7 +4067,7 @@ runCommand(const char *line)
if(*rbuf) {
int savedol = cw->dol;
readyUndo();
- addTextToBuffer((pst) rbuf, strlen(rbuf), cw->dot, false);
+ addTextToBuffer((pst) rbuf, strlen(rbuf), cw->dot, eb_false);
nzFree(rbuf);
if(cw->dol > savedol) {
cw->labels[0] = startRange + 1;
@@ -4075,7 +4075,7 @@ runCommand(const char *line)
}
cw->dot = startRange;
}
- return j ? true : false;
+ return j ? eb_true : eb_false;
}
}
@@ -4087,17 +4087,17 @@ runCommand(const char *line)
if(j >= 0 && !*s) {
if(cw->sqlMode) {
setError(MSG_DBG);
- return false;
+ return eb_false;
}
- jsh = jsgo = nogo = false;
+ jsh = jsgo = nogo = eb_false;
jsdead = cw->jsdead;
if(!cw->jsc)
- jsdead = true;
- click = dclick = over = false;
+ jsdead = eb_true;
+ click = dclick = over = eb_false;
cmd = 'b';
if(endRange > startRange) {
setError(MSG_RangeG);
- return false;
+ return eb_false;
}
p = (char *)fetchLine(endRange, -1);
jMyContext();
@@ -4105,7 +4105,7 @@ runCommand(const char *line)
debugPrint(5, "findField returns %d, %s", tagno, h);
if(!h) {
fieldNumProblem(1, 'g', j, n, n);
- return false;
+ return eb_false;
}
jsh = memEqualCI(h, "javascript:", 11);
if(tagno) {
@@ -4114,7 +4114,7 @@ runCommand(const char *line)
dclick = tagHandler(tagno, "ondblclick");
}
if(click)
- jsgo = true;
+ jsgo = eb_true;
jsgo |= jsh;
nogo = stringEqual(h, "#");
nogo |= jsh;
@@ -4125,12 +4125,12 @@ runCommand(const char *line)
i_puts(MSG_NJNoAction);
else
i_puts(MSG_NJGoing);
- jsgo = jsh = false;
+ jsgo = jsh = eb_false;
}
line = allocatedLine = h;
first = *line;
setError(-1);
- rc = false;
+ rc = eb_false;
if(jsgo) {
/* javascript might update fields */
readyUndo();
@@ -4143,7 +4143,7 @@ runCommand(const char *line)
goto redirect;
}
}
-/* This is the only handler where false tells the browser to do something else. */
+/* This is the only handler where eb_false tells the browser to do something else. */
if(!rc && !jsdead)
set_property_string(jwin, "status", h);
if(jsgo && click) {
@@ -4152,17 +4152,17 @@ runCommand(const char *line)
if(newlocation)
goto redirect;
if(!rc)
- return true;
+ return eb_true;
}
if(jsh) {
rc = javaParseExecute(jwin, h, 0, 0);
jsdw();
if(newlocation)
goto redirect;
- return true;
+ return eb_true;
}
if(nogo)
- return true;
+ return eb_true;
}
}
@@ -4195,11 +4195,11 @@ runCommand(const char *line)
if(c && (strchr(valid_delim, c) || cmd == 'i' && strchr("*<?=", c))) {
if(!cw->browseMode && (cmd == 'i' || cx)) {
setError(MSG_NoBrowse);
- return false;
+ return eb_false;
}
if(endRange > startRange && cmd == 'i') {
setError(MSG_RangeI, c);
- return false;
+ return eb_false;
}
if(cmd == 'i' && strchr("?=<*", c)) {
char *p;
@@ -4219,37 +4219,37 @@ runCommand(const char *line)
debugPrint(5, "findField returns %d.%d", n, tagno);
if(!tagno) {
fieldNumProblem((c == '*' ? 2 : 0), 'i', cx, n, realtotal);
- return false;
+ return eb_false;
}
if(scmd == '?') {
infShow(tagno, line);
- return true;
+ return eb_true;
}
if(c == '<') {
- bool fromfile = false;
+ eb_bool fromfile = eb_false;
if(globSub) {
setError(MSG_IG);
- return (globSub = false);
+ return (globSub = eb_false);
}
skipWhite(&line);
if(!*line) {
setError(MSG_NoFileSpecified);
- return false;
+ return eb_false;
}
n = stringIsNum(line);
if(n >= 0) {
char *p;
int plen, dol;
if(!cxCompare(n) || !cxActive(n))
- return false;
+ return eb_false;
dol = sessionList[n].lw->dol;
if(!dol) {
setError(MSG_BufferXEmpty, n);
- return false;
+ return eb_false;
}
if(dol > 1) {
setError(MSG_BufferXLines, n);
- return false;
+ return eb_false;
}
p = (char *)fetchLineContext(1, 1, n);
plen = pstLength((pst) p);
@@ -4260,37 +4260,37 @@ runCommand(const char *line)
nzFree(p);
} else {
int fd;
- fromfile = true;
+ fromfile = eb_true;
if(!envFile(line, &line))
- return false;
+ return eb_false;
fd = open(line, O_RDONLY | O_TEXT);
if(fd < 0) {
setError(MSG_NoOpen, line);
- return false;
+ return eb_false;
}
n = read(fd, newline, sizeof (newline));
close(fd);
if(n < 0) {
setError(MSG_NoRead, line);
- return false;
+ return eb_false;
}
}
for(j = 0; j < n; ++j) {
if(newline[j] == 0) {
setError(MSG_InputNull, line);
- return false;
+ return eb_false;
}
if(newline[j] == '\r' && !fromfile &&
j < n - 1 && newline[j + 1] != '\n') {
setError(MSG_InputCR);
- return false;
+ return eb_false;
}
if(newline[j] == '\r' || newline[j] == '\n')
break;
}
if(j == sizeof (newline)) {
setError(MSG_FirstLineLong, line);
- return false;
+ return eb_false;
}
newline[j] = 0;
line = newline;
@@ -4300,12 +4300,12 @@ runCommand(const char *line)
readyUndo();
jSyncup();
if(!infPush(tagno, &allocatedLine))
- return false;
+ return eb_false;
if(newlocation)
goto redirect;
/* No url means it was a reset button */
if(!allocatedLine)
- return true;
+ return eb_true;
line = allocatedLine;
first = *line;
cmd = 'b';
@@ -4314,7 +4314,7 @@ runCommand(const char *line)
cmd = 's';
} else {
setError(MSG_TextAfter, icmd);
- return false;
+ return eb_false;
}
}
@@ -4323,7 +4323,7 @@ runCommand(const char *line)
if(cw->fileName && !noStack && sameURL(line, cw->fileName)) {
if(stringEqual(line, cw->fileName)) {
setError(MSG_AlreadyInBuffer);
- return false;
+ return eb_false;
}
/* Same url, but a different #section */
s = strchr(line, '#');
@@ -4332,7 +4332,7 @@ runCommand(const char *line)
if(!cw->dol)
cw->dot = 0;
printDot();
- return true;
+ return eb_true;
}
line = s;
first = '#';
@@ -4342,12 +4342,12 @@ runCommand(const char *line)
/* Different URL, go get it. */
/* did you make changes that you didn't write? */
if(!cxQuit(context, 0))
- return false;
+ return eb_false;
freeUndoLines(cw->map);
undoWindow.map = 0;
nzFree(preWindow.map);
preWindow.map = 0;
- cw->firstOpMode = cw->changeMode = false;
+ cw->firstOpMode = cw->changeMode = eb_false;
startRange = endRange = 0;
changeFileName = 0; /* should already be zero */
w = createWindow();
@@ -4367,7 +4367,7 @@ runCommand(const char *line)
q = allocMem(ql + 1);
sprintf(q, "to:%s\nSubject:%s\n%s", addr, subj ? subj : "Hello",
body ? body : "");
- j = addTextToBuffer((pst) q, ql, 0, false);
+ j = addTextToBuffer((pst) q, ql, 0, eb_false);
nzFree(q);
nzFree(addr);
nzFree(subj);
@@ -4378,13 +4378,13 @@ runCommand(const char *line)
cw->fileName = cloneString(line);
cw->firstURL = cloneString(line);
if(isSQL(line))
- cw->sqlMode = true;
+ cw->sqlMode = eb_true;
if(icmd == 'g' && !nogo && isURL(line))
debugPrint(2, "*%s", line);
j = readFile(line, "");
}
- w->firstOpMode = w->changeMode = false;
- undoable = false;
+ w->firstOpMode = w->changeMode = eb_false;
+ undoable = eb_false;
cw = cs->lw;
/* Don't push a new session if we were trying to read a url,
* and didn't get anything. This is a feature that I'm
@@ -4413,7 +4413,7 @@ runCommand(const char *line)
if(!w->prev)
cs->fw = w;
if(!j)
- return false;
+ return eb_false;
if(changeFileName) {
nzFree(w->fileName);
w->fileName = changeFileName;
@@ -4425,7 +4425,7 @@ runCommand(const char *line)
if(cw->binMode && !stringIsPDF(cw->fileName))
cmd = 'e';
if(cmd == 'e')
- return true;
+ return eb_true;
}
browse:
@@ -4433,11 +4433,11 @@ runCommand(const char *line)
if(!cw->browseMode) {
if(cw->binMode && !stringIsPDF(cw->fileName)) {
setError(MSG_BrowseBinary);
- return false;
+ return eb_false;
}
if(!cw->dol) {
setError(MSG_BrowseEmpty);
- return false;
+ return eb_false;
}
if(fileSize >= 0) {
debugPrint(1, "%d", fileSize);
@@ -4445,12 +4445,12 @@ runCommand(const char *line)
}
if(!browseCurrentBuffer()) {
if(icmd == 'b')
- return false;
- return true;
+ return eb_false;
+ return eb_true;
}
} else if(!first) {
setError(MSG_BrowseAlready);
- return false;
+ return eb_false;
}
if(newlocation) {
@@ -4468,7 +4468,7 @@ runCommand(const char *line)
first = *line;
if(intFlag) {
i_puts(MSG_RedirectionInterrupted);
- return true;
+ return eb_true;
}
goto rebrowse;
}
@@ -4477,14 +4477,14 @@ runCommand(const char *line)
/* Jump to the #section, if specified in the url */
s = strchr(line, '#');
if(!s)
- return true;
+ return eb_true;
++s;
/* Sometimes there's a 3 in the midst of a long url,
* probably with post data. It really screws things up.
* Here is a kludge to avoid this problem.
* Some day I need to figure this out. */
if(strlen(s) > 24)
- return true;
+ return eb_true;
/* Print the file size before we print the line. */
if(fileSize >= 0) {
debugPrint(1, "%d", fileSize);
@@ -4495,11 +4495,11 @@ runCommand(const char *line)
if(lineHasTag(p, s)) {
cw->dot = i;
printDot();
- return true;
+ return eb_true;
}
}
setError(MSG_NoLable2, s);
- return false;
+ return eb_false;
}
readyUndo();
@@ -4521,7 +4521,7 @@ runCommand(const char *line)
}
if(cw->browseMode) {
setError(MSG_BrowseI);
- return false;
+ return eb_false;
}
cmd = 'a';
--startRange, --endRange;
@@ -4536,7 +4536,7 @@ runCommand(const char *line)
if(cmd == 'a') {
if(inscript) {
setError(MSG_InsertFunction);
- return false;
+ return eb_false;
}
if(cw->sqlMode) {
j = cw->dol;
@@ -4567,7 +4567,7 @@ runCommand(const char *line)
j = 1;
afterdelete:
if(!j)
- globSub = false;
+ globSub = eb_false;
else if(cmd == 'D')
printDot();
return j;
@@ -4592,14 +4592,14 @@ runCommand(const char *line)
return j;
}
setError(MSG_NoFileSpecified);
- return false;
+ return eb_false;
}
if(cmd == 's') {
j = substituteText(line);
if(j < 0) {
- globSub = false;
- j = false;
+ globSub = eb_false;
+ j = eb_false;
}
if(newlocation)
goto redirect;
@@ -4607,14 +4607,14 @@ runCommand(const char *line)
}
setError(MSG_CNYI, icmd);
- return (globSub = false);
+ return (globSub = eb_false);
} /* runCommand */
-bool
-edbrowseCommand(const char *line, bool script)
+eb_bool
+edbrowseCommand(const char *line, eb_bool script)
{
- bool rc;
- globSub = intFlag = false;
+ eb_bool rc;
+ globSub = intFlag = eb_false;
inscript = script;
fileSize = -1;
skipWhite(&line);
@@ -4645,7 +4645,7 @@ edbrowseCommand(const char *line, bool script)
uw->binMode = pw->binMode;
uw->nlMode = pw->nlMode;
uw->dirMode = pw->dirMode;
- undoable = false;
+ undoable = eb_false;
}
return rc;
} /* edbrowseCommand */
@@ -4653,10 +4653,10 @@ edbrowseCommand(const char *line, bool script)
/* Take some text, usually empty, and put it in a side buffer. */
int
sideBuffer(int cx, const char *text, int textlen,
- const char *bufname, bool autobrowse)
+ const char *bufname, eb_bool autobrowse)
{
int svcx = context;
- bool rc;
+ eb_bool rc;
if(cx) {
cxQuit(cx, 2);
} else {
@@ -4668,7 +4668,7 @@ sideBuffer(int cx, const char *text, int textlen,
return 0;
}
}
- cxSwitch(cx, false);
+ cxSwitch(cx, eb_false);
if(bufname) {
cw->fileName = cloneString(bufname);
debrowseSuffix(cw->fileName);
@@ -4679,7 +4679,7 @@ sideBuffer(int cx, const char *text, int textlen,
cw->binMode = looksBinary(text, textlen);
}
if(textlen) {
- rc = addTextToBuffer((pst) text, textlen, 0, true);
+ rc = addTextToBuffer((pst) text, textlen, 0, eb_true);
if(!rc)
i_printf(MSG_BufferPreload, cx);
if(autobrowse) {
@@ -4690,13 +4690,13 @@ sideBuffer(int cx, const char *text, int textlen,
* and if we call more javascript, well, I don't think
* any of that code is reentrant.
* Smells like a disaster in the making. */
- allowJS = false;
+ allowJS = eb_false;
browseCurrentBuffer();
- allowJS = true;
+ allowJS = eb_true;
} /* browse the side window */
}
/* back to original context */
- cxSwitch(svcx, false);
+ cxSwitch(svcx, eb_false);
return cx;
} /* sideBuffer */
@@ -4722,13 +4722,13 @@ static struct listHead inputChangesPending = {
};
static struct inputChange *ic;
-bool
+eb_bool
browseCurrentBuffer(void)
{
char *rawbuf, *newbuf, *tbuf;
int rawsize, tlen, j;
- bool rc, remote = false, do_ip = false, ispdf = false;
- bool save_ch = cw->changeMode;
+ eb_bool rc, remote = eb_false, do_ip = eb_false, ispdf = eb_false;
+ eb_bool save_ch = cw->changeMode;
uchar bmode = 0;
if(cw->fileName) {
@@ -4747,11 +4747,11 @@ browseCurrentBuffer(void)
bmode = 2;
else {
setError(MSG_Unbrowsable);
- return false;
+ return eb_false;
}
- if(!unfoldBuffer(context, false, &rawbuf, &rawsize))
- return false; /* should never happen */
+ if(!unfoldBuffer(context, eb_false, &rawbuf, &rawsize))
+ return eb_false; /* should never happen */
/* expand pdf using pdftohtml */
/* http://rpmfind.net/linux/RPM/suse/updates/10.0/i386/rpm/i586/pdftohtml-0.36-130.9.i586.html */
@@ -4760,7 +4760,7 @@ browseCurrentBuffer(void)
if(!memoryOutToFile(edbrowseTempPDF, rawbuf, rawsize,
MSG_TempNoCreate2, MSG_TempNoWrite)) {
nzFree(rawbuf);
- return false;
+ return eb_false;
}
nzFree(rawbuf);
unlink(edbrowseTempHTML);
@@ -4772,11 +4772,11 @@ browseCurrentBuffer(void)
nzFree(cmd);
if(fileSizeByName(edbrowseTempHTML) <= 0) {
setError(MSG_NoPDF, edbrowseTempPDF);
- return false;
+ return eb_false;
}
rc = fileIntoMemory(edbrowseTempHTML, &rawbuf, &rawsize);
if(!rc)
- return false;
+ return eb_false;
iuReformat(rawbuf, rawsize, &tbuf, &tlen);
if(tbuf) {
nzFree(rawbuf);
@@ -4795,7 +4795,7 @@ browseCurrentBuffer(void)
undoWindow.map = 0;
nzFree(preWindow.map);
preWindow.map = 0;
- cw->firstOpMode = false;
+ cw->firstOpMode = eb_false;
/* There shouldn't be anything in the input pending list, but clear
* it out, just to be safe. */
@@ -4806,11 +4806,11 @@ browseCurrentBuffer(void)
newbuf = emailParse(rawbuf);
j = strlen(newbuf);
- do_ip = true;
+ do_ip = eb_true;
if(!ipbFile)
- do_ip = false;
+ do_ip = eb_false;
if(passMail)
- do_ip = false;
+ do_ip = eb_false;
/* mail could need utf8 conversion, after qp decode */
iuReformat(newbuf, j, &tbuf, &tlen);
@@ -4837,9 +4837,9 @@ browseCurrentBuffer(void)
newbuf = htmlParse(rawbuf, remote);
}
- cw->browseMode = true;
+ cw->browseMode = eb_true;
cw->rnlMode = cw->nlMode;
- cw->nlMode = false;
+ cw->nlMode = eb_false;
cw->r_dot = cw->dot, cw->r_dol = cw->dol;
cw->dot = cw->dol = 0;
cw->r_map = cw->map;
@@ -4847,9 +4847,9 @@ browseCurrentBuffer(void)
memcpy(cw->r_labels, cw->labels, sizeof (cw->labels));
memset(cw->labels, 0, sizeof (cw->labels));
j = strlen(newbuf);
- rc = addTextToBuffer((pst) newbuf, j, 0, false);
+ rc = addTextToBuffer((pst) newbuf, j, 0, eb_false);
free(newbuf);
- cw->firstOpMode = undoable = false;
+ cw->firstOpMode = undoable = eb_false;
cw->changeMode = save_ch;
cw->iplist = 0;
@@ -4860,23 +4860,23 @@ browseCurrentBuffer(void)
}
if(!rc) {
fileSize = -1;
- return false;
+ return eb_false;
} /* should never happen */
- fileSize = apparentSize(context, true);
+ fileSize = apparentSize(context, eb_true);
if(bmode == 2) {
/* apply any input changes pending */
foreach(ic, inputChangesPending)
- updateFieldInBuffer(ic->tagno, ic->value, 0, false);
+ updateFieldInBuffer(ic->tagno, ic->value, 0, eb_false);
freeList(&inputChangesPending);
}
if(do_ip & ismc)
allIPs();
- return true;
+ return eb_true;
} /* browseCurrentBuffer */
-static bool
+static eb_bool
locateTagInBuffer(int tagno, int *ln_p, char **p_p, char **s_p, char **t_p)
{
int ln, n;
@@ -4891,9 +4891,9 @@ locateTagInBuffer(int tagno, int *ln_p, char **p_p, char **s_p, char **t_p)
*s_p = ic->value;
*t_p = ic->value + strlen(ic->value);
/* we don't need to set the others in this special case */
- return true;
+ return eb_true;
}
- return false;
+ return eb_false;
}
/* still rendering the page */
sprintf(search, "%c%d<", InternalCodeChar, tagno);
@@ -4917,16 +4917,16 @@ locateTagInBuffer(int tagno, int *ln_p, char **p_p, char **s_p, char **t_p)
*p_p = p;
*s_p = s;
*t_p = t;
- return true;
+ return eb_true;
}
- return false;
+ return eb_false;
} /* locateTagInBuffer */
/* Update an input field in the current buffer.
* The input field may not be here, if you've deleted some lines. */
void
-updateFieldInBuffer(int tagno, const char *newtext, int notify, bool required)
+updateFieldInBuffer(int tagno, const char *newtext, int notify, eb_bool required)
{
int ln, idx, n, plen;
char *p, *s, *t, *new;
@@ -4955,8 +4955,8 @@ updateFieldInBuffer(int tagno, const char *newtext, int notify, bool required)
displayLine(ln);
if(notify == 2)
i_printf(MSG_LineUpdated, ln);
- cw->firstOpMode = true;
- undoable = true;
+ cw->firstOpMode = eb_true;
+ undoable = eb_true;
return;
}
diff --git a/src/cookies.c b/src/cookies.c
index 688f698..a1df11a 100644
--- a/src/cookies.c
+++ b/src/cookies.c
@@ -15,11 +15,11 @@ struct cookie {
/* These are allocated */
char *name, *value;
char *server, *path, *domain;
- bool tail;
+ eb_bool tail;
/* tail is needed for libcurl, to tell it to tail-match. */
/* Why doesn't it just look for the damned dot at the front of the domain? */
time_t expires; /* zero means undefined */
- bool secure;
+ eb_bool secure;
};
static int
@@ -52,17 +52,17 @@ cookie_from_netscape_line(char *cookie_line)
start = end + 1;
end = strchr(start, '\t');
if((*start == 't') || (*start == 'T'))
- new_cookie->tail = true;
+ new_cookie->tail = eb_true;
else
- new_cookie->tail = false;
+ new_cookie->tail = eb_false;
start = end + 1;
end = strchr(start, '\t');
new_cookie->path = pullString1(start, end);
start = end + 1;
if(*start == 'T' || *start == 't')
- new_cookie->secure = true;
+ new_cookie->secure = eb_true;
else
- new_cookie->secure = false;
+ new_cookie->secure = eb_false;
start = strchr(start, '\t') + 1;
new_cookie->expires = strtol(start, &end, 10);
/* Now end points to the tab following the expiration time. */
@@ -73,7 +73,7 @@ cookie_from_netscape_line(char *cookie_line)
/* strcspn gives count of non-newline characters in string, which is the
* length of the final field. Either CR or LF is considered a newline. */
new_cookie->value = pullString(start, strcspn(start, "\r\n"));
-/* Whenever new_cookie->tail is true, there's going to be a dot at the front of the
+/* Whenever new_cookie->tail is eb_true, there's going to be a dot at the front of the
* domain name. Libcurl even puts one there when it parses set-cookie
* headers. But let's be sure. */
if(new_cookie->tail && (new_cookie->domain[0] != '.'))
@@ -96,16 +96,16 @@ freeCookie(struct cookie *c)
static struct listHead cookies = { &cookies, &cookies };
-static bool displacedCookie;
+static eb_bool displacedCookie;
static void
acceptCookie(struct cookie *c)
{
struct cookie *d;
- displacedCookie = false;
+ displacedCookie = eb_false;
foreach(d, cookies) {
if(stringEqualCI(d->name, c->name) &&
stringEqualCI(d->domain, c->domain)) {
- displacedCookie = true;
+ displacedCookie = eb_true;
delFromList(d);
freeCookie(d);
nzFree(d);
@@ -161,21 +161,21 @@ cookieForLibcurl(const struct cookie *c)
/* Should this server really specify this domain in a cookie? */
/* Domain must be the trailing substring of server. */
-bool
+eb_bool
domainSecurityCheck(const char *server, const char *domain)
{
int i, dl, nd;
dl = strlen(domain);
/* x.com or x.y.z */
if(dl < 5)
- return false;
+ return eb_false;
if(dl > strlen(server))
- return false;
+ return eb_false;
i = strlen(server) - dl;
if(!stringEqualCI(server + i, domain))
- return false;
+ return eb_false;
if(i && server[i - 1] != '.')
- return false;
+ return eb_false;
nd = 2; /* number of dots */
if(dl > 4 && domain[dl - 4] == '.') {
static const char *const tld[] = {
@@ -187,12 +187,12 @@ domainSecurityCheck(const char *server, const char *domain)
for(i = 0; domain[i]; i++)
if(domain[i] == '.')
if(!--nd)
- return true;
- return false;
+ return eb_true;
+ return eb_false;
} /* domainSecurityCheck */
/* Let's jump right into it - parse a cookie, as received from a website. */
-bool
+eb_bool
receiveCookie(const char *url, const char *str)
{
struct cookie *c;
@@ -204,18 +204,18 @@ receiveCookie(const char *url, const char *str)
server = getHostURL(url);
if(server == 0 || !*server)
- return false;
+ return eb_false;
/* Cookie starts with name=value. If we can't get that, go home. */
for(p = str; *p != ';' && *p; p++) ;
for(q = str; *q != '='; q++)
if(!*q || q >= p)
- return false;
+ return eb_false;
if(str == q)
- return false;
+ return eb_false;
c = allocZeroMem(sizeof (struct cookie));
- c->tail = false;
+ c->tail = eb_false;
c->name = pullString1(str, q);
++q;
if(p - q > 0)
@@ -262,7 +262,7 @@ receiveCookie(const char *url, const char *str)
c->domain = cloneString(server);
} else {
/* It's safe to do tail-matching with this domain. */
- c->tail = true;
+ c->tail = eb_true;
/* Guarantee that it does in fact start with dot, prepending if necessary.. */
if(c->domain[0] != '.')
c->domain = prependString(c->domain, ".");
@@ -270,14 +270,14 @@ receiveCookie(const char *url, const char *str)
}
if(s = extractHeaderParam(str, "secure")) {
- c->secure = true;
+ c->secure = eb_true;
nzFree(s);
}
cookieForLibcurl(c);
freeCookie(c);
nzFree(c);
- return true;
+ return eb_true;
} /* receiveCookie */
/* I'm assuming I can read the cookie file, process it,
@@ -348,35 +348,35 @@ cookiesFromJar(void)
fclose(f);
} /* cookiesFromJar */
-static bool
+static eb_bool
isInDomain(const char *d, const char *s)
{
int dl = strlen(d);
int sl = strlen(s);
int j = sl - dl;
if(j < 0)
- return false;
+ return eb_false;
if(!memEqualCI(d, s + j, dl))
- return false;
+ return eb_false;
if(j && s[j - 1] != '.')
- return false;
- return true;
+ return eb_false;
+ return eb_true;
} /* isInDomain */
-static bool
+static eb_bool
isPathPrefix(const char *d, const char *s)
{
int dl = strlen(d);
int sl = strlen(s);
if(dl > sl)
- return false;
+ return eb_false;
return !memcmp(d, s, dl);
} /* isPathPrefix */
void
-sendCookies(char **s, int *l, const char *url, bool issecure)
+sendCookies(char **s, int *l, const char *url, eb_bool issecure)
{
const char *server = getHostURL(url);
const char *data = getDataURL(url);
diff --git a/src/dbodbc.c b/src/dbodbc.c
index 15aed6c..85e3b32 100644
--- a/src/dbodbc.c
+++ b/src/dbodbc.c
@@ -44,7 +44,7 @@ static int current_driver;
* provide no information until you actually run the query.
* Prepare is not enough.
* The openfirst variable tells us whether we are running in that mode. */
-static bool openfirst = false;
+static eb_bool openfirst = eb_false;
#define SQL_MONEY 100
@@ -73,7 +73,7 @@ static const char *stmt_text = 0; /* text of the SQL statement */
static SQLRETURN rc;
static const short *exclist; /* list of error codes trapped by the application */
static short translevel;
-static bool badtrans;
+static eb_bool badtrans;
/* Through globals, make error info available to the application. */
int rv_lastStatus, rv_stmtOffset;
@@ -201,12 +201,12 @@ errTranslate(const char *code)
static char errorText[200];
-static bool
+static eb_bool
errorTrap(const char *cxerr)
{
short i, waste;
char errcodes[6];
- bool firstError, errorFound;
+ eb_bool firstError, errorFound;
/* innocent until proven guilty */
rv_lastStatus = 0;
@@ -214,7 +214,7 @@ errorTrap(const char *cxerr)
rv_stmtOffset = 0;
rv_badToken = 0;
if(!rc)
- return false; /* no problem */
+ return eb_false; /* no problem */
/* log the SQL statement that elicitted the error */
showStatement();
@@ -224,17 +224,17 @@ errorTrap(const char *cxerr)
("@ODBC fails to recognize one of the handles (env, connect, stmt)");
/* get error info from ODBC */
- firstError = true;
- errorFound = false;
+ firstError = eb_true;
+ errorFound = eb_false;
- while(true) {
+ while(eb_true) {
rc = SQLError(henv, hdbc, hstmt,
errcodes, &rv_vendorStatus, errorText, sizeof (errorText), &waste);
if(rc == SQL_NO_DATA) {
if(firstError) {
printf
("ODBC command failed, but SQLError() provided no additional information\n");
- return true;
+ return eb_true;
}
return errorFound;
}
@@ -243,13 +243,13 @@ errorTrap(const char *cxerr)
if(stringEqual(errcodes, "01S01"))
continue;
- firstError = false;
+ firstError = eb_false;
if(cxerr && stringEqual(cxerr, errcodes))
continue;
if(errorFound)
continue;
- errorFound = true;
+ errorFound = eb_true;
rv_lastStatus = errTranslate(errcodes);
/* Don't know how to get statement ofset or invalid token from ODBC.
@@ -356,26 +356,26 @@ clearAllCursors(void)
Connect and disconect to SQL databases.
*********************************************************************/
-/* disconnect from the database. Return true if
+/* disconnect from the database. Return eb_true if
* an error occurs that is trapped by the application. */
-static bool
+static eb_bool
disconnect(void)
{
stmt_text = 0;
hstmt = SQL_NULL_HSTMT;
if(!sql_database)
- return false; /* already disconnected */
+ return eb_false; /* already disconnected */
stmt_text = "disconnect";
debugStatement();
rc = SQLDisconnect(hdbc);
if(errorTrap(0))
- return true;
+ return eb_true;
clearAllCursors(); /* those handles are freed as well */
translevel = 0;
sql_database = 0;
- return false;
+ return eb_false;
} /* disconnect */
/* API level disconnect */
@@ -487,7 +487,7 @@ sql_connect(const char *db, const char *login, const char *pw)
&waste);
getdata_opts = 0;
SQLGetInfo(hdbc, SQL_GETDATA_EXTENSIONS, &getdata_opts, 4, &waste);
- bookmarkBits = false;
+ bookmarkBits = eb_false;
SQLGetInfo(hdbc, SQL_BOOKMARK_PERSISTENCE, &bookmarkBits, 4, &waste);
exclist = 0;
@@ -506,7 +506,7 @@ sql_connect(const char *db, const char *login, const char *pw)
current_driver = DRIVER_INFORMIX;
if(stringEqual(drivername, "libtdsodbc.so")) {
current_driver = DRIVER_TDS;
- openfirst = true;
+ openfirst = eb_true;
}
if(sql_debug) {
@@ -550,7 +550,7 @@ sql_begTrans(void)
/* count the nesting level of transactions. */
if(!translevel) {
- badtrans = false;
+ badtrans = eb_false;
stmt_text = "begin work";
debugStatement();
rc = SQLSetConnectOption(hdbc, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF);
@@ -564,7 +564,7 @@ sql_begTrans(void)
/* end a transaction */
static void
-endTrans(bool commit)
+endTrans(eb_bool commit)
{
checkConnect();
stmt_text = 0;
@@ -588,7 +588,7 @@ endTrans(bool commit)
errorTrap(0);
}
} else { /* success or failure */
- badtrans = true;
+ badtrans = eb_true;
if(!translevel) { /* bottom level */
stmt_text = "rollback work";
debugStatement();
@@ -596,7 +596,7 @@ endTrans(bool commit)
if(rc)
++translevel;
errorTrap(0);
- badtrans = false;
+ badtrans = eb_false;
}
} /* success or failure */
@@ -642,12 +642,12 @@ endTrans(bool commit)
void
sql_commitWork(void)
{
- endTrans(true);
+ endTrans(eb_true);
}
void
sql_rollbackWork(void)
{
- endTrans(false);
+ endTrans(eb_false);
}
void
@@ -690,7 +690,7 @@ sql_blobInsert(const char *tabname, const char *colname, int rowid,
{
char blobcmd[100];
SQLINTEGER output_length;
- bool isfile;
+ eb_bool isfile;
int fd;
/* basic sanity checks */
@@ -706,9 +706,9 @@ sql_blobInsert(const char *tabname, const char *colname, int rowid,
if(strlen(tabname) + strlen(colname) + 42 >= sizeof (blobcmd))
errorPrint("@internal blobInsert command too long");
- isfile = true;
+ isfile = eb_true;
if(isnullstring(filename)) {
- isfile = false;
+ isfile = eb_false;
if(!offset)
errorPrint("2blobInsert is given null filename and null buffer");
} else {
@@ -716,7 +716,7 @@ sql_blobInsert(const char *tabname, const char *colname, int rowid,
fd = eopen(filename, O_RDONLY | O_BINARY, 0);
length = fileSizeByHandle(fd);
if(length == 0) {
- isfile = false;
+ isfile = eb_false;
close(fd);
}
}
@@ -821,7 +821,7 @@ static va_list sqlargs;
/* Temp area to read the values as strings */
static char retstring[NUMRETS][STRINGLEN + 4];
-static bool everything_null;
+static eb_bool everything_null;
static void
retsFromOdbc(void)
@@ -829,7 +829,7 @@ retsFromOdbc(void)
void *q, *q1;
int i, l;
int fd, flags;
- bool yearfirst, indata = false;
+ eb_bool yearfirst, indata = eb_false;
long dt; /* temporarily hold date or time */
char *s;
short c_type; /* C data type */
@@ -837,7 +837,7 @@ retsFromOdbc(void)
char tbuf[20]; /* temp buf, for dates and times */
double fmoney; /* float version of money */
int blobcount = 0;
- bool fbc = fetchBlobColumns;
+ eb_bool fbc = fetchBlobColumns;
/* no blobs unless proven otherwise */
rv_blobLoc = 0;
@@ -856,7 +856,7 @@ retsFromOdbc(void)
++blobcount;
if(blobcount > 1) {
i_puts(MSG_DBManyBlobs);
- fbc = false;
+ fbc = eb_false;
}
for(i = 0; i < rv_numRets; ++i) {
@@ -865,7 +865,7 @@ retsFromOdbc(void)
if(!q) {
if(i)
break;
- indata = true;
+ indata = eb_true;
}
}
if(indata) {
@@ -970,9 +970,9 @@ retsFromOdbc(void)
break;
case 'D':
- yearfirst = false;
+ yearfirst = eb_false;
if(s[4] == '-')
- yearfirst = true;
+ yearfirst = eb_true;
dt = stringDate(s, yearfirst);
if(dt < 0)
errorPrint("@database holds invalid date %s", s);
@@ -1049,7 +1049,7 @@ retsFromOdbc(void)
flags = O_WRONLY | O_BINARY | O_CREAT | O_APPEND;
fd = eopen(rv_blobFile, flags, 0666);
rc = SQL_SUCCESS;
- while(true) {
+ while(eb_true) {
int outbytes;
l = output_length;
if(l > sizeof (blobbuf))
@@ -1135,18 +1135,18 @@ oneRetValue(void *pre_x, ...)
Prepare a formatted SQL statement.
Gather the types and names of the fetched columns and make this information
available to the rest of the C routines in this file, and to the application.
-Returns false if the prepare failed.
+Returns eb_false if the prepare failed.
*********************************************************************/
-static bool
+static eb_bool
prepareInternal(const char *stmt)
{
short i, nc, coltype, colscale, nullable, namelen;
unsigned long colprec;
- bool blobpresent = false;
+ eb_bool blobpresent = eb_false;
checkConnect();
- everything_null = true;
+ everything_null = eb_true;
if(isnullstring(stmt))
errorPrint("2null SQL statement");
stmt_text = stmt;
@@ -1159,7 +1159,7 @@ prepareInternal(const char *stmt)
if(!strstr(stmt, "where") && !strstr(stmt, "WHERE")) {
showStatement();
setError(MSG_DBNoWhere);
- return false;
+ return eb_false;
}
rv_numRets = 0;
@@ -1172,12 +1172,12 @@ prepareInternal(const char *stmt)
else
rc = SQLPrepare(hstmt, (char *)stmt, SQL_NTS);
if(errorTrap(0))
- return false;
+ return eb_false;
/* gather column headings and types */
rc = SQLNumResultCols(hstmt, &nc);
if(errorTrap(0))
- return false;
+ return eb_false;
if(nc > NUMRETS) {
showStatement();
@@ -1189,7 +1189,7 @@ prepareInternal(const char *stmt)
rv_name[i], COLNAMELEN, &namelen,
&coltype, &colprec, &colscale, &nullable);
if(errorTrap("01004"))
- return false;
+ return eb_false;
/*********************************************************************
The following is an Informix kludge,
@@ -1268,7 +1268,7 @@ Count(*) becomes decimal(15,0). So be careful.
showStatement();
errorPrint("2Statement selects more than one blob column");
}
- blobpresent = true;
+ blobpresent = eb_true;
rv_type[i] = (coltype == SQL_LONGVARCHAR ? 'T' : 'B');
break;
@@ -1282,7 +1282,7 @@ Count(*) becomes decimal(15,0). So be careful.
} /* loop over returns */
rv_numRets = nc;
- return true;
+ return eb_true;
} /* prepareInternal */
@@ -1294,24 +1294,24 @@ or you might be running a stored procedure.
For efficiency we do not look for a second row, so this is really
like the "select first" construct that some databases support.
A mode variable says whether execution or selection or both are allowed.
-Return true if data was successfully fetched.
+Return eb_true if data was successfully fetched.
*********************************************************************/
-static bool
+static eb_bool
execInternal(const char *stmt, int mode)
{
- bool notfound = false;
+ eb_bool notfound = eb_false;
newStatement();
if(!prepareInternal(stmt))
- return false; /* error */
+ return eb_false; /* error */
if(!rv_numRets) {
if(!(mode & 1)) {
showStatement();
errorPrint("2SQL select statement returns no values");
}
- notfound = true;
+ notfound = eb_true;
} else { /* end no return values */
if(!(mode & 2)) {
showStatement();
@@ -1330,9 +1330,9 @@ execInternal(const char *stmt, int mode)
rc = SQLFetchScroll(hstmt, (ushort) SQL_FD_FETCH_NEXT, 1);
if(rc == SQL_NO_DATA) {
rc = SQL_SUCCESS;
- notfound = true;
+ notfound = eb_true;
} else
- everything_null = false;
+ everything_null = eb_false;
} else {
rc = SQLRowCount(hstmt, &rv_lastNrows);
if(sql_debug)
@@ -1343,10 +1343,10 @@ execInternal(const char *stmt, int mode)
}
if(errorTrap(0))
- return false;
+ return eb_false;
if(!rv_numRets)
- return true;
+ return eb_true;
return !notfound;
} /* execInternal */
@@ -1356,20 +1356,20 @@ Run individual select or execute statements, using the above internal routine.
*********************************************************************/
/* execute a stand-alone statement with no % formatting of the string */
-bool
+eb_bool
sql_execNF(const char *stmt)
{
- bool ok = execInternal(stmt, 1);
+ eb_bool ok = execInternal(stmt, 1);
SQLFreeHandle(SQL_HANDLE_STMT, hstmt);
exclist = 0;
return ok;
} /* sql_execNF */
/* execute a stand-alone statement with % formatting */
-bool
+eb_bool
sql_exec(const char *stmt, ...)
{
- bool ok;
+ eb_bool ok;
va_start(sqlargs, stmt);
stmt = lineFormatStack(stmt, 0, &sqlargs);
ok = execInternal(stmt, 1);
@@ -1380,11 +1380,11 @@ sql_exec(const char *stmt, ...)
} /* sql_exec */
/* run a select statement with % formatting */
-/* return true if the row was found */
-bool
+/* return eb_true if the row was found */
+eb_bool
sql_select(const char *stmt, ...)
{
- bool rowfound;
+ eb_bool rowfound;
va_start(sqlargs, stmt);
stmt = lineFormatStack(stmt, 0, &sqlargs);
rowfound = execInternal(stmt, 2);
@@ -1394,10 +1394,10 @@ sql_select(const char *stmt, ...)
} /* sql_select */
/* run a select statement with no % formatting of the string */
-bool
+eb_bool
sql_selectNF(const char *stmt, ...)
{
- bool rowfound;
+ eb_bool rowfound;
va_start(sqlargs, stmt);
rowfound = execInternal(stmt, 2);
retsFromOdbc();
@@ -1409,7 +1409,7 @@ sql_selectNF(const char *stmt, ...)
int
sql_selectOne(const char *stmt, ...)
{
- bool rowfound;
+ eb_bool rowfound;
va_start(sqlargs, stmt);
stmt = lineFormatStack(stmt, 0, &sqlargs);
rowfound = execInternal(stmt, 2);
@@ -1423,10 +1423,10 @@ sql_selectOne(const char *stmt, ...)
} /* sql_selectOne */
/* run a stored procedure with no % formatting */
-static bool
+static eb_bool
sql_procGo(const char *stmt)
{
- bool rowfound;
+ eb_bool rowfound;
char *s = allocMem(20 + strlen(stmt));
strcpy(s, "execute procedure ");
strcat(s, stmt);
@@ -1437,10 +1437,10 @@ sql_procGo(const char *stmt)
} /* sql_procGo */
/* run a stored procedure */
-bool
+eb_bool
sql_proc(const char *stmt, ...)
{
- bool rowfound;
+ eb_bool rowfound;
va_start(sqlargs, stmt);
stmt = lineFormatStack(stmt, 0, &sqlargs);
rowfound = sql_procGo(stmt);
@@ -1453,7 +1453,7 @@ sql_proc(const char *stmt, ...)
int
sql_procOne(const char *stmt, ...)
{
- bool rowfound;
+ eb_bool rowfound;
va_start(sqlargs, stmt);
stmt = lineFormatStack(stmt, 0, &sqlargs);
rowfound = sql_procGo(stmt);
@@ -1473,7 +1473,7 @@ Prepare, open, close, and free SQL cursors.
/* prepare a cursor; return the ID number of that cursor */
static int
-prepareCursor(const char *stmt, bool scrollflag)
+prepareCursor(const char *stmt, eb_bool scrollflag)
{
struct OCURS *o = findNewCursor();
stmt = lineFormatStack(stmt, 0, &sqlargs);
@@ -1503,7 +1503,7 @@ sql_prepare(const char *stmt, ...)
{
int n;
va_start(sqlargs, stmt);
- n = prepareCursor(stmt, false);
+ n = prepareCursor(stmt, eb_false);
exclist = 0;
if(n < 0)
SQLFreeHandle(SQL_HANDLE_STMT, hstmt);
@@ -1515,7 +1515,7 @@ sql_prepareScrolling(const char *stmt, ...)
{
int n;
va_start(sqlargs, stmt);
- n = prepareCursor(stmt, true);
+ n = prepareCursor(stmt, eb_true);
exclist = 0;
if(n < 0)
SQLFreeHandle(SQL_HANDLE_STMT, hstmt);
@@ -1550,7 +1550,7 @@ sql_prepOpen(const char *stmt, ...)
struct OCURS *o;
va_start(sqlargs, stmt);
- n = prepareCursor(stmt, false);
+ n = prepareCursor(stmt, eb_false);
if(n < 0) {
SQLFreeHandle(SQL_HANDLE_STMT, hstmt);
return n;
@@ -1625,20 +1625,20 @@ sql_closeFree(int cid)
/* fetch row n from the open cursor.
* Flag can be used to fetch first, last, next, or previous. */
-static bool
+static eb_bool
fetchInternal(int cid, long n, int flag)
{
long nextrow, lastrow;
struct OCURS *o = findCursor(cid);
- everything_null = true;
+ everything_null = eb_true;
/* don't do the fetch if we're looking for row 0 absolute,
* that just nulls out the return values */
if(flag == SQL_FD_FETCH_ABSOLUTE && !n) {
o->rownum = 0;
fetchZero:
- return false;
+ return eb_false;
}
lastrow = nextrow = o->rownum;
@@ -1684,58 +1684,58 @@ fetchInternal(int cid, long n, int flag)
hstmt = o->hstmt;
rc = SQLFetchScroll(hstmt, (ushort) flag, nextrow);
if(rc == SQL_NO_DATA)
- return false;
+ return eb_false;
if(errorTrap(0))
- return false;
+ return eb_false;
o->rownum = nextrow;
- everything_null = false;
- return true;
+ everything_null = eb_false;
+ return eb_true;
} /* fetchInternal */
-bool
+eb_bool
sql_fetchFirst(int cid, ...)
{
- bool rowfound;
+ eb_bool rowfound;
va_start(sqlargs, cid);
rowfound = fetchInternal(cid, 0L, SQL_FD_FETCH_FIRST);
retsFromOdbc();
return rowfound;
} /* sql_fetchFirst */
-bool
+eb_bool
sql_fetchLast(int cid, ...)
{
- bool rowfound;
+ eb_bool rowfound;
va_start(sqlargs, cid);
rowfound = fetchInternal(cid, 0L, SQL_FD_FETCH_LAST);
retsFromOdbc();
return rowfound;
} /* sql_fetchLast */
-bool
+eb_bool
sql_fetchNext(int cid, ...)
{
- bool rowfound;
+ eb_bool rowfound;
va_start(sqlargs, cid);
rowfound = fetchInternal(cid, 0L, SQL_FD_FETCH_NEXT);
retsFromOdbc();
return rowfound;
} /* sql_fetchNext */
-bool
+eb_bool
sql_fetchPrev(int cid, ...)
{
- bool rowfound;
+ eb_bool rowfound;
va_start(sqlargs, cid);
rowfound = fetchInternal(cid, 0L, SQL_FD_FETCH_PREV);
retsFromOdbc();
return rowfound;
} /* sql_fetchPrev */
-bool
+eb_bool
sql_fetchAbs(int cid, long rownum, ...)
{
- bool rowfound;
+ eb_bool rowfound;
va_start(sqlargs, rownum);
rowfound = fetchInternal(cid, rownum, SQL_FD_FETCH_ABSOLUTE);
retsFromOdbc();
@@ -1811,7 +1811,7 @@ getPrimaryKey(char *tname, int *part1, int *part2, int *part3, int *part4)
return;
} /* getPrimaryKey */
-bool
+eb_bool
showTables(void)
{
char tabname[40];
@@ -1820,11 +1820,11 @@ showTables(void)
SQLLEN tabnameOut, tabtypeOut, tabownerOut;
char *buf;
int buflen, cx;
- int truevalue = SQL_TRUE;
+ int eb_truevalue = SQL_TRUE;
/*
SQLSetConnectAttr(hdbc, SQL_ATTR_METADATA_ID,
-&truevalue, SQL_IS_INTEGER);
+&eb_truevalue, SQL_IS_INTEGER);
*/
newStatement();
@@ -1849,19 +1849,19 @@ SQLSetConnectAttr(hdbc, SQL_ATTR_METADATA_ID,
stringAndString(&buf, &buflen, tabline);
}
- cx = sideBuffer(0, buf, buflen, 0, false);
+ cx = sideBuffer(0, buf, buflen, 0, eb_false);
nzFree(buf);
i_printf(MSG_ShowTables, cx);
SQLFreeHandle(SQL_HANDLE_STMT, hstmt);
- return true;
+ return eb_true;
abort:
SQLFreeHandle(SQL_HANDLE_STMT, hstmt);
- return false;
+ return eb_false;
} /* showTables */
/* display foreign keys, from this table to others */
-bool
+eb_bool
fetchForeign(char *tname)
{
char farschema[40], fartab[40];
@@ -1904,9 +1904,9 @@ fetchForeign(char *tname)
}
SQLFreeHandle(SQL_HANDLE_STMT, hstmt);
- return true;
+ return eb_true;
abort:
SQLFreeHandle(SQL_HANDLE_STMT, hstmt);
- return false;
+ return eb_false;
} /* fetchForeign */
diff --git a/src/dbops.c b/src/dbops.c
index 7d3d116..5f71426 100644
--- a/src/dbops.c
+++ b/src/dbops.c
@@ -11,7 +11,7 @@ const char *sql_debuglog = "/tmp/ebsql.log"; /* log of debug prints */
const char *sql_database; /* name of current database */
int rv_numRets;
char rv_type[NUMRETS + 1];
-bool rv_nullable[NUMRETS];
+eb_bool rv_nullable[NUMRETS];
/* names of returned data, usually SQL column names */
char rv_name[NUMRETS + 1][COLNAMELEN];
LF rv_data[NUMRETS]; /* the returned values */
@@ -19,7 +19,7 @@ long rv_lastNrows, rv_lastSerial, rv_lastRowid;
void *rv_blobLoc; /* location of blob in memory */
int rv_blobSize;
const char *rv_blobFile;
-bool rv_blobAppend;
+eb_bool rv_blobAppend;
/* text descriptions corresponding to our generic SQL error codes */
@@ -380,16 +380,16 @@ Date time functions.
static char ndays[] = { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
-bool
+eb_bool
isLeapYear(int year)
{
if(year % 4)
- return false;
+ return eb_false;
if(year % 100)
- return true;
+ return eb_true;
if(year % 400)
- return false;
- return true;
+ return eb_false;
+ return eb_true;
} /* isLeapYear */
/* convert year, month, and day into a date. */
@@ -453,7 +453,7 @@ dateDecode(date d, int *yp, int *mp, int *dp)
/* convert a string into a date */
/* return -4 for bad format */
date
-stringDate(const char *s, bool yearfirst)
+stringDate(const char *s, eb_bool yearfirst)
{
short year, month, day, i, l;
char delim;
@@ -576,7 +576,7 @@ interval
stringTime(const char *t)
{
short h, m, s;
- bool ampm = false;
+ eb_bool ampm = eb_false;
char c;
char buf[12];
short i, l;
@@ -592,7 +592,7 @@ stringTime(const char *t)
strncpy(buf, t, l);
buf[l] = 0;
if(buf[l - 1] == 'M' && buf[l - 3] == ' ') {
- ampm = true;
+ ampm = eb_true;
c = buf[l - 2];
if(c != 'A' && c != 'P')
return -4;
@@ -670,22 +670,22 @@ stringMoney(const char *s)
} /* stringMoney */
/* Make sure edbrowse is connected to the database */
-bool
+eb_bool
ebConnect(void)
{
if(sql_database)
- return true;
+ return eb_true;
if(!dbarea) {
setError(MSG_DBUnspecified);
- return false;
+ return eb_false;
}
sql_connect(dbarea, dblogin, dbpw);
if(!sql_database) {
setError(MSG_DBConnect, rv_vendorStatus);
- return false;
+ return eb_false;
}
- return true;
+ return eb_true;
} /* ebConnect */
void
@@ -779,7 +779,7 @@ buildSelectClause(void)
stringAndString(&scl, &scllen, td->name);
} /* buildSelectClause */
-static bool
+static eb_bool
buildWhereClause(void)
{
int i, l, n, colno;
@@ -789,20 +789,20 @@ buildWhereClause(void)
wcl = initString(&wcllen);
wherecol[0] = 0;
if(stringEqual(w, "*"))
- return true;
+ return eb_true;
e = strchr(w, '=');
if(!e) {
if(!td->key1) {
setError(MSG_DBNoKey);
- return false;
+ return eb_false;
}
colno = td->key1;
e = td->cols[colno - 1];
l = strlen(e);
if(l > COLNAMELEN) {
setError(MSG_DBColumnLong, e, COLNAMELEN);
- return false;
+ return eb_false;
}
strcpy(wherecol, e);
e = w - 1;
@@ -810,11 +810,11 @@ buildWhereClause(void)
colno = strtol(w, (char **)&w, 10);
if(w != e) {
setError(MSG_DBSyntax);
- return false;
+ return eb_false;
}
if(colno == 0 || colno > td->ncols) {
setError(MSG_DBColRange, colno);
- return false;
+ return eb_false;
}
goto setcol_n;
} else {
@@ -827,21 +827,21 @@ buildWhereClause(void)
continue;
if(colno) {
setError(MSG_DBManyColumns, wherecol);
- return false;
+ return eb_false;
}
colno = i + 1;
}
}
if(!colno) {
setError(MSG_DBNoColumn, wherecol);
- return false;
+ return eb_false;
}
setcol_n:
w = td->cols[colno - 1];
l = strlen(w);
if(l > COLNAMELEN) {
setError(MSG_DBColumnLong, w, COLNAMELEN);
- return false;
+ return eb_false;
}
strcpy(wherecol, w);
}
@@ -865,10 +865,10 @@ buildWhereClause(void)
pushQuoted(&wcl, &wcllen, w, colno - 1);
}
- return true;
+ return eb_true;
} /* buildWhereClause */
-static bool
+static eb_bool
setTable(void)
{
static const short exclist[] = { EXCNOTABLE, EXCNOCOLUMN, 0 };
@@ -884,7 +884,7 @@ setTable(void)
td = cw->table;
if(td)
- return true;
+ return eb_true;
/* haven't glommed onto this table yet */
td = findTableDescriptor(myTab);
@@ -899,7 +899,7 @@ setTable(void)
setError(MSG_DBNoTable, td->name);
else if(rv_lastStatus == EXCNOCOLUMN)
setError(MSG_DBBadColumn);
- return false;
+ return eb_false;
}
td->types = cloneString(rv_type);
nc = rv_numRets;
@@ -915,12 +915,12 @@ setTable(void)
if(rv_lastStatus) {
if(rv_lastStatus == EXCNOTABLE)
setError(MSG_DBNoTable, myTab);
- return false;
+ return eb_false;
}
td = newTableDescriptor(myTab);
if(!td) {
sql_free(cid);
- return false;
+ return eb_false;
}
nc = rv_numRets;
if(nc > MAXTCOLS) {
@@ -953,7 +953,7 @@ setTable(void)
}
cw->table = td;
- return true;
+ return eb_true;
} /* setTable */
void
@@ -1029,12 +1029,12 @@ showForeign(void)
} /* showForeign */
/* Select rows of data and put them into the text buffer */
-static bool
+static eb_bool
rowsIntoBuffer(int cid, const char *types, char **bufptr, int *lcnt)
{
char *rbuf, *unld, *u, *v, *s, *end;
int rbuflen;
- bool rc = false;
+ eb_bool rc = eb_false;
*bufptr = EMPTYSTRING;
*lcnt = 0;
@@ -1066,7 +1066,7 @@ rowsIntoBuffer(int cid, const char *types, char **bufptr, int *lcnt)
u = strchr(u, '|') + 1;
v = strpbrk(u, "|\n");
end = v + strlen(v);
- cx = sideBuffer(0, rv_blobLoc, rv_blobSize, 0, false);
+ cx = sideBuffer(0, rv_blobLoc, rv_blobSize, 0, eb_false);
nzFree(rv_blobLoc);
sprintf(myTab, "<%d>", cx);
if(!cx)
@@ -1080,7 +1080,7 @@ rowsIntoBuffer(int cid, const char *types, char **bufptr, int *lcnt)
stringAndString(&rbuf, &rbuflen, unld);
++*lcnt;
}
- rc = true;
+ rc = eb_true;
abort:
sql_closeFree(cid);
@@ -1088,36 +1088,36 @@ rowsIntoBuffer(int cid, const char *types, char **bufptr, int *lcnt)
return rc;
} /* rowsIntoBuffer */
-bool
+eb_bool
sqlReadRows(const char *filename, char **bufptr)
{
int cid, lcnt;
*bufptr = EMPTYSTRING;
if(!ebConnect())
- return false;
+ return eb_false;
if(!setTable())
- return false;
+ return eb_false;
myWhere = strchr(filename, ']') + 1;
if(!*myWhere)
- return true;
+ return eb_true;
if(!buildWhereClause())
- return false;
+ return eb_false;
buildSelectClause();
rv_blobFile = 0;
cid = sql_prepOpen("%s %0s", scl, wcl);
nzFree(scl);
nzFree(wcl);
if(cid < 0)
- return false;
+ return eb_false;
return rowsIntoBuffer(cid, td->types, bufptr, &lcnt);
} /* sqlReadRows */
/* Split a line at pipe boundaries, and make sure the field count is correct */
-static bool
+static eb_bool
intoFields(char *line)
{
char *s = line;
@@ -1135,25 +1135,25 @@ intoFields(char *line)
if(j < td->ncols)
continue;
setError(MSG_DBAddField);
- return false;
+ return eb_false;
}
if(j == td->ncols)
- return true;
+ return eb_true;
setError(MSG_DBLostField);
- return false;
+ return eb_false;
} /* intoFields */
-static bool
+static eb_bool
rowCountCheck(int action, int cnt1)
{
int cnt2 = rv_lastNrows;
if(cnt1 == cnt2)
- return true;
+ return eb_true;
setError(MSG_DBDeleteCount + action, cnt1, cnt2);
- return false;
+ return eb_false;
} /* rowCountCheck */
static int
@@ -1161,7 +1161,7 @@ keyCountCheck(void)
{
if(!td->key1) {
setError(MSG_DBNoKeyCol);
- return false;
+ return eb_false;
}
if(!td->key2)
return 1;
@@ -1179,7 +1179,7 @@ static const short insupdExceptions[] = {
EXCDEADLOCK, EXCCHECK, EXCTIMEOUT, EXCNOTNULLCOLUMN, 0
};
-static bool
+static eb_bool
insupdError(int action, int rcnt)
{
int rc = rv_lastStatus;
@@ -1213,33 +1213,33 @@ insupdError(int action, int rcnt)
break;
default:
setError(MSG_DBMisc, rv_vendorStatus);
- return false;
+ return eb_false;
}
setError(msg);
- return false;
+ return eb_false;
}
return rowCountCheck(action, rcnt);
} /* insupdError */
-bool
+eb_bool
sqlDelRows(int start, int end)
{
int nkeys, ndel, ln;
if(!setTable())
- return false;
+ return eb_false;
nkeys = keyCountCheck();
if(!nkeys)
- return false;
+ return eb_false;
ndel = end - start + 1;
ln = start;
if(ndel > 100) {
setError(MSG_DBMassDelete);
- return false;
+ return eb_false;
}
/* We could delete all the rows with one statement, using an in(list),
@@ -1256,14 +1256,14 @@ sqlDelRows(int start, int end)
nzFree(wherekeys);
nzFree(line);
if(!insupdError(0, 1))
- return false;
+ return eb_false;
delText(ln, ln);
}
- return true;
+ return eb_true;
} /* sqlDelRows */
-bool
+eb_bool
sqlUpdateRow(pst source, int slen, pst dest, int dlen)
{
char *d2; /* clone of dest */
@@ -1275,21 +1275,21 @@ sqlUpdateRow(pst source, int slen, pst dest, int dlen)
/* compare all the way out to newline, so we know both strings end at the same time */
if(slen == dlen && !memcmp(source, dest, slen + 1))
- return true;
+ return eb_true;
if(!setTable())
- return false;
+ return eb_false;
nkeys = keyCountCheck();
if(!nkeys)
- return false;
+ return eb_false;
key1 = td->key1 - 1;
key2 = td->key2 - 1;
d2 = (char *)clonePstring(dest);
if(!intoFields(d2)) {
nzFree(d2);
- return false;
+ return eb_false;
}
j = 0;
@@ -1335,15 +1335,15 @@ sqlUpdateRow(pst source, int slen, pst dest, int dlen)
nzFree(d2);
nzFree(u1);
- return true;
+ return eb_true;
abort:
nzFree(d2);
nzFree(u1);
- return false;
+ return eb_false;
} /* sqlUpdateRow */
-bool
+eb_bool
sqlAddRows(int ln)
{
char *u1, *u2; /* pieces of the insert statement */
@@ -1353,10 +1353,10 @@ sqlAddRows(int ln)
int j, l, nkeys;
double dv;
char inp[256];
- bool rc;
+ eb_bool rc;
if(!setTable())
- return false;
+ return eb_false;
nkeys = keyCountCheck();
while(1) {
@@ -1381,7 +1381,7 @@ sqlAddRows(int ln)
nzFree(u1);
nzFree(u2);
nzFree(u3);
- return true;
+ return eb_true;
}
if(inp[0] == 0) {
@@ -1421,7 +1421,7 @@ sqlAddRows(int ln)
}
break;
case 'D':
- if(stringDate(inp, false) < 0) {
+ if(stringDate(inp, eb_false) < 0) {
puts("date expected");
goto reenter;
}
@@ -1486,15 +1486,15 @@ sqlAddRows(int ln)
unld[l - 1] = '\n'; /* overwrite the last pipe */
#endif
- rc = addTextToBuffer((pst) unld, l, ln, false);
+ rc = addTextToBuffer((pst) unld, l, ln, eb_false);
nzFree(u3);
if(!rc)
- return false;
+ return eb_false;
++ln;
}
/* This pointis not reached; make the compilerhappy */
- return true;
+ return eb_true;
} /* sqlAddRows */
@@ -1515,7 +1515,7 @@ cursor_comm(const char *stmt1, const char *stmt2, /* the two select statements *
char *line1, *line2, *s; /* the two fetched rows */
void *blob1, *blob2; /* one blob per table */
int blob1size, blob2size;
- bool eof1, eof2, get1, get2;
+ eb_bool eof1, eof2, get1, get2;
int sortval1, sortval2;
char sortstring1[80], sortstring2[80];
int sortcol;
@@ -1537,13 +1537,13 @@ cursor_comm(const char *stmt1, const char *stmt2, /* the two select statements *
if(sorttype == 'S')
passkey1 = (int)sortstring1, passkey2 = (int)sortstring2;
- eof1 = eof2 = false;
- get1 = get2 = true;
+ eof1 = eof2 = eb_false;
+ get1 = get2 = eb_true;
rv_blobFile = 0; /* in case the cursor has a blob */
line1 = line2 = 0;
blob1 = blob2 = 0;
- while(true) {
+ while(eb_true) {
if(get1) { /* fetch first row */
eof1 = !sql_fetchNext(cid1, 0);
nzFree(line1);
@@ -1602,14 +1602,14 @@ cursor_comm(const char *stmt1, const char *stmt2, /* the two select statements *
/* looking for second line */
if(eof1 & eof2)
break; /* done */
- get1 = get2 = false;
+ get1 = get2 = eb_false;
/* in cid2, but not in cid1 */
if(eof1 || !eof2 &&
(sorttype == 'S' && strcmp(sortstring1, sortstring2) > 0 ||
sorttype != 'S' && sortval1 > sortval2)) {
(*f) ('>', line1, line2, passkey2);
- get2 = true;
+ get2 = eb_true;
continue;
}
@@ -1618,11 +1618,11 @@ cursor_comm(const char *stmt1, const char *stmt2, /* the two select statements *
(sorttype == 'S' && strcmp(sortstring1, sortstring2) < 0 ||
sorttype != 'S' && sortval1 < sortval2)) {
(*f) ('<', line1, line2, passkey1);
- get1 = true;
+ get1 = eb_true;
continue;
}
/* insert case */
- get1 = get2 = true;
+ get1 = get2 = eb_true;
/* perhaps the lines are equal */
if(stringEqual(line1, line2))
continue;
@@ -1737,7 +1737,7 @@ goSelect(int *startLine, char **rbuf)
char *cmd, *s;
int cmdlen;
int i, j, l, action, cid;
- bool rc;
+ eb_bool rc;
static const char *actionWords[] = {
"select", "insert", "update", "delete", "execute",
0
diff --git a/src/dbstubs.c b/src/dbstubs.c
index c23c6c7..f3715eb 100644
--- a/src/dbstubs.c
+++ b/src/dbstubs.c
@@ -8,12 +8,12 @@
#include "eb.h"
-bool
+eb_bool
sqlReadRows(const char *filename, char **bufptr)
{
setError(MSG_DBNotCompiled);
*bufptr = EMPTYSTRING;
- return false;
+ return eb_false;
} /* sqlReadRows */
void
@@ -31,31 +31,31 @@ showForeign(void)
{
} /* showForeign */
-bool
+eb_bool
showTables(void)
{
} /* showTables */
-bool
+eb_bool
sqlDelRows(int start, int end)
{
} /* sqlDelRows */
-bool
+eb_bool
sqlUpdateRow(pst source, int slen, pst dest, int dlen)
{
} /* sqlUpdateRow */
-bool
+eb_bool
sqlAddRows(int ln)
{
} /* sqlAddRows */
-bool
+eb_bool
ebConnect(void)
{
setError(MSG_DBNotCompiled);
- return false;
+ return eb_false;
} /* ebConnect */
int
diff --git a/src/eb.p b/src/eb.p
index 7aa8d47..f3294e3 100644
--- a/src/eb.p
+++ b/src/eb.p
@@ -1,15 +1,15 @@
/* This file is machine-generated, do not hand edit. */
/* sourcefile=main.c */
-bool junkSubject(const char *s, char key) ;
+eb_bool junkSubject(const char *s, char key) ;
const char * mailRedirect(const char *to, const char *from, const char *reply, const char *subj) ;
-bool javaOK(const char *url) ;
+eb_bool javaOK(const char *url) ;
void ebClose(int n) ;
void eeCheck(void) ;
void setDataSource(char *v) ;
int main(int argc, char **argv) ;
-bool runEbFunction(const char *line) ;
-bool bufferToProgram(const char *cmd, const char *suffix, bool trailPercent) ;
+eb_bool runEbFunction(const char *line) ;
+eb_bool bufferToProgram(const char *cmd, const char *suffix, eb_bool trailPercent) ;
struct DBTABLE * findTableDescriptor(const char *sn) ;
struct DBTABLE * newTableDescriptor(const char *name) ;
struct MIMETYPE * findMimeBySuffix(const char *suffix) ;
@@ -23,29 +23,29 @@ void displayLine(int n) ;
void initializeReadline(void) ;
pst inputLine(void) ;
void freeUndoLines(const char *cmap) ;
-bool cxCompare(int cx) ;
-bool cxActive(int cx) ;
-bool cxQuit(int cx, int action) ;
-void cxSwitch(int cx, bool interactive) ;
+eb_bool cxCompare(int cx) ;
+eb_bool cxActive(int cx) ;
+eb_bool cxQuit(int cx, int action) ;
+void cxSwitch(int cx, eb_bool interactive) ;
void linesReset(void) ;
-bool linesComing(int n) ;
-void gotoLocation(char *url, int delay, bool rf) ;
-bool addTextToBuffer(const pst inbuf, int length, int destl, bool onside) ;
+eb_bool linesComing(int n) ;
+void gotoLocation(char *url, int delay, eb_bool rf) ;
+eb_bool addTextToBuffer(const pst inbuf, int length, int destl, eb_bool onside) ;
void delText(int start, int end) ;
-bool readFile(const char *filename, const char *post) ;
-bool unfoldBuffer(int cx, bool cr, char **data, int *len) ;
-bool runCommand(const char *line) ;
-bool edbrowseCommand(const char *line, bool script) ;
-int sideBuffer(int cx, const char *text, int textlen, const char *bufname, bool autobrowse) ;
-bool browseCurrentBuffer(void) ;
-void updateFieldInBuffer(int tagno, const char *newtext, int notify, bool required) ;
+eb_bool readFile(const char *filename, const char *post) ;
+eb_bool unfoldBuffer(int cx, eb_bool cr, char **data, int *len) ;
+eb_bool runCommand(const char *line) ;
+eb_bool edbrowseCommand(const char *line, eb_bool script) ;
+int sideBuffer(int cx, const char *text, int textlen, const char *bufname, eb_bool autobrowse) ;
+eb_bool browseCurrentBuffer(void) ;
+void updateFieldInBuffer(int tagno, const char *newtext, int notify, eb_bool required) ;
char * getFieldFromBuffer(int tagno) ;
int fieldIsChecked(int tagno) ;
/* sourcefile=url.c */
void unpercentURL(char *url) ;
-bool isURL(const char *url) ;
-bool isBrowseableURL(const char *url) ;
+eb_bool isURL(const char *url) ;
+eb_bool isBrowseableURL(const char *url) ;
const char * getProtURL(const char *url) ;
const char * getHostURL(const char *url) ;
const char * getHostPassURL(const char *url) ;
@@ -53,27 +53,27 @@ const char * getUserURL(const char *url) ;
const char * getPassURL(const char *url) ;
const char * getDataURL(const char *url) ;
void getDirURL(const char *url, const char **start_p, const char **end_p) ;
-bool getPortLocURL(const char *url, const char **portloc, int *port) ;
+eb_bool getPortLocURL(const char *url, const char **portloc, int *port) ;
int getPortURL(const char *url) ;
-bool isProxyURL(const char *url) ;
+eb_bool isProxyURL(const char *url) ;
char * resolveURL(const char *base, const char *rel) ;
-bool sameURL(const char *s, const char *t) ;
+eb_bool sameURL(const char *s, const char *t) ;
char * altText(const char *base) ;
char * encodePostData(const char *s) ;
char * decodePostData(const char *data, const char *name, int seqno) ;
void decodeMailURL(const char *url, char **addr_p, char **subj_p, char **body_p) ;
/* sourcefile=auth.c */
-bool getUserPass(const char *url, char *creds, bool find_proxy) ;
-bool addWebAuthorization(const char *url, int realm, const char *credentials, bool proxy) ;
+eb_bool getUserPass(const char *url, char *creds, eb_bool find_proxy) ;
+eb_bool addWebAuthorization(const char *url, int realm, const char *credentials, eb_bool proxy) ;
/* sourcefile=http.c */
char * extractHeaderParam(const char *str, const char *item) ;
time_t parseHeaderDate(const char *date) ;
-bool parseRefresh(char *ref, int *delay_p) ;
-bool refreshDelay(int sec, const char *u) ;
+eb_bool parseRefresh(char *ref, int *delay_p) ;
+eb_bool refreshDelay(int sec, const char *u) ;
char * copy_and_sanitize(const char *start, const char *end) ;
-bool httpConnect(const char *from, const char *url) ;
+eb_bool httpConnect(const char *from, const char *url) ;
void allIPs(void) ;
void setHTTPLanguage(const char *lang) ;
void my_curl_init(void) ;
@@ -93,74 +93,74 @@ void runningError(int msg, ...) ;
void i_caseShift(unsigned char *s, char action) ;
/* sourcefile=sendmail.c */
-bool loadAddressBook(void) ;
+eb_bool loadAddressBook(void) ;
const char * reverseAlias(const char *reply) ;
-bool mailPutLine(const char *buf, bool realdot) ;
-bool mailGetLine(void) ;
+eb_bool mailPutLine(const char *buf, eb_bool realdot) ;
+eb_bool mailGetLine(void) ;
void mailPutGetError(const char *line) ;
void mailClose(void) ;
-bool mailConnect(const char *host, int port, int secure) ;
-char * base64Encode(const char *inbuf, int inlen, bool lines) ;
+eb_bool mailConnect(const char *host, int port, int secure) ;
+char * base64Encode(const char *inbuf, int inlen, eb_bool lines) ;
char * qpEncode(const char *line) ;
-bool encodeAttachment(const char *file, int ismail, bool webform, const char **type_p, const char **enc_p, char **data_p) ;
+eb_bool encodeAttachment(const char *file, int ismail, eb_bool webform, const char **type_p, const char **enc_p, char **data_p) ;
char * makeBoundary(void) ;
-bool sendMail(int account, const char **recipients, const char *body, int subjat, const char **attachments, const char *refline, int nalt, bool dosig) ;
-bool validAccount(int n) ;
-bool sendMailCurrent(int sm_account, bool dosig) ;
+eb_bool sendMail(int account, const char **recipients, const char *body, int subjat, const char **attachments, const char *refline, int nalt, eb_bool dosig) ;
+eb_bool validAccount(int n) ;
+eb_bool sendMailCurrent(int sm_account, eb_bool dosig) ;
/* sourcefile=fetchmail.c */
void loadBlacklist(void) ;
-bool onBlacklist1(IP32bit tip) ;
+eb_bool onBlacklist1(IP32bit tip) ;
int fetchMail(int account) ;
void scanMail(void) ;
-bool emailTest(void) ;
+eb_bool emailTest(void) ;
void unpackUploadedFile(const char *post, const char *boundary, char **postb, int *postb_l) ;
char * emailParse(char *buf) ;
-bool setupReply(bool all) ;
+eb_bool setupReply(eb_bool all) ;
/* sourcefile=html.c */
void freeTags(void *a) ;
-bool tagHandler(int seqno, const char *name) ;
+eb_bool tagHandler(int seqno, const char *name) ;
void jsdw(void) ;
void jSyncup(void) ;
-void preFormatCheck(int tagno, bool * pretag, bool * slash) ;
+void preFormatCheck(int tagno, eb_bool * pretag, eb_bool * slash) ;
char * htmlParse(char *buf, int remote) ;
void findField(const char *line, int ftype, int n, int *total, int *realtotal, int *tagno, char **href, void **evp) ;
void findInputField(const char *line, int ftype, int n, int *total, int *realtotal, int *tagno) ;
-bool lineHasTag(const char *p, const char *s) ;
-bool htmlTest(void) ;
+eb_bool lineHasTag(const char *p, const char *s) ;
+eb_bool htmlTest(void) ;
void infShow(int tagno, const char *search) ;
-bool infReplace(int tagno, const char *newtext, int notify) ;
-bool infPush(int tagno, char **post_string) ;
+eb_bool infReplace(int tagno, const char *newtext, int notify) ;
+eb_bool infPush(int tagno, char **post_string) ;
void javaSetsTagVar(void *v, const char *val) ;
-void javaSubmitsForm(void *v, bool reset) ;
+void javaSubmitsForm(void *v, eb_bool reset) ;
void javaOpensWindow(const char *href, const char *name) ;
-void javaSetsTimeout(int n, const char *jsrc, void *to, bool isInterval) ;
+void javaSetsTimeout(int n, const char *jsrc, void *to, eb_bool isInterval) ;
/* sourcefile=format.c */
void prepareForBrowse(char *h, int h_len) ;
const char * skipHtmlComment(const char *h, int *lines) ;
-bool parseTag(char *e, const char **name, int *namelen, const char **attr, const char **end, int *lines) ;
+eb_bool parseTag(char *e, const char **name, int *namelen, const char **attr, const char **end, int *lines) ;
char * htmlAttrVal(const char *e, const char *name) ;
-bool findEndScript(const char *h, const char *tagname, bool is_js, char **end_p, char **new_p, int *lines) ;
+eb_bool findEndScript(const char *h, const char *tagname, eb_bool is_js, char **end_p, char **new_p, int *lines) ;
void anchorSwap(char *buf) ;
-bool breakLine(const char *line, int len, int *newlen) ;
+eb_bool breakLine(const char *line, int len, int *newlen) ;
void breakLineSetup(void) ;
char * htmlReformat(const char *buf) ;
-char * andTranslate(const char *s, bool invisible) ;
+char * andTranslate(const char *s, eb_bool invisible) ;
void extractEmailAddresses(char *line) ;
void cutDuplicateEmails(char *tolist, char *cclist, const char *reply) ;
-bool looksBinary(const char *buf, int buflen) ;
-void looks_8859_utf8(const char *buf, int buflen, bool * iso_p, bool * utf8_p) ;
+eb_bool looksBinary(const char *buf, int buflen) ;
+void looks_8859_utf8(const char *buf, int buflen, eb_bool * iso_p, eb_bool * utf8_p) ;
void iso2utf(const char *inbuf, int inbuflen, char **outbuf_p, int *outbuflen_p) ;
void utf2iso(const char *inbuf, int inbuflen, char **outbuf_p, int *outbuflen_p) ;
void iuReformat(const char *inbuf, int inbuflen, char **outbuf_p, int *outbuflen_p) ;
/* sourcefile=cookies.c */
-bool domainSecurityCheck(const char *server, const char *domain) ;
-bool receiveCookie(const char *url, const char *str) ;
+eb_bool domainSecurityCheck(const char *server, const char *domain) ;
+eb_bool receiveCookie(const char *url, const char *str) ;
void cookiesFromJar(void) ;
-void sendCookies(char **s, int *l, const char *url, bool issecure) ;
+void sendCookies(char **s, int *l, const char *url, eb_bool issecure) ;
/* sourcefile=stringfile.c */
void * allocMem(size_t n) ;
@@ -172,7 +172,7 @@ char * appendString(char *s, const char *p) ;
char * prependString(char *s, const char *p) ;
void skipWhite(const char **s) ;
void stripWhite(char *s) ;
-void spaceCrunch(char *s, bool onespace, bool unprint) ;
+void spaceCrunch(char *s, eb_bool onespace, eb_bool unprint) ;
char * strmove(char *dest, const char *src) ;
char * initString(int *l) ;
void stringAndString(char **s, int *l, const char *t) ;
@@ -189,24 +189,24 @@ char * Cify(const char *s, int n) ;
char * pullString(const char *s, int l) ;
char * pullString1(const char *s, const char *t) ;
int stringIsNum(const char *s) ;
-bool stringIsFloat(const char *s, double *dp) ;
-bool stringIsPDF(const char *s) ;
-bool isSQL(const char *s) ;
-bool memEqualCI(const char *s, const char *t, int len) ;
+eb_bool stringIsFloat(const char *s, double *dp) ;
+eb_bool stringIsPDF(const char *s) ;
+eb_bool isSQL(const char *s) ;
+eb_bool memEqualCI(const char *s, const char *t, int len) ;
char * strstrCI(const char *base, const char *search) ;
-bool stringEqualCI(const char *s, const char *t) ;
+eb_bool stringEqualCI(const char *s, const char *t) ;
int stringInList(const char *const *list, const char *s) ;
int stringInListCI(const char *const *list, const char *s) ;
int charInList(const char *list, char c) ;
-bool listIsEmpty(const struct listHead * l) ;
+eb_bool listIsEmpty(const struct listHead * l) ;
void initList(struct listHead *l) ;
void delFromList(void *x) ;
void addToListFront(struct listHead *l, void *x) ;
void addToListBack(struct listHead *l, void *x) ;
void addAtPosition(void *p, void *x) ;
void freeList(struct listHead *l) ;
-bool isA(char c) ;
-bool isquote(char c) ;
+eb_bool isA(char c) ;
+eb_bool isquote(char c) ;
void errorPrint(const char *msg, ...) ;
void debugPrint(int lev, const char *msg, ...) ;
void nl(void) ;
@@ -214,11 +214,11 @@ int perl2c(char *t) ;
unsigned pstLength(pst s) ;
pst clonePstring(pst s) ;
void copyPstring(pst s, const pst t) ;
-bool fdIntoMemory(int fd, char **data, int *len) ;
-bool fileIntoMemory(const char *filename, char **data, int *len) ;
-bool memoryOutToFile(const char *filename, const char *data, int len, int msgcreate, int msgwrite) ;
+eb_bool fdIntoMemory(int fd, char **data, int *len) ;
+eb_bool fileIntoMemory(const char *filename, char **data, int *len) ;
+eb_bool memoryOutToFile(const char *filename, const char *data, int len, int msgcreate, int msgwrite) ;
void caseShift(char *s, char action) ;
-char fileTypeByName(const char *name, bool showlink) ;
+char fileTypeByName(const char *name, eb_bool showlink) ;
char fileTypeByHandle(int fd) ;
int fileSizeByName(const char *name) ;
int fileSizeByHandle(int fd) ;
@@ -228,8 +228,8 @@ int getche(void) ;
int getch(void) ;
char getLetter(const char *s) ;
char * nextScanFile(const char *base) ;
-bool sortedDirList(const char *dir, int *start, int *end) ;
-bool envFile(const char *line, const char **expanded) ;
+eb_bool sortedDirList(const char *dir, int *start, int *end) ;
+eb_bool envFile(const char *line, const char **expanded) ;
const char * currentOS(void) ;
const char * currentMachine(void) ;
FILE * efopen(const char *name, const char *mode) ;
@@ -240,40 +240,40 @@ void appendFileNF(const char *filename, const char *msg) ;
/* sourcefile=jsdom.c */
void * createJavaContext(void) ;
void freeJavaContext(void *jsc) ;
-void establish_innerHTML(void *jv, const char *start, const char *end, bool is_ta) ;
+void establish_innerHTML(void *jv, const char *start, const char *end, eb_bool is_ta) ;
void jMyContext(void) ;
-bool javaParseExecute(void *this, const char *str, const char *filename, int lineno) ;
+eb_bool javaParseExecute(void *this, const char *str, const char *filename, int lineno) ;
void * domLink(const char *classname, const char *symname, const char *idname, const char *href, const char *href_url, const char *list, void *owner, int radiosel) ;
/* sourcefile=jsloc.c */
-void establish_property_string(void *jv, const char *name, const char *value, bool readonly) ;
-void establish_property_number(void *jv, const char *name, int value, bool readonly) ;
-void establish_property_bool(void *jv, const char *name, bool value, bool readonly) ;
+void establish_property_string(void *jv, const char *name, const char *value, eb_bool readonly) ;
+void establish_property_number(void *jv, const char *name, int value, eb_bool readonly) ;
+void establish_property_eb_bool(void *jv, const char *name, eb_bool value, eb_bool readonly) ;
void * establish_property_array(void *jv, const char *name) ;
void establish_property_object(void *parent, const char *name, void *child) ;
-void establish_property_url(void *jv, const char *name, const char *url, bool readonly) ;
+void establish_property_url(void *jv, const char *name, const char *url, eb_bool readonly) ;
void set_property_string(void *jv, const char *name, const char *value) ;
void set_property_number(void *jv, const char *name, int value) ;
-void set_property_bool(void *jv, const char *name, int value) ;
-char * get_property_url(void *jv, bool doaction) ;
+void set_property_eb_bool(void *jv, const char *name, int value) ;
+char * get_property_url(void *jv, eb_bool doaction) ;
char * get_property_string(void *jv, const char *name) ;
-bool get_property_bool(void *jv, const char *name) ;
+eb_bool get_property_eb_bool(void *jv, const char *name) ;
char * get_property_option(void *jv) ;
void * establish_js_option(void *ev, int idx) ;
-bool handlerGo(void *obj, const char *name) ;
+eb_bool handlerGo(void *obj, const char *name) ;
void handlerSet(void *ev, const char *name, const char *code) ;
void link_onunload_onclick(void *jv) ;
-bool handlerPresent(void *ev, const char *name) ;
+eb_bool handlerPresent(void *ev, const char *name) ;
/* sourcefile=dbstubs.c */
-bool sqlReadRows(const char *filename, char **bufptr) ;
+eb_bool sqlReadRows(const char *filename, char **bufptr) ;
void dbClose(void) ;
void showColumns(void) ;
void showForeign(void) ;
-bool showTables(void) ;
-bool sqlDelRows(int start, int end) ;
-bool sqlUpdateRow(pst source, int slen, pst dest, int dlen) ;
-bool sqlAddRows(int ln) ;
-bool ebConnect(void) ;
+eb_bool showTables(void) ;
+eb_bool sqlDelRows(int start, int end) ;
+eb_bool sqlUpdateRow(pst source, int slen, pst dest, int dlen) ;
+eb_bool sqlAddRows(int ln) ;
+eb_bool ebConnect(void) ;
int goSelect(int *startLine, char **rbuf) ;
diff --git a/src/fetchmail.c b/src/fetchmail.c
index 46a083d..cc34ab7 100644
--- a/src/fetchmail.c
+++ b/src/fetchmail.c
@@ -28,18 +28,18 @@ struct MHINFO {
char ref[MHLINE]; /* references */
char cfn[MHLINE]; /* content file name */
uchar ct, ce; /* content type, content encoding */
- bool andOthers;
- bool doAttach;
- bool atimage;
- bool pgp;
+ eb_bool andOthers;
+ eb_bool doAttach;
+ eb_bool atimage;
+ eb_bool pgp;
uchar error64;
- bool ne; /* non english */
+ eb_bool ne; /* non english */
};
static int nattach; /* number of attachments */
static int nimages; /* number of attached images */
static char *firstAttach; /* name of first file */
-static bool mailIsHtml, mailIsSpam, mailIsBlack;
+static eb_bool mailIsHtml, mailIsSpam, mailIsBlack;
static char *fm; /* formatted mail string */
static int fm_l;
static struct MHINFO *lastMailInfo;
@@ -47,7 +47,7 @@ static char *lastMailText;
#define MAXIPBLACK 3000
static IP32bit ipblacklist[MAXIPBLACK];
static IP32bit ipblackmask[MAXIPBLACK];
-static bool ipblackcomp[MAXIPBLACK];
+static eb_bool ipblackcomp[MAXIPBLACK];
static int nipblack;
void
@@ -120,37 +120,37 @@ loadBlacklist(void)
debugPrint(3, "%d ip addresses in blacklist", nipblack);
} /* loadBlacklist */
-bool
+eb_bool
onBlacklist1(IP32bit tip)
{
IP32bit blip; /* black ip */
IP32bit mask;
int j;
for(j = 0; j < nipblack; ++j) {
- bool comp = ipblackcomp[j];
+ eb_bool comp = ipblackcomp[j];
blip = ipblacklist[j];
mask = ipblackmask[j];
if((tip ^ blip) & mask)
continue;
if(comp)
- return false;
+ return eb_false;
debugPrint(3, "blocked by rule %d", j + 1);
- return true;
+ return eb_true;
}
- return false;
+ return eb_false;
} /* onBlacklist1 */
-static bool
+static eb_bool
onBlacklist(void)
{
IP32bit *ipp = cw->iplist;
IP32bit tip; /* test ip */
if(!ipp)
- return false;
+ return eb_false;
while((tip = *ipp++) != NULL_IP)
if(onBlacklist1(tip))
- return true;
- return false;
+ return eb_true;
+ return eb_false;
} /* onBlacklist */
static void
@@ -168,12 +168,12 @@ freeMailInfo(struct MHINFO *w)
} /* freeMailInfo */
static char *
-getFileName(const char *defname, bool isnew)
+getFileName(const char *defname, eb_bool isnew)
{
static char buf[ABSPATH];
int l;
char *p;
- while(true) {
+ while(eb_true) {
i_printf(MSG_FileName);
if(defname)
printf("[%s] ", defname);
@@ -192,7 +192,7 @@ getFileName(const char *defname, bool isnew)
p = buf;
} else
defname = 0;
- if(isnew && fileTypeByName(p, false)) {
+ if(isnew && fileTypeByName(p, eb_false)) {
i_printf(MSG_FileExists, p);
defname = 0;
continue;
@@ -201,7 +201,7 @@ getFileName(const char *defname, bool isnew)
}
} /* getFileName */
-static bool ignoreImages;
+static eb_bool ignoreImages;
static void
writeAttachment(struct MHINFO *w)
@@ -221,11 +221,11 @@ writeAttachment(struct MHINFO *w)
atname = "x";
} else {
i_printf(MSG_Att);
- atname = getFileName((w->cfn[0] ? w->cfn : 0), true);
+ atname = getFileName((w->cfn[0] ? w->cfn : 0), eb_true);
/* X is like x, but deletes all future images */
if(stringEqual(atname, "X")) {
atname = "x";
- ignoreImages = true;
+ ignoreImages = eb_true;
}
}
if(!ismc && stringEqual(atname, "e")) {
@@ -236,13 +236,13 @@ writeAttachment(struct MHINFO *w)
if(cx == MAXSESSION) {
i_printf(MSG_AttNoBuffer);
} else {
- cxSwitch(cx, false);
+ cxSwitch(cx, eb_false);
i_printf(MSG_SessionX, cx);
- if(!addTextToBuffer((pst) w->start, w->end - w->start, 0, false))
+ if(!addTextToBuffer((pst) w->start, w->end - w->start, 0, eb_false))
i_printf(MSG_AttNoCopy, cx);
else if(w->cfn[0])
cw->fileName = cloneString(w->cfn);
- cxSwitch(svcx, false); /* back to where we were */
+ cxSwitch(svcx, eb_false); /* back to where we were */
}
} else if(!stringEqual(atname, "x")) {
int fh = open(atname, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, 0666);
@@ -373,16 +373,16 @@ fetchMail(int account)
for(m = 1; m <= nmsgs; ++m) {
char retrbuf[5000];
- bool retr1;
+ eb_bool retr1;
/* Grab the message */
sprintf(serverLine, "retr %d%s", m, eol);
- if(!mailPutLine(serverLine, false))
+ if(!mailPutLine(serverLine, eb_false))
showErrorAbort();
mailstring = initString(&mailstring_l);
- retr1 = true;
- while(true) {
+ retr1 = eb_true;
+ while(eb_true) {
int nr;
if(a->inssl)
nr = ssl_read(retrbuf, sizeof (retrbuf));
@@ -412,7 +412,7 @@ fetchMail(int account)
++j;
nr -= j;
memmove(retrbuf, retrbuf + j, nr);
- retr1 = false;
+ retr1 = eb_false;
}
if(nr)
@@ -465,7 +465,7 @@ fetchMail(int account)
mailstring = 0;
sprintf(serverLine, "dele %d%s", m, eol);
- if(!mailPutLine(serverLine, false))
+ if(!mailPutLine(serverLine, eb_false))
showErrorAbort();
if(!mailGetLine())
i_printfExit(MSG_MailTimeOver);
@@ -511,7 +511,7 @@ scanMail(void)
const char *redirect = 0; /* send mail elsewhere */
char key;
const char *atname; /* name of attachment */
- bool delflag = false; /* delete this mail */
+ eb_bool delflag = eb_false; /* delete this mail */
int displine;
int stashNumber = -1;
@@ -531,7 +531,7 @@ scanMail(void)
cxQuit(1, 2);
cs = 0;
linesReset();
- cxSwitch(1, false);
+ cxSwitch(1, eb_false);
/* Now grab the entire message */
unreadStats();
@@ -543,10 +543,10 @@ scanMail(void)
iuReformat(mailstring, mailstring_l, &mailu8, &mailu8_l);
if(mailu8) {
- if(!addTextToBuffer((pst) mailu8, mailu8_l, 0, false))
+ if(!addTextToBuffer((pst) mailu8, mailu8_l, 0, eb_false))
showErrorAbort();
} else {
- if(!addTextToBuffer((pst) mailstring, mailstring_l, 0, false))
+ if(!addTextToBuffer((pst) mailstring, mailstring_l, 0, eb_false))
showErrorAbort();
}
@@ -559,7 +559,7 @@ scanMail(void)
}
if(redirect) {
- delflag = true;
+ delflag = eb_true;
key = 'w';
if(*redirect == '-')
++redirect, key = 'u';
@@ -583,7 +583,7 @@ scanMail(void)
/* display the next page of mail and get a command from the keyboard */
displine = 1;
- while(true) {
+ while(eb_true) {
if(!delflag) { /* show next page */
nextpage:
if(displine <= cw->dol) {
@@ -598,7 +598,7 @@ scanMail(void)
}
/* get key command */
- while(true) {
+ while(eb_true) {
if(!delflag) {
/* interactive prompt depends on whether there is more text or not */
printf("%c ", displine > cw->dol ? '?' : '*');
@@ -618,7 +618,7 @@ scanMail(void)
case 'd':
i_puts(MSG_Delete);
- delflag = true;
+ delflag = eb_true;
goto afterinput;
case 'i':
@@ -636,11 +636,11 @@ scanMail(void)
continue;
ipblacklist[nipblack] = addr;
ipblackmask[nipblack] = 0xffffffff;
- ipblackcomp[nipblack] = false;
+ ipblackcomp[nipblack] = eb_false;
++nipblack;
}
}
- delflag = true;
+ delflag = eb_true;
goto afterinput;
case 'j':
@@ -648,7 +648,7 @@ scanMail(void)
i_puts(MSG_Junk);
if(!junkSubject(lastMailInfo->subject, key))
continue;
- delflag = true;
+ delflag = eb_true;
goto afterinput;
case ' ':
@@ -671,14 +671,14 @@ scanMail(void)
}
/* At this point we're saving the mail somewhere. */
- delflag = true;
+ delflag = eb_true;
atname = redirect;
savemail:
if(!atname)
- atname = getFileName(0, false);
+ atname = getFileName(0, eb_false);
if(!stringEqual(atname, "x")) {
- char exists = fileTypeByName(atname, false);
+ char exists = fileTypeByName(atname, eb_false);
int fsize; /* file size */
int fh =
open(atname, O_WRONLY | O_TEXT | O_CREAT | O_APPEND,
@@ -720,7 +720,7 @@ scanMail(void)
for(j = 0; j < 20; ++j) {
int rn = rand() % 100000; /* random number */
sprintf(rmf, "%s/%05d", mailStash, rn);
- if(fileTypeByName(rmf, false))
+ if(fileTypeByName(rmf, eb_false))
continue;
/* dump the original mail into the file */
rmfh =
@@ -852,7 +852,7 @@ static const char *const mhwords[] = {
/* Before we render a mail message, let's make sure it looks like email.
* This is similar to htmlTest() in html.c. */
-bool
+eb_bool
emailTest(void)
{
int i, j, k, n;
@@ -885,10 +885,10 @@ emailTest(void)
++k;
}
if(k >= 4 && k * 2 >= j)
- return true;
+ return eb_true;
} /* loop over lines */
- return false;
+ return eb_false;
} /* emailTest */
static uchar
@@ -911,12 +911,12 @@ static void
unpack64(struct MHINFO *w)
{
uchar val, leftover, mod;
- bool equals;
+ eb_bool equals;
char c, *q, *r;
/* Since this is a copy, and the unpacked version is always
* smaller, just unpack it inline. */
mod = 0;
- equals = false;
+ equals = eb_false;
for(q = r = w->start; q < w->end; ++q) {
c = *q;
if(isspaceByte(c))
@@ -929,7 +929,7 @@ unpack64(struct MHINFO *w)
break;
}
if(c == '=') {
- equals = true;
+ equals = eb_true;
continue;
}
val = unb64(c);
@@ -992,7 +992,7 @@ unpack64inline(char *start, char *end)
struct MHINFO m;
m.start = start;
m.end = end;
- m.error64 = false;
+ m.error64 = eb_false;
unpack64(&m);
return m.end;
} /* unpack64inline */
@@ -1014,7 +1014,7 @@ unpackUploadedFile(const char *post, const char *boundary,
post2 = cloneString(post);
b2 = strstr(post2, boundary);
- while(true) {
+ while(eb_true) {
b1 = b2 + boundlen;
if(*b1 != '\r')
break;
@@ -1246,7 +1246,7 @@ headerGlean(char *start, char *end)
initList(&w->components);
w->ct = CT_OTHER;
w->ce = CE_8BIT;
- w->andOthers = false;
+ w->andOthers = eb_false;
w->tolist = initString(&w->tolen);
w->cclist = initString(&w->cclen);
w->start = start, w->end = end;
@@ -1383,7 +1383,7 @@ headerGlean(char *start, char *end)
quote = 0;
for(q = w->to; *q; ++q) {
if(*q == ',' && !quote) {
- w->andOthers = true;
+ w->andOthers = eb_true;
break;
}
if(*q == '"') {
@@ -1413,14 +1413,14 @@ headerGlean(char *start, char *end)
if(w->cclen)
stringAndChar(&w->cclist, &w->cclen, ',');
stringAndBytes(&w->cclist, &w->cclen, q, vr - q);
- w->andOthers = true;
+ w->andOthers = eb_true;
continue;
}
if(memEqualCI(s, "content-type:", q - s)) {
linetype = 'c';
if(memEqualCI(vl, "application/pgp-signature", 25))
- w->pgp = true;
+ w->pgp = eb_true;
if(memEqualCI(vl, "text", 4))
w->ct = CT_RICH;
if(memEqualCI(vl, "text/html", 9))
@@ -1520,12 +1520,12 @@ headerGlean(char *start, char *end)
if(w->ce == CE_64)
unpack64(w);
if(w->ce == CE_64 && w->ct == CT_OTHER || w->ct == CT_APPLIC || w->cfn[0]) {
- w->doAttach = true;
+ w->doAttach = eb_true;
++nattach;
q = w->cfn;
if(*q) { /* name present */
if(stringEqual(q, "winmail.dat")) {
- w->atimage = true;
+ w->atimage = eb_true;
++nimages;
} else if((q = strrchr(q, '.'))) {
static const char *const imagelist[] = {
@@ -1534,7 +1534,7 @@ headerGlean(char *start, char *end)
/* the asc isn't an image, it's a signature card. */
/* Similarly for the winmail.dat */
if(stringInListCI(imagelist, q + 1) >= 0) {
- w->atimage = true;
+ w->atimage = eb_true;
++nimages;
}
}
@@ -1547,7 +1547,7 @@ headerGlean(char *start, char *end)
/* loop over the mime components */
if(w->ct == CT_MULTI || w->ct == CT_ALT) {
char *lastbound = 0;
- bool endmode = false;
+ eb_bool endmode = eb_false;
struct MHINFO *child;
/* We really need the -1 here, because sometimes the boundary will
* be the very first thing in the message body. */
@@ -1559,7 +1559,7 @@ headerGlean(char *start, char *end)
}
q = t + 3 + w->boundlen;
while(*q == '-')
- endmode = true, ++q;
+ endmode = eb_true, ++q;
if(*q == '\n')
++q;
debugPrint(5, "boundary found at offset %d", t - w->start);
@@ -1650,18 +1650,18 @@ headerGlean(char *start, char *end)
}
w->start = start = s;
- w->ne = false;
+ w->ne = eb_false;
return w;
} /* headerGlean */
static char *
-headerShow(struct MHINFO *w, bool top)
+headerShow(struct MHINFO *w, eb_bool top)
{
static char buf[(MHLINE + 30) * 4];
static char lastsubject[MHLINE];
char *s;
- bool lines = false;
+ eb_bool lines = eb_false;
buf[0] = 0;
if(!(w->subject[0] | w->from[0] | w->reply[0]))
@@ -1669,7 +1669,7 @@ headerShow(struct MHINFO *w, bool top)
if(!top) {
strcpy(buf, "Message");
- lines = true;
+ lines = eb_true;
if(w->from[0]) {
strcat(buf, " from ");
strcat(buf, w->from);
@@ -1718,13 +1718,13 @@ headerShow(struct MHINFO *w, bool top)
/* This is at the top of the file */
if(w->subject[0]) {
sprintf(buf, "Subject: %s\n", w->subject);
- lines = true;
+ lines = eb_true;
}
if(nattach && ismc) {
char atbuf[20];
if(lines & mailIsHtml)
strcat(buf, "<br>");
- lines = true;
+ lines = eb_true;
if(nimages) {
sprintf(atbuf, "%d images\n", nimages);
if(nimages == 1)
@@ -1750,7 +1750,7 @@ headerShow(struct MHINFO *w, bool top)
if(w->to[0] && !ismc) {
if(lines & mailIsHtml)
strcat(buf, "<br>");
- lines = true;
+ lines = eb_true;
strcat(buf, "To ");
strcat(buf, w->to);
if(w->andOthers)
@@ -1760,7 +1760,7 @@ headerShow(struct MHINFO *w, bool top)
if(w->from[0]) {
if(lines & mailIsHtml)
strcat(buf, "<br>");
- lines = true;
+ lines = eb_true;
strcat(buf, "From ");
strcat(buf, w->from);
strcat(buf, "\n");
@@ -1768,7 +1768,7 @@ headerShow(struct MHINFO *w, bool top)
if(w->date[0] && !ismc) {
if(lines & mailIsHtml)
strcat(buf, "<br>");
- lines = true;
+ lines = eb_true;
strcat(buf, "Mail sent ");
strcat(buf, w->date);
strcat(buf, "\n");
@@ -1776,7 +1776,7 @@ headerShow(struct MHINFO *w, bool top)
if(w->reply[0]) {
if(lines & mailIsHtml)
strcat(buf, "<br>");
- lines = true;
+ lines = eb_true;
strcat(buf, "Reply to ");
strcat(buf, w->reply);
strcat(buf, "\n");
@@ -1826,7 +1826,7 @@ mailTextType(struct MHINFO *w)
} /* mailTextType */
static void
-formatMail(struct MHINFO *w, bool top)
+formatMail(struct MHINFO *w, eb_bool top)
{
struct MHINFO *v;
int ct = w->ct;
@@ -1862,7 +1862,7 @@ formatMail(struct MHINFO *w, bool top)
foreach(v, w->components) {
if(end > start)
stringAndString(&fm, &fm_l, mailIsHtml ? "<P>\n" : "\n");
- formatMail(v, false);
+ formatMail(v, eb_false);
}
return;
@@ -1870,7 +1870,7 @@ formatMail(struct MHINFO *w, bool top)
if(ct == CT_MULTI) {
foreach(v, w->components)
- formatMail(v, false);
+ formatMail(v, eb_false);
return;
}
@@ -1893,7 +1893,7 @@ formatMail(struct MHINFO *w, bool top)
++j;
if(j != best)
continue;
- formatMail(v, false);
+ formatMail(v, eb_false);
break;
}
} /* formatMail */
@@ -1905,20 +1905,20 @@ emailParse(char *buf)
struct MHINFO *w, *v;
nattach = nimages = 0;
firstAttach = 0;
- mailIsHtml = mailIsSpam = ignoreImages = false;
+ mailIsHtml = mailIsSpam = ignoreImages = eb_false;
fm = initString(&fm_l);
w = headerGlean(buf, buf + strlen(buf));
mailIsHtml = (mailTextType(w) == CT_HTML);
if(w->ne)
- mailIsSpam = true;
+ mailIsSpam = eb_true;
else if(w->ct == CT_ALT) {
foreach(v, w->components)
if(v->ne)
- mailIsSpam = true;
+ mailIsSpam = eb_true;
}
if(mailIsHtml)
stringAndString(&fm, &fm_l, "<html>\n");
- formatMail(w, true);
+ formatMail(w, eb_true);
/* Remember, we always need a nonzero buffer */
if(!fm_l || fm[fm_l - 1] != '\n')
stringAndChar(&fm, &fm_l, '\n');
@@ -1955,34 +1955,34 @@ grab the message id and reference it.
Also, if mailing to all, stick in the other recipients.
*********************************************************************/
-bool
-setupReply(bool all)
+eb_bool
+setupReply(eb_bool all)
{
int subln, repln;
char linetype[8];
int j;
char *out, *s, *t;
- bool rc;
+ eb_bool rc;
/* basic sanity */
if(cw->dirMode) {
setError(MSG_ReDir);
- return false;
+ return eb_false;
}
if(cw->sqlMode) {
setError(MSG_ReDB);
- return false;
+ return eb_false;
}
if(!cw->dol) {
setError(MSG_ReEmpty);
- return false;
+ return eb_false;
}
if(cw->binMode) {
setError(MSG_ReBinary);
- return false;
+ return eb_false;
}
subln = repln = 0;
@@ -2038,7 +2038,7 @@ setupReply(bool all)
if(!subln || !repln) {
setError(MSG_ReSubjectReply);
- return false;
+ return eb_false;
}
/* delete the lines we don't need */
@@ -2080,9 +2080,9 @@ setupReply(bool all)
if(!cw->mailInfo) {
if(all) {
setError(MSG_ReNoInfo);
- return false;
+ return eb_false;
}
- return true; /* that's all we can do */
+ return eb_true; /* that's all we can do */
}
/* Build the header lines and put them in the buffer */
@@ -2125,9 +2125,9 @@ setupReply(bool all)
stringAndChar(&out, &j, '\n');
}
- rc = true;
+ rc = eb_true;
if(j)
- rc = addTextToBuffer((unsigned char *)out, j, 1, false);
+ rc = addTextToBuffer((unsigned char *)out, j, 1, eb_false);
nzFree(out);
return rc;
} /* setupReply */
diff --git a/src/format.c b/src/format.c
index 9e115c2..e9e55ec 100644
--- a/src/format.c
+++ b/src/format.c
@@ -54,8 +54,8 @@ const char *
skipHtmlComment(const char *h, int *lines)
{
int lns = 0;
- bool comm = h[2] == '-' && h[3] == '-';
- bool php = memEqualCI(h + 1, "?php", 4);
+ eb_bool comm = h[2] == '-' && h[3] == '-';
+ eb_bool php = memEqualCI(h + 1, "?php", 4);
h += comm ? 4 : 2;
while(*h) {
@@ -103,7 +103,7 @@ skipHtmlComment(const char *h, int *lines)
} /* skipHtmlComment */
/* an attribute character */
-static bool
+static eb_bool
atchr(char c)
{
return (c > ' ' && c != '=' && c != '<' && c != '>');
@@ -120,26 +120,26 @@ end points to first character past the html tag.
lines records the number of newlines consumed by the tag.
*********************************************************************/
-bool htmlAttrVal_nl; /* allow nl in attribute values */
+eb_bool htmlAttrVal_nl; /* allow nl in attribute values */
-bool
+eb_bool
parseTag(char *e,
const char **name, int *namelen, const char **attr, const char **end,
int *lines)
{
int lns = 0;
if(*e++ != '<')
- return false;
+ return eb_false;
if(name)
*name = e;
if(*e == '/')
e++;
if(!isA(*e))
- return false;
+ return eb_false;
while(isA(*e) || *e == '=')
++e;
if(!isspaceByte(*e) && *e != '>' && *e != '<' && *e != '/' && *e != ':')
- return false;
+ return eb_false;
/* Note that name includes the leading / */
if(name && namelen)
*namelen = e - *name;
@@ -151,14 +151,14 @@ parseTag(char *e,
}
/* should be the start of the first attribute, or < or > */
if(!atchr(*e) && *e != '>' && *e != '<')
- return false;
+ return eb_false;
if(attr)
*attr = e;
nextattr:
if(*e == '>' || *e == '<')
goto en;
if(!atchr(*e))
- return false;
+ return eb_false;
while(atchr(*e))
++e;
while(isspaceByte(*e)) {
@@ -184,7 +184,7 @@ parseTag(char *e,
++e;
}
if(*e != uu)
- return false;
+ return eb_false;
++e;
if(*e == uu) {
/* lots of tags end with an extra quote */
@@ -209,7 +209,7 @@ parseTag(char *e,
*end = e + (*e == '>');
if(lines)
*lines = lns;
- return true;
+ return eb_true;
} /* parseTag */
/* Don't know why he didn't use the stringAndChar() functions, but he
@@ -299,7 +299,7 @@ htmlAttrVal(const char *e, const char *name)
valChar(&a, &l, 0); /* null terminate */
if(strchr(a, '&')) {
b = a;
- a = andTranslate(b, true);
+ a = andTranslate(b, eb_true);
nzFree(b);
}
/* strip leading and trailing spaces.
@@ -319,12 +319,12 @@ Result parameters:
end of the script, the extracted script, and the number of newlines.
*********************************************************************/
-bool
+eb_bool
findEndScript(const char *h, const char *tagname,
- bool is_js, char **end_p, char **new_p, int *lines)
+ eb_bool is_js, char **end_p, char **new_p, int *lines)
{
char *end;
- bool rc = true;
+ eb_bool rc = eb_true;
const char *s = h;
char look[12];
int js_nl = 0;
@@ -334,7 +334,7 @@ findEndScript(const char *h, const char *tagname,
retry:
end = strstrCI(s, look);
if(!end) {
- rc = false;
+ rc = eb_false;
browseError(MSG_CloseTag, look);
end = (char *)h + strlen(h);
} else if(is_js) {
@@ -404,8 +404,8 @@ void
anchorSwap(char *buf)
{
char c, d, *s, *ss, *w, *a;
- bool premode, pretag, state_braces, state_text, state_atext;
- bool strong, change, slash;
+ eb_bool premode, pretag, state_braces, state_text, state_atext;
+ eb_bool strong, change, slash;
int n, cnt;
char tag[20];
@@ -471,11 +471,11 @@ anchorSwap(char *buf)
*w = 0;
cnt = 0;
- change = true;
+ change = eb_true;
while(change) {
- change = false;
+ change = eb_false;
++cnt;
- premode = state_text = state_atext = state_braces = false;
+ premode = state_text = state_atext = state_braces = eb_false;
/* w represents the state of whitespace */
w = 0;
/* a represents the state of being in an anchor */
@@ -494,7 +494,7 @@ anchorSwap(char *buf)
((!state_braces) & !state_text))) {
memmove(a, w, s - w);
memmove(a + (s - w), tag, n);
- change = true;
+ change = eb_true;
w = 0;
}
@@ -529,10 +529,10 @@ anchorSwap(char *buf)
((!state_braces) & state_text)))) {
memmove(w + n, w, s - w);
memcpy(w, tag, n);
- change = true;
+ change = eb_true;
w += n;
if(d == '}')
- state_braces = false;
+ state_braces = eb_false;
s = ss;
continue;
}
@@ -541,24 +541,24 @@ anchorSwap(char *buf)
w = 0;
if(d == '{') {
- state_braces = state_text = true;
- state_atext = false;
+ state_braces = state_text = eb_true;
+ state_atext = eb_false;
a = s;
s = ss;
continue;
}
if(d == '}') {
- state_braces = false;
+ state_braces = eb_false;
s = ss;
continue;
}
if(d == '*') {
if(state_braces)
- state_atext = true;
+ state_atext = eb_true;
else
- state_text = true;
+ state_text = eb_true;
a = s;
s = ss;
continue;
@@ -573,9 +573,9 @@ anchorSwap(char *buf)
normalChar:
w = 0; /* no more whitespace */
if(state_braces)
- state_atext = true;
+ state_atext = eb_true;
else
- state_text = true;
+ state_text = eb_true;
/* end of loop over the chars in the buffer */
}
/* end of loop making changes */
@@ -654,7 +654,7 @@ anchorSwap(char *buf)
debugPrint(3, "anchors unframed");
/* Now compress the implied linebreaks into one. */
- premode = false;
+ premode = eb_false;
for(s = buf; c = *s; ++s) {
if(c == InternalCodeChar && isdigitByte(s[1])) {
n = strtol(s + 1, &s, 10);
@@ -666,11 +666,11 @@ anchorSwap(char *buf)
}
if(!isspaceByte(c))
continue;
- strong = false;
+ strong = eb_false;
a = 0;
for(w = s; isspaceByte(*w); ++w) {
if(*w == '\n' || *w == '\f')
- strong = true;
+ strong = eb_true;
if(*w == '\r' && !a)
a = w;
}
@@ -699,7 +699,7 @@ The prefix bl means breakline.
*********************************************************************/
static char *bl_start, *bl_cursor, *bl_end;
-static bool bl_overflow;
+static eb_bool bl_overflow;
static int colno; /* column number */
static const int optimalLine = 80; /* optimal line length */
static const int cutLineAfter = 36; /* cut sentence after this column */
@@ -751,12 +751,12 @@ static void
appendOneChar(char c)
{
if(bl_cursor == bl_end)
- bl_overflow = true;
+ bl_overflow = eb_true;
else
*bl_cursor++ = c;
} /* appendOneChar */
-static bool
+static eb_bool
spaceNotInInput(void)
{
char *t = bl_cursor;
@@ -764,10 +764,10 @@ spaceNotInInput(void)
for(--t; t >= bl_start; --t) {
c = *t;
if(c == '\n' || c == '\r')
- return true;
+ return eb_true;
if(c == '>' && t >= bl_start + 2 &&
t[-1] == '0' && t[-2] == InternalCodeChar)
- return true;
+ return eb_true;
if(c != '<')
continue;
while(t > bl_start && isdigitByte(t[-1]))
@@ -775,13 +775,13 @@ spaceNotInInput(void)
if(*t == '<')
continue;
if(t > bl_start && t[-1] == InternalCodeChar)
- return false;
+ return eb_false;
}
- return true;
+ return eb_true;
} /* spaceNotInInput */
static void
-appendSpaceChunk(const char *chunk, int len, bool premode)
+appendSpaceChunk(const char *chunk, int len, eb_bool premode)
{
int nlc = pre_cr; /* newline count */
int spc = 0; /* space count */
@@ -814,7 +814,7 @@ appendSpaceChunk(const char *chunk, int len, bool premode)
if(strchr(")\"|}", d))
e = c;
if(strchr(".?!:", e)) {
- bool ok = true;
+ eb_bool ok = eb_true;
/* Check for Mr. Mrs. and others. */
if(e == '.' && bl_cursor - bl_start > 10) {
static const char *const prefix[] =
@@ -829,10 +829,10 @@ appendSpaceChunk(const char *chunk, int len, bool premode)
trailing[i] = 0;
for(i = 0; prefix[i]; ++i)
if(strstr(trailing, prefix[i]))
- ok = false;
+ ok = eb_false;
/* Check for John C. Calhoon */
if(isupperByte(bl_cursor[-2]) && isspaceByte(bl_cursor[-3]))
- ok = false;
+ ok = eb_false;
}
if(ok)
lperiod = colno, idxperiod = l;
@@ -904,7 +904,7 @@ appendSpaceChunk(const char *chunk, int len, bool premode)
} /* appendSpaceChunk */
static void
-appendPrintableChunk(const char *chunk, int len, bool premode)
+appendPrintableChunk(const char *chunk, int len, eb_bool premode)
{
int i, j;
for(i = 0; i < len; ++i)
@@ -940,11 +940,11 @@ appendPrintableChunk(const char *chunk, int len, bool premode)
/* Break up a line using the above routines.
* The buffer for the new text must be supplied.
- * Return false (fail) if we ran out of room.
+ * Return eb_false (fail) if we ran out of room.
* This function is called from bufsup.c, implementing the bl command,
* and is only in this file because it shares the above routines and variables
* with the html reformatting, which really has to be here. */
-bool
+eb_bool
breakLine(const char *line, int len, int *newlen)
{
char c, state, newstate;
@@ -967,7 +967,7 @@ breakLine(const char *line, int len, int *newlen)
lspace == 3;
bl_start = bl_cursor = replaceLine;
bl_end = replaceLine + REPLACELINELEN - 8;
- bl_overflow = false;
+ bl_overflow = eb_false;
colno = 1;
longcut = lperiod = lcomma = lright = lany = 0;
last = 0;
@@ -990,9 +990,9 @@ breakLine(const char *line, int len, int *newlen)
/* state change here */
debugChunk(line + last, i - last);
if(state == 1)
- appendSpaceChunk(line + last, i - last, false);
+ appendSpaceChunk(line + last, i - last, eb_false);
else
- appendPrintableChunk(line + last, i - last, false);
+ appendPrintableChunk(line + last, i - last, eb_false);
last = i;
state = newstate;
pre_cr = 0;
@@ -1001,13 +1001,13 @@ breakLine(const char *line, int len, int *newlen)
if(state) { /* last token */
debugChunk(line + last, len - last);
if(state == 1)
- appendSpaceChunk(line + last, len - last, false);
+ appendSpaceChunk(line + last, len - last, eb_false);
else
- appendPrintableChunk(line + last, len - last, false);
+ appendPrintableChunk(line + last, len - last, eb_false);
}
if(lspace < 2) { /* line didn't have a \r at the end */
- appendSpaceChunk("\n", 1, false);
+ appendSpaceChunk("\n", 1, eb_false);
}
if(bl_cursor - bl_start > paraLine)
lspace = 4;
@@ -1027,8 +1027,8 @@ htmlReformat(const char *buf)
{
const char *h, *nh, *s;
char c;
- bool premode = false;
- bool pretag, slash;
+ eb_bool premode = eb_false;
+ eb_bool pretag, slash;
char *new;
int l, tagno;
@@ -1038,7 +1038,7 @@ htmlReformat(const char *buf)
lspace = 3;
bl_start = bl_cursor = replaceLine;
bl_end = replaceLine + REPLACELINELEN - 8;
- bl_overflow = false;
+ bl_overflow = eb_false;
new = initString(&l);
for(h = buf; (c = *h); h = nh) {
@@ -1093,13 +1093,13 @@ htmlReformat(const char *buf)
for(s = h + 1; isdigitByte(*s); ++s) ;
if(*s != '{')
continue;
- appendSpaceChunk("\n", 1, false);
+ appendSpaceChunk("\n", 1, eb_false);
nh = h;
} /* loop over text */
/* close off the last line */
if(lspace < 2)
- appendSpaceChunk("\n", 1, true);
+ appendSpaceChunk("\n", 1, eb_true);
if(bl_cursor > bl_start)
stringAndBytes(&new, &l, bl_start, bl_cursor - bl_start);
/* Get rid of last space. */
@@ -1171,13 +1171,13 @@ The new string is allocated.
*********************************************************************/
char *
-andTranslate(const char *s, bool invisible)
+andTranslate(const char *s, eb_bool invisible)
{
char *new;
int l, n, j;
uchar c, d;
uchar alnum = 0; /* was last char an alphanumeric */
- bool premode = false;
+ eb_bool premode = eb_false;
char andbuf[16];
static const char *const andwords[] = {
@@ -1410,7 +1410,7 @@ andTranslate(const char *s, bool invisible)
while(isdigitByte(*t))
++t;
if(t > s + 1 && *t && strchr("{}<>*", *t)) { /* it's a tag */
- bool separate, pretag, slash;
+ eb_bool separate, pretag, slash;
n = atoi(s + 1);
preFormatCheck(n, &pretag, &slash);
separate = (*t != '*');
@@ -1580,7 +1580,7 @@ extractEmailAddresses(char *line)
}
*t = 0;
- spaceCrunch(line, true, false);
+ spaceCrunch(line, eb_true, eb_false);
for(s = line; c = *s; ++s)
if(c == ' ')
*s = ',';
@@ -1665,7 +1665,7 @@ but if there's too many such chars, I call it binary.
It's not an exact science.
*********************************************************************/
-bool
+eb_bool
looksBinary(const char *buf, int buflen)
{
int i, bincount = 0;
@@ -1678,7 +1678,7 @@ looksBinary(const char *buf, int buflen)
} /* looksBinary */
void
-looks_8859_utf8(const char *buf, int buflen, bool * iso_p, bool * utf8_p)
+looks_8859_utf8(const char *buf, int buflen, eb_bool * iso_p, eb_bool * utf8_p)
{
int utfcount = 0, isocount = 0;
int i, j, bothcount;
@@ -1705,16 +1705,16 @@ looks_8859_utf8(const char *buf, int buflen, bool * iso_p, bool * utf8_p)
i = j - 1;
}
- *iso_p = *utf8_p = false;
+ *iso_p = *utf8_p = eb_false;
bothcount = isocount + utfcount;
if(!bothcount)
return; /* ascii */
bothcount *= 6;
if(utfcount * 7 >= bothcount)
- *utf8_p = true;
+ *utf8_p = eb_true;
if(isocount * 7 >= bothcount)
- *iso_p = true;
+ *iso_p = eb_true;
} /* looks_8859_utf8 */
/*********************************************************************
@@ -1859,7 +1859,7 @@ utf2iso(const char *inbuf, int inbuflen, char **outbuf_p, int *outbuflen_p)
void
iuReformat(const char *inbuf, int inbuflen, char **outbuf_p, int *outbuflen_p)
{
- bool is8859, isutf8;
+ eb_bool is8859, isutf8;
*outbuf_p = 0;
*outbuflen_p = 0;
diff --git a/src/html.c b/src/html.c
index 7ed550f..f3f5858 100644
--- a/src/html.c
+++ b/src/html.c
@@ -50,7 +50,7 @@ static int ntags; /* number of tags in this page */
static char *topAttrib;
static char *basehref;
static struct htmlTag *currentForm; /* the open form */
-bool parsePage; /* parsing html */
+eb_bool parsePage; /* parsing html */
int browseLine; /* for error reporting */
static char *radioChecked;
static int radioChecked_l;
@@ -75,23 +75,23 @@ buildTagArray(void)
tagArray[j] = 0;
} /* buildTagArray */
-static bool
+static eb_bool
htmlAttrPresent(const char *e, const char *name)
{
char *a;
if(!(a = htmlAttrVal(e, name)))
- return false;
+ return eb_false;
nzFree(a);
- return true;
+ return eb_true;
} /* htmlAttrPresent */
static char *
hrefVal(const char *e, const char *name)
{
char *a;
- htmlAttrVal_nl = true;
+ htmlAttrVal_nl = eb_true;
a = htmlAttrVal(e, name);
- htmlAttrVal_nl = false; /* put it back */
+ htmlAttrVal_nl = eb_false; /* put it back */
return a;
} /* hrefVal */
@@ -144,7 +144,7 @@ struct tagInfo {
int action;
uchar nest; /* must nest, like parentheses */
uchar para; /* paragraph and line breaks */
- ushort bits; /* a bunch of boolean attributes */
+ ushort bits; /* a bunch of eb_boolean attributes */
};
static const struct tagInfo elements[] = {
@@ -238,21 +238,21 @@ struct htmlTag {
const struct tagInfo *info;
/* the form that owns this input tag, etc */
struct htmlTag *controller;
- bool slash:1; /* as in </A> */
- bool balanced:1; /* <foo> and </foo> */
- bool retain:1;
- bool multiple:1;
- bool rdonly:1;
- bool clickable:1; /* but not an input field */
- bool secure:1;
- bool checked:1;
- bool rchecked:1; /* for reset */
- bool post:1; /* post, rather than get */
- bool javapost:1; /* post by calling javascript */
- bool mime:1; /* encode as mime, rather than url encode */
- bool bymail:1; /* send by mail, rather than http */
- bool submitted:1;
- bool handler:1;
+ eb_bool slash:1; /* as in </A> */
+ eb_bool balanced:1; /* <foo> and </foo> */
+ eb_bool retain:1;
+ eb_bool multiple:1;
+ eb_bool rdonly:1;
+ eb_bool clickable:1; /* but not an input field */
+ eb_bool secure:1;
+ eb_bool checked:1;
+ eb_bool rchecked:1; /* for reset */
+ eb_bool post:1; /* post, rather than get */
+ eb_bool javapost:1; /* post by calling javascript */
+ eb_bool mime:1; /* encode as mime, rather than url encode */
+ eb_bool bymail:1; /* send by mail, rather than http */
+ eb_bool submitted:1;
+ eb_bool handler:1;
char subsup; /* span turned into sup or sub */
uchar itype; /* input type = */
short ninp; /* number of nonhidden inputs */
@@ -308,7 +308,7 @@ freeTags(void *a)
if(w != sessionList[n].fw)
continue;
/* We could have added a line, then deleted it */
- w->changeMode = false;
+ w->changeMode = eb_false;
cxQuit(n, 2);
} /* loop over tags */
@@ -338,29 +338,29 @@ get_js_event(const char *name)
if(action == TAGACT_A || action == TAGACT_AREA || action == TAGACT_FRAME
|| action == TAGACT_INPUT && (itype >= INP_RADIO ||
itype <= INP_SUBMIT) || action == TAGACT_OPTION) {
- topTag->handler = true;
+ topTag->handler = eb_true;
if(currentForm && action == TAGACT_INPUT && itype == INP_BUTTON)
- currentForm->submitted = true;
+ currentForm->submitted = eb_true;
}
}
if(stringEqual(name, "onsubmit") || stringEqual(name, "onreset")) {
if(action == TAGACT_FORM)
- topTag->handler = true;
+ topTag->handler = eb_true;
}
if(stringEqual(name, "onchange")) {
if(action == TAGACT_INPUT || action == TAGACT_SELECT) {
if(itype == INP_TA)
runningError(MSG_OnchangeText);
else if(itype > INP_HIDDEN && itype <= INP_SELECT) {
- topTag->handler = true;
+ topTag->handler = eb_true;
if(currentForm)
- currentForm->submitted = true;
+ currentForm->submitted = eb_true;
}
}
}
} /* get_js_event */
-static bool strayClick;
+static eb_bool strayClick;
static void
get_js_events(void)
@@ -388,7 +388,7 @@ get_js_events(void)
if(handlerPresent(ev, "onclick")) {
if((action == TAGACT_A || action == TAGACT_AREA || action == TAGACT_FRAME) && topTag->href || action == TAGACT_INPUT && (itype <= INP_SUBMIT || itype >= INP_RADIO)) ; /* ok */
else
- strayClick = true;
+ strayClick = eb_true;
}
if(handlerPresent(ev, "onchange")) {
if(action != TAGACT_INPUT && action != TAGACT_SELECT || itype == INP_TA)
@@ -398,7 +398,7 @@ get_js_events(void)
* is valid javascript, and you won't put an onsubmit function on <P> etc */
} /* get_js_events */
-bool
+eb_bool
tagHandler(int seqno, const char *name)
{
const struct htmlTag **list = cw->tags;
@@ -431,19 +431,19 @@ htmlMeta(void)
void *e;
topTag->jv = e =
- domLink("Meta", topTag->name, topTag->id, 0, 0, "metas", jdoc, false);
+ domLink("Meta", topTag->name, topTag->id, 0, 0, "metas", jdoc, eb_false);
name = topTag->name;
content = htmlAttrVal(topAttrib, "content");
if(content == EMPTYSTRING)
content = 0;
if(e)
- establish_property_string(e, "content", content, true);
+ establish_property_string(e, "content", content, eb_true);
heq = htmlAttrVal(topAttrib, "http-equiv");
if(heq == EMPTYSTRING)
heq = 0;
if(heq && content) {
- bool rc;
+ eb_bool rc;
int delay;
/* It's not clear if we should process the http refresh command
* immediately, the moment we spot it, or if we finish parsing
@@ -465,7 +465,7 @@ htmlMeta(void)
char *newcontent;
unpercentURL(content);
newcontent = resolveURL(basehref, content);
- gotoLocation(newcontent, delay, true);
+ gotoLocation(newcontent, delay, eb_true);
}
}
}
@@ -517,7 +517,7 @@ htmlHref(const char *desc)
} /* htmlHref */
static void
-formControl(bool namecheck)
+formControl(eb_bool namecheck)
{
void *fo = 0; /* form object */
void *e; /* the new element */
@@ -550,10 +550,10 @@ formControl(bool namecheck)
return;
if(itype <= INP_RADIO) {
- establish_property_string(e, "value", topTag->value, false);
+ establish_property_string(e, "value", topTag->value, eb_false);
if(itype != INP_FILE) {
/* No default value on file, for security reasons */
- establish_property_string(e, dfvl, topTag->value, true);
+ establish_property_string(e, dfvl, topTag->value, eb_true);
} /* not file */
}
@@ -561,11 +561,11 @@ formControl(bool namecheck)
typedesc = topTag->multiple ? "select-multiple" : "select-one";
else
typedesc = inp_types[itype];
- establish_property_string(e, "type", typedesc, true);
+ establish_property_string(e, "type", typedesc, eb_true);
if(itype >= INP_RADIO) {
- establish_property_bool(e, "checked", topTag->checked, false);
- establish_property_bool(e, dfck, topTag->checked, true);
+ establish_property_bool(e, "checked", topTag->checked, eb_false);
+ establish_property_bool(e, dfck, topTag->checked, eb_true);
}
} /* formControl */
@@ -576,14 +576,14 @@ htmlImage(void)
htmlHref("src");
topTag->jv =
domLink("Image", topTag->name, topTag->id, "src", topTag->href,
- "images", jdoc, false);
+ "images", jdoc, eb_false);
get_js_events();
/* don't know if javascript ever looks at alt. Probably not. */
if(!topTag->jv)
return;
a = htmlAttrVal(topAttrib, "alt");
if(a)
- establish_property_string(topTag->jv, "alt", a, true);
+ establish_property_string(topTag->jv, "alt", a, eb_true);
} /* htmlImage */
static void
@@ -600,7 +600,7 @@ htmlForm(void)
a = htmlAttrVal(topAttrib, "method");
if(a) {
if(stringEqualCI(a, "post"))
- topTag->post = true;
+ topTag->post = eb_true;
else if(!stringEqualCI(a, "get"))
browseError(MSG_GetPost);
nzFree(a);
@@ -609,7 +609,7 @@ htmlForm(void)
a = htmlAttrVal(topAttrib, "enctype");
if(a) {
if(stringEqualCI(a, "multipart/form-data"))
- topTag->mime = true;
+ topTag->mime = eb_true;
else if(!stringEqualCI(a, "application/x-www-form-urlencoded"))
browseError(MSG_Enctype);
nzFree(a);
@@ -619,11 +619,11 @@ htmlForm(void)
const char *prot = getProtURL(a);
if(prot) {
if(stringEqualCI(prot, "mailto"))
- topTag->bymail = true;
+ topTag->bymail = eb_true;
else if(stringEqualCI(prot, "javascript"))
- topTag->javapost = true;
+ topTag->javapost = eb_true;
else if(stringEqualCI(prot, "https"))
- topTag->secure = true;
+ topTag->secure = eb_true;
else if(!stringEqualCI(prot, "http"))
browseError(MSG_FormProtBad, prot);
}
@@ -634,7 +634,7 @@ htmlForm(void)
topTag->jv = fv =
domLink("Form", topTag->name, topTag->id, "action", topTag->href,
- "forms", jdoc, false);
+ "forms", jdoc, eb_false);
if(!fv)
return;
get_js_events();
@@ -648,7 +648,7 @@ jsdw(void)
if(!cw->dw)
return;
memcpy(cw->dw + 3, "<html>\n", 7);
- side = sideBuffer(0, cw->dw + 10, -1, cw->fileName, true);
+ side = sideBuffer(0, cw->dw + 10, -1, cw->fileName, eb_true);
if(side) {
i_printf(MSG_SideBufferX, side);
} else {
@@ -681,7 +681,7 @@ htmlInput(void)
topTag->itype = n;
if(htmlAttrPresent(topAttrib, "readonly"))
- topTag->rdonly = true;
+ topTag->rdonly = eb_true;
s = htmlAttrVal(topAttrib, "maxlength");
len = 0;
if(s)
@@ -709,8 +709,8 @@ htmlInput(void)
}
stringAndString(&radioChecked, &radioChecked_l, namebuf + 1);
} /* radio name */
- topTag->rchecked = true;
- topTag->checked = true;
+ topTag->rchecked = eb_true;
+ topTag->checked = eb_true;
}
/* Even the submit fields can have a name, but they don't have to */
@@ -751,7 +751,7 @@ displayOptions(const struct htmlTag *sel)
static struct htmlTag *
locateOptionByName(const struct htmlTag *sel, const char *name, int *pmc,
- bool exact)
+ eb_bool exact)
{
struct htmlTag **list = cw->tags, *t, *em = 0, *pm = 0;
int pmcount = 0; /* partial match count */
@@ -797,9 +797,9 @@ locateOptionByNum(const struct htmlTag *sel, int n)
return 0;
} /* locateOptionByNum */
-static bool
+static eb_bool
locateOptions(const struct htmlTag *sel, const char *input,
- char **disp_p, char **val_p, bool setcheck)
+ char **disp_p, char **val_p, eb_bool setcheck)
{
struct htmlTag *t, **list;
char *display = 0, *value = 0;
@@ -823,9 +823,9 @@ locateOptions(const struct htmlTag *sel, const char *input,
list = cw->tags;
while(t = *list++)
if(t->controller == sel && t->name) {
- t->checked = false;
+ t->checked = eb_false;
if(t->jv)
- set_property_bool(t->jv, "selected", false);
+ set_property_bool(t->jv, "selected", eb_false);
}
}
@@ -843,14 +843,14 @@ locateOptions(const struct htmlTag *sel, const char *input,
if(*s == ',')
++s;
- t = locateOptionByName(sel, iopt, &pmc, true);
+ t = locateOptionByName(sel, iopt, &pmc, eb_true);
if(!t) {
n = stringIsNum(iopt);
if(n >= 0)
t = locateOptionByNum(sel, n);
}
if(!t)
- t = locateOptionByName(sel, iopt, &pmc, false);
+ t = locateOptionByName(sel, iopt, &pmc, eb_false);
if(!t) {
if(n >= 0)
setError(MSG_XOutOfRange, n);
@@ -875,9 +875,9 @@ locateOptions(const struct htmlTag *sel, const char *input,
stringAndString(&display, &disp_l, t->name);
}
if(setcheck) {
- t->checked = true;
+ t->checked = eb_true;
if(t->jv) {
- set_property_bool(t->jv, "selected", true);
+ set_property_bool(t->jv, "selected", eb_true);
if(ev)
set_property_number(ev, "selectedIndex", t->lic);
}
@@ -889,13 +889,13 @@ locateOptions(const struct htmlTag *sel, const char *input,
if(display)
*disp_p = display;
free(iopt);
- return true;
+ return eb_true;
fail:
free(iopt);
nzFree(value);
nzFree(display);
- return false;
+ return eb_false;
} /* locateOptions */
@@ -951,7 +951,7 @@ jSyncup(void)
* revert back to the original (reset) value. */
if(itype == INP_SELECT) {
- locateOptions(t, (value ? value : t->value), 0, 0, true);
+ locateOptions(t, (value ? value : t->value), 0, 0, eb_true);
if(!t->multiple)
value = get_property_option(eo);
}
@@ -967,7 +967,7 @@ jSyncup(void)
if(!cx)
continue;
/* The unfold command should never fail */
- if(!unfoldBuffer(cx, false, &cxbuf, &j))
+ if(!unfoldBuffer(cx, eb_false, &cxbuf, &j))
continue;
set_property_string(eo, "value", cxbuf);
nzFree(cxbuf);
@@ -990,8 +990,8 @@ static struct htmlTag *
findOpenTag(const char *name)
{
struct htmlTag *t;
- bool closing = topTag->slash;
- bool match;
+ eb_bool closing = topTag->slash;
+ eb_bool match;
const char *desc = topTag->info->desc;
foreachback(t, htmlStack) {
@@ -1040,9 +1040,9 @@ newTag(const char *name)
t->action = action;
t->info = ti;
t->seqno = ntags++;
- t->balanced = true;
+ t->balanced = eb_true;
if(stringEqual(name, "a"))
- t->clickable = true;
+ t->clickable = eb_true;
addToListBack(&htmlStack, t);
return t;
} /* newTag */
@@ -1119,10 +1119,10 @@ encodeTags(char *html)
int dw_line, dw_nest = 0;
char hnum[40]; /* hidden number */
char c;
- bool retainTag, onload_done = false;
- bool a_text; /* visible text within the hyperlink */
- bool slash, a_href, rc;
- bool premode = false, invisible = false;
+ eb_bool retainTag, onload_done = eb_false;
+ eb_bool a_text; /* visible text within the hyperlink */
+ eb_bool slash, a_href, rc;
+ eb_bool premode = eb_false, invisible = eb_false;
/* Tags that cannot nest, one open at a time. */
struct htmlTag *currentA; /* the open anchor */
struct htmlTag *currentSel; /* the open select */
@@ -1135,7 +1135,7 @@ encodeTags(char *html)
int lastact = 0;
int nopt; /* number of options */
int intable = 0, inrow = 0;
- bool tdfirst;
+ eb_bool tdfirst;
void *to; /* table object */
void *ev; /* generic event variable */
@@ -1169,7 +1169,7 @@ encodeTags(char *html)
goto nextchar;
stringAndChar(&new, &l, c);
if(!isspaceByte(c)) {
- a_text = true;
+ a_text = eb_true;
lastact = 0;
}
}
@@ -1193,9 +1193,9 @@ encodeTags(char *html)
if(!dw_nest)
browseLine = ln;
ln += lns;
- slash = false;
+ slash = eb_false;
if(*name == '/')
- slash = true, ++name, --namelen;
+ slash = eb_true, ++name, --namelen;
if(namelen > sizeof (tagname) - 1)
namelen = sizeof (tagname) - 1;
strncpy(tagname, name, namelen);
@@ -1219,8 +1219,8 @@ encodeTags(char *html)
/* Close it off */
currentTA->action = TAGACT_INPUT;
currentTA->itype = INP_TA;
- currentTA->balanced = true;
- s = currentTA->value = andTranslate(new + offset, true);
+ currentTA->balanced = eb_true;
+ s = currentTA->value = andTranslate(new + offset, eb_true);
/* Text starts at the next line boundary */
while(*s == '\t' || *s == ' ')
++s;
@@ -1237,15 +1237,15 @@ encodeTags(char *html)
*a = 0;
if(currentTA->jv) {
establish_innerHTML(currentTA->jv, currentTA->inner, save_h,
- true);
+ eb_true);
establish_property_string(currentTA->jv, "value",
- currentTA->value, false);
+ currentTA->value, eb_false);
establish_property_string(currentTA->jv, dfvl, currentTA->value,
- true);
+ eb_true);
}
l -= strlen(new + offset);
new[offset] = 0;
- j = sideBuffer(0, currentTA->value, -1, 0, false);
+ j = sideBuffer(0, currentTA->value, -1, 0, eb_false);
if(j) {
currentTA->lic = j;
sprintf(hnum, "%c%d<buffer %d%c0>",
@@ -1281,9 +1281,9 @@ encodeTags(char *html)
open = findOpenTag(ti->name);
if(!open)
continue; /* unbalanced </ul> means nothing */
- open->balanced = t->balanced = true;
+ open->balanced = t->balanced = eb_true;
if(open->jv)
- establish_innerHTML(open->jv, open->inner, save_h, false);
+ establish_innerHTML(open->jv, open->inner, save_h, eb_false);
}
if(slash && ti->bits & TAG_NOSLASH)
@@ -1304,21 +1304,21 @@ encodeTags(char *html)
forceCloseAnchor:
stringAndChar(&new, &l, InternalCodeChar);
stringAndString(&new, &l, "0}");
- currentA->balanced = true;
+ currentA->balanced = eb_true;
currentA = 0;
/* if/when the </a> comes along, it will be unbalanced, and we'll ignore it. */
}
}
- retainTag = true;
+ retainTag = eb_true;
if(ti->bits & TAG_INVISIBLE)
- retainTag = false;
+ retainTag = eb_false;
if(invisible)
- retainTag = false;
+ retainTag = eb_false;
if(ti->bits & TAG_INVISIBLE)
invisible = !slash;
- strayClick = false;
+ strayClick = eb_false;
/* Are we gathering text to build title or option? */
if(currentTitle || currentOpt) {
@@ -1332,7 +1332,7 @@ encodeTags(char *html)
if(!(ti->bits & TAG_CLOSEA))
continue;
/* close off the title or option */
- v->balanced = true;
+ v->balanced = eb_true;
ptr = 0;
if(currentTitle && !cw->ft)
ptr = &cw->ft;
@@ -1340,7 +1340,7 @@ encodeTags(char *html)
ptr = &v->name;
if(ptr) {
- a = andTranslate(new + offset, true);
+ a = andTranslate(new + offset, eb_true);
stripWhite(a);
if(currentOpt && strchr(a, ',') && currentSel->multiple) {
char *y;
@@ -1349,12 +1349,12 @@ encodeTags(char *html)
*y = ' ';
browseError(MSG_OptionComma);
}
- spaceCrunch(a, true, false);
+ spaceCrunch(a, eb_true, eb_false);
*ptr = a;
if(currentTitle) {
if(!cw->jsdead)
- establish_property_string(jdoc, "title", a, true);
+ establish_property_string(jdoc, "title", a, eb_true);
}
if(currentOpt) {
@@ -1368,12 +1368,12 @@ encodeTags(char *html)
if(ev = currentSel->jv) { /* element variable */
void *ov = establish_js_option(ev, v->lic);
v->jv = ov;
- establish_property_string(ov, "text", v->name, true);
- establish_property_string(ov, "value", v->value, true);
+ establish_property_string(ov, "text", v->name, eb_true);
+ establish_property_string(ov, "value", v->value, eb_true);
establish_property_bool(ov, "selected", v->checked,
- false);
+ eb_false);
establish_property_bool(ov, "defaultSelected",
- v->checked, true);
+ v->checked, eb_true);
if(v->checked && !currentSel->multiple) {
set_property_number(ev, "selectedIndex", v->lic);
set_property_string(ev, "value", v->value);
@@ -1397,11 +1397,11 @@ encodeTags(char *html)
continue;
if(!retainTag)
continue;
- t->retain = true;
+ t->retain = eb_true;
if(currentForm) {
++currentForm->ninp;
if(t->itype == INP_SUBMIT || t->itype == INP_IMAGE)
- currentForm->submitted = true;
+ currentForm->submitted = eb_true;
}
strcat(hnum, "<");
stringAndString(&new, &l, hnum);
@@ -1434,22 +1434,22 @@ encodeTags(char *html)
continue;
case TAGACT_A:
- a_href = false;
+ a_href = eb_false;
if(slash) {
if(open->href)
- a_href = true;
+ a_href = eb_true;
currentA = 0;
} else {
htmlHref("href");
topTag->jv =
domLink("Anchor", topTag->name, topTag->id, "href",
- topTag->href, "links", jdoc, false);
+ topTag->href, "links", jdoc, eb_false);
get_js_events();
if(t->href) {
- a_href = true;
- topTag->clickable = true;
+ a_href = eb_true;
+ topTag->clickable = eb_true;
}
- a_text = false;
+ a_text = eb_false;
}
if(a_href) {
if(slash) {
@@ -1460,7 +1460,7 @@ encodeTags(char *html)
}
} else {
if(!t->name)
- retainTag = false; /* no need to keep this anchor */
+ retainTag = eb_false; /* no need to keep this anchor */
} /* href or not */
break;
@@ -1472,19 +1472,19 @@ encodeTags(char *html)
currentTA = t;
offset = l;
t->itype = INP_TA;
- formControl(true);
+ formControl(eb_true);
continue;
case TAGACT_HEAD:
topTag->jv =
domLink("Head", topTag->name, topTag->id, 0, 0,
- "heads", jdoc, false);
+ "heads", jdoc, eb_false);
goto plainWithElements;
case TAGACT_BODY:
topTag->jv =
domLink("Body", topTag->name, topTag->id, 0, 0,
- "bodies", jdoc, false);
+ "bodies", jdoc, eb_false);
plainWithElements:
if(t->jv)
establish_property_array(t->jv, "elements");
@@ -1550,7 +1550,7 @@ encodeTags(char *html)
if(!slash) {
topTag->jv = to =
domLink("Table", topTag->name, topTag->id, 0, 0,
- "tables", jdoc, false);
+ "tables", jdoc, eb_false);
get_js_events();
/* create the array of rows under the table */
if(to)
@@ -1571,11 +1571,11 @@ encodeTags(char *html)
--inrow;
else
++inrow;
- tdfirst = true;
+ tdfirst = eb_true;
if((!slash) && (open = findOpenTag("table")) && open->jv) {
topTag->jv = to =
domLink("Trow", topTag->name, topTag->id, 0, 0,
- "rows", open->jv, false);
+ "rows", open->jv, eb_false);
get_js_events();
establish_property_array(to, "cells");
}
@@ -1589,7 +1589,7 @@ encodeTags(char *html)
if(slash)
continue;
if(tdfirst)
- tdfirst = false;
+ tdfirst = eb_false;
else if(retainTag) {
while(l && new[l - 1] == ' ')
--l;
@@ -1599,7 +1599,7 @@ encodeTags(char *html)
if((open = findOpenTag("tr")) && open->jv) {
topTag->jv = to =
domLink("Cell", topTag->name, topTag->id, 0, 0,
- "cells", open->jv, false);
+ "cells", open->jv, eb_false);
get_js_events();
}
goto endtag;
@@ -1608,7 +1608,7 @@ encodeTags(char *html)
if(!slash) {
topTag->jv =
domLink("Div", topTag->name, topTag->id, 0, 0,
- "divs", jdoc, false);
+ "divs", jdoc, eb_false);
get_js_events();
}
goto nop;
@@ -1617,7 +1617,7 @@ encodeTags(char *html)
if(!slash) {
topTag->jv =
domLink("Span", topTag->name, topTag->id, 0, 0,
- "spans", jdoc, false);
+ "spans", jdoc, eb_false);
get_js_events();
a = htmlAttrVal(topAttrib, "class");
if(!a)
@@ -1670,7 +1670,7 @@ encodeTags(char *html)
++currentSel->controller->ninp;
currentSel->value = a = displayOptions(currentSel);
if(retainTag) {
- currentSel->retain = true;
+ currentSel->retain = eb_true;
/* Crank out the input tag */
sprintf(hnum, "%c%d<", InternalCodeChar, currentSel->seqno);
stringAndString(&new, &l, hnum);
@@ -1707,10 +1707,10 @@ encodeTags(char *html)
nopt = 0;
t->itype = INP_SELECT;
if(htmlAttrPresent(topAttrib, "readonly"))
- t->rdonly = true;
+ t->rdonly = eb_true;
if(htmlAttrPresent(topAttrib, "multiple"))
- t->multiple = true;
- formControl(true);
+ t->multiple = eb_true;
+ formControl(eb_true);
continue;
case TAGACT_OPTION:
@@ -1729,7 +1729,7 @@ encodeTags(char *html)
if(currentSel->lic && !currentSel->multiple)
browseError(MSG_ManyOptSelected);
else
- t->checked = t->rchecked = true, ++currentSel->lic;
+ t->checked = t->rchecked = eb_true, ++currentSel->lic;
}
continue;
@@ -1745,7 +1745,7 @@ encodeTags(char *html)
subsup:
if(!retainTag)
continue;
- t->retain = true;
+ t->retain = eb_true;
j = (action == TAGACT_SUP ? 2 : 1);
if(!slash) {
t->lic = l;
@@ -1784,14 +1784,14 @@ encodeTags(char *html)
htmlHref("src");
topTag->jv =
domLink("Frame", topTag->name, 0, "src",
- topTag->href, "frames", jwin, false);
+ topTag->href, "frames", jwin, eb_false);
} else {
htmlHref("href");
topTag->jv =
domLink("Area", topTag->name, topTag->id, "href",
- topTag->href, "areas", jdoc, false);
+ topTag->href, "areas", jdoc, eb_false);
}
- topTag->clickable = true;
+ topTag->clickable = eb_true;
get_js_events();
if(!retainTag)
continue;
@@ -1806,7 +1806,7 @@ encodeTags(char *html)
strcat(hnum, "{");
stringAndString(&new, &l, hnum);
t->action = TAGACT_A;
- t->balanced = true;
+ t->balanced = eb_true;
}
if(t->href || action == TAGACT_FRAME)
stringAndString(&new, &l, name);
@@ -1866,7 +1866,7 @@ encodeTags(char *html)
if(!s)
s = "image";
stringAndString(&new, &l, s);
- a_text = true;
+ a_text = eb_true;
continue;
case TAGACT_SCRIPT:
@@ -1881,7 +1881,7 @@ encodeTags(char *html)
if(!rc) {
nzFree(javatext);
runningError(MSG_ScriptNotClosed);
- cw->jsdead = true;
+ cw->jsdead = eb_true;
continue;
}
htmlHref("src");
@@ -1985,7 +1985,7 @@ encodeTags(char *html)
if(!retainTag)
continue;
- t->retain = true;
+ t->retain = eb_true;
if(!strpbrk(hnum, "{}")) {
strcat(hnum, "*");
/* Leave the meaningless tags out. */
@@ -1997,8 +1997,8 @@ encodeTags(char *html)
endtag:
lastact = action;
if(strayClick) {
- topTag->clickable = true;
- a_text = false;
+ topTag->clickable = eb_true;
+ a_text = eb_false;
topTag->href = cloneString("#");
currentA = topTag;
sprintf(hnum, "%c%d{", InternalCodeChar, topTag->seqno);
@@ -2037,7 +2037,7 @@ encodeTags(char *html)
break;
} /* loop over tags */
}
- onload_done = true;
+ onload_done = eb_true;
/* The onload function can, and often does, invoke document.write() */
if(cw->dw) {
@@ -2103,12 +2103,12 @@ encodeTags(char *html)
} /* encodeTags */
void
-preFormatCheck(int tagno, bool * pretag, bool * slash)
+preFormatCheck(int tagno, eb_bool * pretag, eb_bool * slash)
{
const struct htmlTag *t;
if(!parsePage)
i_printfExit(MSG_ErrCallPreFormat);
- *pretag = *slash = false;
+ *pretag = *slash = eb_false;
if(tagno >= 0 && tagno < ntags) {
t = tagArray[tagno];
*pretag = (t->action == TAGACT_PRE);
@@ -2123,7 +2123,7 @@ htmlParse(char *buf, int remote)
if(parsePage)
i_printfExit(MSG_HtmlNotreentrant);
- parsePage = true;
+ parsePage = eb_true;
if(remote >= 0)
browseLocal = !remote;
buf = encodeTags(buf);
@@ -2131,7 +2131,7 @@ htmlParse(char *buf, int remote)
buildTagArray();
- newbuf = andTranslate(buf, false);
+ newbuf = andTranslate(buf, eb_false);
nzFree(buf);
buf = newbuf;
anchorSwap(buf);
@@ -2141,7 +2141,7 @@ htmlParse(char *buf, int remote)
nzFree(buf);
buf = newbuf;
- parsePage = false;
+ parsePage = eb_false;
/* In case one of the onload functions called document.write() */
jsdw();
@@ -2228,7 +2228,7 @@ findField(const char *line, int ftype, int n,
*evp = t->jv;
if(href && t->jv) {
/* defer to the java variable for the reference */
- char *jh = get_property_url(t->jv, false);
+ char *jh = get_property_url(t->jv, eb_false);
if(jh) {
if(!*href || !stringEqual(*href, jh)) {
nzFree(*href);
@@ -2244,7 +2244,7 @@ findField(const char *line, int ftype, int n,
/* Second time through, maybe the url is in plain text. */
nmh = 0;
s = line;
- while(true) {
+ while(eb_true) {
/* skip past weird characters */
while((c = *s) != '\n') {
if(strchr(urlok, c))
@@ -2302,7 +2302,7 @@ findInputField(const char *line, int ftype, int n, int *total, int *realtotal,
findField(line, ftype, n, total, realtotal, tagno, 0, 0);
} /* findInputField */
-bool
+eb_bool
lineHasTag(const char *p, const char *s)
{
const struct htmlTag *t, **list = cw->tags;
@@ -2318,20 +2318,20 @@ lineHasTag(const char *p, const char *s)
if(!t->name)
continue;
if(stringEqual(t->name, s))
- return true;
+ return eb_true;
}
- return false;
+ return eb_false;
} /* lineHasTag */
/* See if there are simple tags like <p> or </font> */
-bool
+eb_bool
htmlTest(void)
{
int j, ln;
int cnt = 0;
int fsize = 0; /* file size */
char look[12];
- bool firstline = true;
+ eb_bool firstline = eb_true;
for(ln = 1; ln <= cw->dol; ++ln) {
char *p = (char *)fetchLine(ln, -1);
@@ -2345,7 +2345,7 @@ htmlTest(void)
if(firstline && *p == '<') {
/* check for <!doctype */
if(memEqualCI(p + 1, "!doctype", 8))
- return true;
+ return eb_true;
/* If it starts with <tag, for any tag we recognize,
* we'll call it good. */
for(j = 1; j < 10; ++j) {
@@ -2359,10 +2359,10 @@ htmlTest(void)
const struct tagInfo *ti;
for(ti = elements; ti->name; ++ti)
if(stringEqualCI(ti->name, look))
- return true;
+ return eb_true;
} /* leading tag */
} /* leading < */
- firstline = false;
+ firstline = eb_false;
/* count tags through the buffer */
for(j = 0; (c = p[j]) != '\n'; ++j) {
@@ -2410,7 +2410,7 @@ infShow(int tagno, const char *search)
const struct htmlTag *t = list[tagno], *v;
const char *s;
int j, cnt;
- bool show;
+ eb_bool show;
s = inp_types[t->itype];
if(*s == ' ')
@@ -2443,7 +2443,7 @@ infShow(int tagno, const char *search)
/* display the options in a pick list */
/* If a search string is given, display the options containing that string. */
cnt = 0;
- show = false;
+ show = eb_false;
for(j = 0; v = list[j]; ++j) {
if(v->controller != t)
continue;
@@ -2452,7 +2452,7 @@ infShow(int tagno, const char *search)
++cnt;
if(*search && !strstrCI(v->name, search))
continue;
- show = true;
+ show = eb_true;
printf("%3d %s\n", cnt, v->name);
}
if(!show) {
@@ -2464,7 +2464,7 @@ infShow(int tagno, const char *search)
} /* infShow */
/* Update an input field. */
-bool
+eb_bool
infReplace(int tagno, const char *newtext, int notify)
{
const struct htmlTag **list = cw->tags;
@@ -2482,67 +2482,67 @@ infReplace(int tagno, const char *newtext, int notify)
if(itype == INP_RESET)
b = MSG_ResetButton;
setError(b);
- return false;
+ return eb_false;
}
if(itype == INP_TA) {
setError(MSG_Textarea, t->lic);
- return false;
+ return eb_false;
}
if(t->rdonly) {
setError(MSG_Readonly);
- return false;
+ return eb_false;
}
if(strchr(newtext, '\n')) {
setError(MSG_InputNewline);
- return false;
+ return eb_false;
}
if(itype >= INP_TEXT && itype <= INP_NUMBER && t->lic && newlen > t->lic) {
setError(MSG_InputLong, t->lic);
- return false;
+ return eb_false;
}
if(itype >= INP_RADIO) {
if(newtext[0] != '+' && newtext[0] != '-' || newtext[1]) {
setError(MSG_InputRadio);
- return false;
+ return eb_false;
}
if(itype == INP_RADIO && newtext[0] == '-') {
setError(MSG_ClearRadio);
- return false;
+ return eb_false;
}
}
/* Two lines, clear the "other" radio button, and set this one. */
if(!linesComing(2))
- return false;
+ return eb_false;
jMyContext();
if(itype == INP_SELECT) {
- if(!locateOptions(t, newtext, 0, 0, false))
- return false;
- locateOptions(t, newtext, &display, 0, false);
- updateFieldInBuffer(tagno, display, notify, true);
+ if(!locateOptions(t, newtext, 0, 0, eb_false))
+ return eb_false;
+ locateOptions(t, newtext, &display, 0, eb_false);
+ updateFieldInBuffer(tagno, display, notify, eb_true);
nzFree(display);
}
if(itype == INP_FILE) {
if(!envFile(newtext, &newtext))
- return false;
+ return eb_false;
if(newtext[0] && access(newtext, 4)) {
setError(MSG_FileAccess, newtext);
- return false;
+ return eb_false;
}
}
if(itype == INP_NUMBER) {
if(*newtext && stringIsNum(newtext) < 0) {
setError(MSG_NumberExpected);
- return false;
+ return eb_false;
}
}
@@ -2557,13 +2557,13 @@ infReplace(int tagno, const char *newtext, int notify)
continue;
if(!stringEqual(v->name, t->name))
continue;
- if(fieldIsChecked(v->seqno) == true)
- updateFieldInBuffer(v->seqno, "-", 0, false);
+ if(fieldIsChecked(v->seqno) == eb_true)
+ updateFieldInBuffer(v->seqno, "-", 0, eb_false);
}
}
if(itype != INP_SELECT) {
- updateFieldInBuffer(tagno, newtext, notify, true);
+ updateFieldInBuffer(tagno, newtext, notify, eb_true);
}
if(itype >= INP_RADIO && tagHandler(t->seqno, "onclick")) {
@@ -2574,7 +2574,7 @@ infReplace(int tagno, const char *newtext, int notify)
handlerGo(t->jv, "onclick");
jsdw();
if(js_redirects)
- return true;
+ return eb_true;
}
}
@@ -2587,11 +2587,11 @@ infReplace(int tagno, const char *newtext, int notify)
handlerGo(t->jv, "onchange");
jsdw();
if(js_redirects)
- return true;
+ return eb_true;
}
}
- return true;
+ return eb_true;
} /* infReplace */
/*********************************************************************
@@ -2608,7 +2608,7 @@ resetVar(struct htmlTag *t)
{
int itype = t->itype;
const char *w = t->value;
- bool bval;
+ eb_bool bval;
void *jv = t->jv;
/* This is a kludge - option looks like INP_SELECT */
@@ -2627,9 +2627,9 @@ resetVar(struct htmlTag *t)
if(itype == INP_TA) {
int cx = t->lic;
if(cx)
- sideBuffer(cx, t->value, -1, 0, false);
+ sideBuffer(cx, t->value, -1, 0, eb_false);
} else if(itype != INP_HIDDEN && itype != INP_SELECT)
- updateFieldInBuffer(t->seqno, w, 0, false);
+ updateFieldInBuffer(t->seqno, w, 0, eb_false);
if(jv) {
if(itype >= INP_RADIO) {
@@ -2664,7 +2664,7 @@ formReset(const struct htmlTag *form)
if(sel) {
char *display = displayOptions(sel);
- updateFieldInBuffer(sel->seqno, display, 0, false);
+ updateFieldInBuffer(sel->seqno, display, 0, eb_false);
nzFree(display);
sel = 0;
}
@@ -2703,7 +2703,7 @@ fetchTextVar(const struct htmlTag *t)
return cloneString(t->value);
} /* fetchTextVar */
-static bool
+static eb_bool
fetchBoolVar(const struct htmlTag *t)
{
void *jv = t->jv;
@@ -2737,7 +2737,7 @@ postDelimiter(char fsep, const char *boundary, char **post, int *l)
stringAndChar(post, l, fsep);
} /* postDelimiter */
-static bool
+static eb_bool
postNameVal(const char *name, const char *val,
char fsep, uchar isfile, const char *boundary, char **post, int *l)
{
@@ -2749,7 +2749,7 @@ postNameVal(const char *name, const char *val,
if(!val)
val = EMPTYSTRING;
if(!*name && !*val)
- return true;
+ return eb_true;
postDelimiter(fsep, boundary, post, l);
switch (fsep) {
@@ -2772,7 +2772,7 @@ postNameVal(const char *name, const char *val,
} /* switch */
if(!*val && fsep == '&')
- return true;
+ return eb_true;
switch (fsep) {
case '&':
@@ -2791,8 +2791,8 @@ postNameVal(const char *name, const char *val,
stringAndString(post, l, val);
stringAndChar(post, l, '"');
}
- if(!encodeAttachment(val, 0, true, &ct, &ce, &enc))
- return false;
+ if(!encodeAttachment(val, 0, eb_true, &ct, &ce, &enc))
+ return eb_false;
val = enc;
/* remember to free val in this case */
} else {
@@ -2818,10 +2818,10 @@ postNameVal(const char *name, const char *val,
break;
} /* switch */
- return true;
+ return eb_true;
} /* postNameVal */
-static bool
+static eb_bool
formSubmit(const struct htmlTag *form, const struct htmlTag *submit,
char **post, int *l)
{
@@ -2831,8 +2831,8 @@ formSubmit(const struct htmlTag *form, const struct htmlTag *submit,
char *name, *value;
const char *boundary;
char fsep = '&'; /* field separator */
- bool noname = false, rc;
- bool bval;
+ eb_bool noname = eb_false, rc;
+ eb_bool bval;
if(form->bymail)
fsep = '\n';
@@ -2868,9 +2868,9 @@ formSubmit(const struct htmlTag *form, const struct htmlTag *submit,
nx = allocMem(namelen + 3);
strcpy(nx, name);
strcpy(nx + namelen, ".x");
- postNameVal(nx, "0", fsep, false, boundary, post, l);
+ postNameVal(nx, "0", fsep, eb_false, boundary, post, l);
nx[namelen + 1] = 'y';
- postNameVal(nx, "0", fsep, false, boundary, post, l);
+ postNameVal(nx, "0", fsep, eb_false, boundary, post, l);
nzFree(nx);
goto success;
}
@@ -2881,7 +2881,7 @@ formSubmit(const struct htmlTag *form, const struct htmlTag *submit,
if(!bval)
continue;
if(!name)
- noname = true;
+ noname = eb_true;
if(value && !*value)
value = 0;
if(itype == INP_CHECKBOX && value == 0)
@@ -2895,7 +2895,7 @@ formSubmit(const struct htmlTag *form, const struct htmlTag *submit,
* I didn't allow for it in the above, the value of a radio button;
* hope that's not a problem. */
value = fetchTextVar(t);
- postNameVal(name, value, fsep, false, boundary, post, l);
+ postNameVal(name, value, fsep, eb_false, boundary, post, l);
nzFree(value);
continue;
}
@@ -2905,7 +2905,7 @@ formSubmit(const struct htmlTag *form, const struct htmlTag *submit,
char *cxbuf;
int cxlen;
if(!name)
- noname = true;
+ noname = eb_true;
if(cx) {
if(fsep == '-') {
char cxstring[12];
@@ -2915,7 +2915,7 @@ formSubmit(const struct htmlTag *form, const struct htmlTag *submit,
goto fail;
continue;
} /* attach */
- if(!unfoldBuffer(cx, true, &cxbuf, &cxlen))
+ if(!unfoldBuffer(cx, eb_true, &cxbuf, &cxlen))
goto fail;
for(j = 0; j < cxlen; ++j)
if(cxbuf[j] == 0) {
@@ -2928,14 +2928,14 @@ formSubmit(const struct htmlTag *form, const struct htmlTag *submit,
if(j && cxbuf[j - 1] == '\r')
--j;
cxbuf[j] = 0;
- rc = postNameVal(name, cxbuf, fsep, false, boundary, post, l);
+ rc = postNameVal(name, cxbuf, fsep, eb_false, boundary, post, l);
nzFree(cxbuf);
if(rc)
continue;
goto fail;
}
/* Just an empty string */
- postNameVal(name, 0, fsep, false, boundary, post, l);
+ postNameVal(name, 0, fsep, eb_false, boundary, post, l);
continue;
}
@@ -2950,14 +2950,14 @@ formSubmit(const struct htmlTag *form, const struct htmlTag *submit,
v->checked = v->rchecked;
display = displayOptions(t);
}
- rc = locateOptions(t, display, 0, &value, false);
+ rc = locateOptions(t, display, 0, &value, eb_false);
nzFree(display);
if(!rc)
goto fail; /* this should never happen */
/* option could have an empty value, usually the null choice,
* before you have made a selection. */
if(!*value) {
- postNameVal(name, value, fsep, false, boundary, post, l);
+ postNameVal(name, value, fsep, eb_false, boundary, post, l);
continue;
}
/* Step through the options */
@@ -2969,7 +2969,7 @@ formSubmit(const struct htmlTag *form, const struct htmlTag *submit,
if(!e)
e = s + strlen(s);
more = *e, *e = 0;
- postNameVal(name, s, fsep, false, boundary, post, l);
+ postNameVal(name, s, fsep, eb_false, boundary, post, l);
if(more)
++e;
}
@@ -2998,7 +2998,7 @@ formSubmit(const struct htmlTag *form, const struct htmlTag *submit,
i_printfExit(MSG_UnexSubmitForm);
success:
- postNameVal(name, value, fsep, false, boundary, post, l);
+ postNameVal(name, value, fsep, eb_false, boundary, post, l);
} /* loop over tags */
if(form->mime) { /* the last boundary */
@@ -3008,10 +3008,10 @@ formSubmit(const struct htmlTag *form, const struct htmlTag *submit,
}
i_puts(MSG_FormSubmit);
- return true;
+ return eb_true;
fail:
- return false;
+ return eb_false;
} /* formSubmit */
/*********************************************************************
@@ -3022,7 +3022,7 @@ which checks the fields and calls form.submit(),
which calls this routine. Happens all the time.
*********************************************************************/
-bool
+eb_bool
infPush(int tagno, char **post_string)
{
struct htmlTag **list = cw->tags;
@@ -3033,7 +3033,7 @@ infPush(int tagno, char **post_string)
int l, actlen;
const char *action = 0;
const char *prot;
- bool rc;
+ eb_bool rc;
*post_string = 0;
@@ -3052,12 +3052,12 @@ infPush(int tagno, char **post_string)
if(itype > INP_SUBMIT) {
setError(MSG_NoButton);
- return false;
+ return eb_false;
}
if(!form && itype != INP_BUTTON) {
setError(MSG_NotInForm);
- return false;
+ return eb_false;
}
if(t && tagHandler(t->seqno, "onclick")) {
@@ -3068,18 +3068,18 @@ infPush(int tagno, char **post_string)
rc = handlerGo(t->jv, "onclick");
jsdw();
if(!rc)
- return true;
+ return eb_true;
if(js_redirects)
- return true;
+ return eb_true;
}
}
if(itype == INP_BUTTON) {
if(!handlerPresent(t->jv, "onclick")) {
setError(MSG_ButtonNoJS);
- return false;
+ return eb_false;
}
- return true;
+ return eb_true;
}
if(itype == INP_RESET) {
@@ -3091,13 +3091,13 @@ infPush(int tagno, char **post_string)
rc = handlerGo(form->jv, "onreset");
jsdw();
if(!rc)
- return true;
+ return eb_true;
if(js_redirects)
- return true;
+ return eb_true;
}
} /* onreset */
formReset(form);
- return true;
+ return eb_true;
}
/* Before we submit, run the onsubmit code */
@@ -3108,16 +3108,16 @@ infPush(int tagno, char **post_string)
rc = handlerGo(form->jv, "onsubmit");
jsdw();
if(!rc)
- return true;
+ return eb_true;
if(js_redirects)
- return true;
+ return eb_true;
}
}
action = form->href;
/* But we defer to the java variable */
if(form->jv) {
- char *jh = get_property_url(form->jv, true);
+ char *jh = get_property_url(form->jv, eb_true);
if(jh && (!action || !stringEqual(jh, action))) {
/* Tie action to the form tag, to plug a small memory leak */
nzFree(form->href);
@@ -3134,7 +3134,7 @@ infPush(int tagno, char **post_string)
if(!action) {
setError(MSG_FormNoURL);
- return false;
+ return eb_false;
}
debugPrint(2, "* %s", action);
@@ -3142,32 +3142,32 @@ infPush(int tagno, char **post_string)
prot = getProtURL(action);
if(!prot) {
setError(MSG_FormBadURL);
- return false;
+ return eb_false;
}
if(stringEqualCI(prot, "javascript")) {
if(cw->jsdead) {
setError(MSG_NJNoForm);
- return false;
+ return eb_false;
}
javaParseExecute(form->jv, action, 0, 0);
jsdw();
- return true;
+ return eb_true;
}
- form->bymail = false;
+ form->bymail = eb_false;
if(stringEqualCI(prot, "mailto")) {
if(!validAccount(localAccount))
- return false;
- form->bymail = true;
+ return eb_false;
+ form->bymail = eb_true;
} else if(stringEqualCI(prot, "http")) {
if(form->secure) {
setError(MSG_BecameInsecure);
- return false;
+ return eb_false;
}
} else if(!stringEqualCI(prot, "https")) {
setError(MSG_SubmitProtBad, prot);
- return false;
+ return eb_false;
}
post = initString(&l);
@@ -3193,7 +3193,7 @@ infPush(int tagno, char **post_string)
if(!formSubmit(form, t, &post, &l)) {
nzFree(post);
- return false;
+ return eb_false;
}
debugPrint(3, "%s %s", form->post ? "post" : "get", post + actlen);
@@ -3224,7 +3224,7 @@ infPush(int tagno, char **post_string)
nzFree(post);
i_printf(MSG_MailSending, addr);
sleep(1);
- rc = sendMail(localAccount, tolist, q, -1, atlist, 0, 0, false);
+ rc = sendMail(localAccount, tolist, q, -1, atlist, 0, 0, eb_false);
if(rc)
i_puts(MSG_MailSent);
nzFree(addr);
@@ -3235,7 +3235,7 @@ infPush(int tagno, char **post_string)
}
*post_string = post;
- return true;
+ return eb_true;
} /* infPush */
/* I don't have any reverse pointers, so I'm just going to scan the list */
@@ -3271,15 +3271,15 @@ javaSetsTagVar(void *v, const char *val)
runningError(MSG_JSTextarea);
return;
}
- updateFieldInBuffer(t->seqno, val, parsePage ? 0 : 2, false);
+ updateFieldInBuffer(t->seqno, val, parsePage ? 0 : 2, eb_false);
} /* javaSetsTagVar */
-/* Return false to stop javascript, due to a url redirect */
+/* Return eb_false to stop javascript, due to a url redirect */
void
-javaSubmitsForm(void *v, bool reset)
+javaSubmitsForm(void *v, eb_bool reset)
{
char *post;
- bool rc;
+ eb_bool rc;
struct htmlTag *t;
buildTagArray();
@@ -3297,7 +3297,7 @@ javaSubmitsForm(void *v, bool reset)
showError();
return;
}
- gotoLocation(post, 0, false);
+ gotoLocation(post, 0, eb_false);
} /* javaSubmitsForm */
void
@@ -3317,7 +3317,7 @@ javaOpensWindow(const char *href, const char *name)
r = resolveURL(getBaseHref(-1), copy);
nzFree(copy);
if(!parsePage) {
- gotoLocation(r, 0, false);
+ gotoLocation(r, 0, eb_false);
return;
}
@@ -3331,7 +3331,7 @@ javaOpensWindow(const char *href, const char *name)
} /* javaOpensWindow */
void
-javaSetsTimeout(int n, const char *jsrc, void *to, bool isInterval)
+javaSetsTimeout(int n, const char *jsrc, void *to, eb_bool isInterval)
{
struct htmlTag *t = newTag("a");
char timedesc[48];
diff --git a/src/http.c b/src/http.c
index 892377f..474f3b0 100644
--- a/src/http.c
+++ b/src/http.c
@@ -25,8 +25,8 @@ static char errorText[CURL_ERROR_SIZE + 1];
static char *httpLanguage;
static void curl_setError(CURLcode curlret, const char *url);
-static bool ftpConnect(const char *url);
-static bool read_credentials(char *buffer);
+static eb_bool ftpConnect(const char *url);
+static eb_bool read_credentials(char *buffer);
static void init_header_parser(void);
static size_t curl_header_callback(char *header_line, size_t size, size_t nmemb,
void *unused);
@@ -76,7 +76,7 @@ curl_progress(void *unused, double dl_total, double dl_now,
{
int ret = 0;
if(intFlag) {
- intFlag = false;
+ intFlag = eb_false;
ret = 1;
}
return ret;
@@ -294,7 +294,7 @@ parseHeaderDate(const char *date)
return 0;
} /* parseHeaderDate */
-bool
+eb_bool
parseRefresh(char *ref, int *delay_p)
{
int delay = 0;
@@ -322,23 +322,23 @@ parseRefresh(char *ref, int *delay_p)
if(delay)
debugPrint(2, "delay %d", delay);
*delay_p = delay;
- return true;
+ return eb_true;
}
i_printf(MSG_GarbledRefresh, ref);
*delay_p = 0;
- return false;
+ return eb_false;
} /* parseRefresh */
-/* Return true if we waited for the duration, false if interrupted.
+/* Return eb_true if we waited for the duration, eb_false if interrupted.
* I don't know how to do this in Windows. */
-bool
+eb_bool
refreshDelay(int sec, const char *u)
{
/* the value 15 seconds is somewhat arbitrary */
if(sec < 15)
- return true;
+ return eb_true;
i_printf(MSG_RedirectDelayed, u, sec);
- return false;
+ return eb_false;
} /* refreshDelay */
static char hexdigits[] = "0123456789abcdef";
@@ -411,7 +411,7 @@ copy_and_sanitize(const char *start, const char *end)
long hcode; /* example, 404 */
char herror[32]; /* example, file not found */
-bool
+eb_bool
httpConnect(const char *from, const char *url)
{
char *referrer = NULL;
@@ -421,7 +421,7 @@ httpConnect(const char *from, const char *url)
char user[MAXUSERPASS], pass[MAXUSERPASS];
char creds_buf[MAXUSERPASS * 2 + 1]; /* creds abr. for credentials */
int creds_len = 0;
- bool still_fetching = true;
+ eb_bool still_fetching = eb_true;
int ssl_version;
const char *host;
struct MIMETYPE *mt;
@@ -432,9 +432,9 @@ httpConnect(const char *from, const char *url)
char *postb = NULL;
char *urlcopy = NULL;
int postb_l = 0;
- bool transfer_status = false;
+ eb_bool transfer_status = eb_false;
int redirect_count = 0;
- bool name_changed = false;
+ eb_bool name_changed = eb_false;
serverData = NULL;
serverDataLen = 0;
@@ -445,7 +445,7 @@ httpConnect(const char *from, const char *url)
/* See if the protocol is a recognized stream */
if(!prot) {
setError(MSG_WebProtBad, "(?)");
- return false;
+ return eb_false;
}
if(stringEqualCI(prot, "http") || stringEqualCI(prot, "https")) {
@@ -460,10 +460,10 @@ httpConnect(const char *from, const char *url)
system(cmd);
signal(SIGPIPE, SIG_IGN);
nzFree(cmd);
- return true;
+ return eb_true;
} else {
setError(MSG_WebProtBad, prot);
- return false;
+ return eb_false;
}
/* Ok, it's http, but the suffix could force a plugin */
@@ -485,7 +485,7 @@ httpConnect(const char *from, const char *url)
if(s) {
if(strlen(s) >= sizeof (user) - 2) {
setError(MSG_UserNameLong, sizeof (user));
- return false;
+ return eb_false;
}
strcpy(user, s);
}
@@ -493,7 +493,7 @@ httpConnect(const char *from, const char *url)
if(s) {
if(strlen(s) >= sizeof (pass) - 2) {
setError(MSG_PasswordLong, sizeof (pass));
- return false;
+ return eb_false;
}
strcpy(pass, s);
}
@@ -597,7 +597,7 @@ httpConnect(const char *from, const char *url)
creds_buf[creds_len] = ':';
strcpy(creds_buf + creds_len + 1, pass);
} else
- getUserPass(urlcopy, creds_buf, false);
+ getUserPass(urlcopy, creds_buf, eb_false);
/*
* If the URL didn't have user and password, and getUserPass failed,
@@ -619,11 +619,11 @@ httpConnect(const char *from, const char *url)
* password from the user. If the server accepts the username and password,
* then add it to the list of authentication records. */
- still_fetching = true;
+ still_fetching = eb_true;
ssl_version = CURL_SSLVERSION_DEFAULT;
serverData = initString(&serverDataLen);
- while(still_fetching == true) {
+ while(still_fetching == eb_true) {
char *redir = NULL;
curl_easy_setopt(curl_handle, CURLOPT_SSLVERSION, ssl_version);
init_header_parser();
@@ -657,14 +657,14 @@ httpConnect(const char *from, const char *url)
redir = get_redirect_location();
if(redir)
redir = resolveURL(urlcopy, redir);
- still_fetching = false;
+ still_fetching = eb_false;
if(redir == NULL) {
/* Redirected, but we don't know where to go. */
i_printf(MSG_RedirectNoURL, hcode);
- transfer_status = true;
+ transfer_status = eb_true;
} else if(redirect_count >= 10) {
i_puts(MSG_RedirectMany);
- transfer_status = true;
+ transfer_status = eb_true;
nzFree(redir);
} else { /* redirection looks good. */
strcpy(creds_buf, ":"); /* Flush stale data. */
@@ -675,7 +675,7 @@ httpConnect(const char *from, const char *url)
/* Convert POST request to GET request after redirection. */
curl_easy_setopt(curl_handle, CURLOPT_HTTPGET, 1);
- getUserPass(urlcopy, creds_buf, false);
+ getUserPass(urlcopy, creds_buf, eb_false);
curlret =
curl_easy_setopt(curl_handle, CURLOPT_USERPWD, creds_buf);
@@ -690,8 +690,8 @@ httpConnect(const char *from, const char *url)
serverData = EMPTYSTRING;
serverDataLen = 0;
redirect_count += 1;
- still_fetching = true;
- name_changed = true;
+ still_fetching = eb_true;
+ name_changed = eb_true;
debugPrint(2, "redirect %s", urlcopy);
/* after redirection, go back to default ssl version. */
@@ -704,22 +704,22 @@ httpConnect(const char *from, const char *url)
else if(hcode == 401) {
i_printf(MSG_AuthRequired, urlcopy);
nl();
- bool got_creds = read_credentials(creds_buf);
+ eb_bool got_creds = read_credentials(creds_buf);
if(got_creds) {
- addWebAuthorization(urlcopy, 1, creds_buf, false);
+ addWebAuthorization(urlcopy, 1, creds_buf, eb_false);
curl_easy_setopt(curl_handle, CURLOPT_USERPWD, creds_buf);
nzFree(serverData);
serverData = EMPTYSTRING;
serverDataLen = 0;
} else { /* User aborted the login process. */
- still_fetching = false;
- transfer_status = false;
+ still_fetching = eb_false;
+ transfer_status = eb_false;
}
}
/* authenticate? */
else { /* not redirect, not 401 */
- still_fetching = false;
- transfer_status = true;
+ still_fetching = eb_false;
+ transfer_status = eb_true;
}
}
@@ -729,7 +729,7 @@ httpConnect(const char *from, const char *url)
if(curlret != CURLE_OK)
curl_setError(curlret, urlcopy);
- if(transfer_status == false) {
+ if(transfer_status == eb_false) {
nzFree(serverData);
serverData = NULL;
serverDataLen = 0;
@@ -956,14 +956,14 @@ curl_setError(CURLcode curlret, const char *url)
} /* curl_setError */
/* Like httpConnect, but for ftp */
-static bool
+static eb_bool
ftpConnect(const char *url)
{
const int protLength = 6; /* length of "ftp://" */
char *urlcopy = NULL;
int urlcopy_l = 0;
- bool transfer_success = false;
- bool has_slash;
+ eb_bool transfer_success = eb_false;
+ eb_bool has_slash;
serverData = initString(&serverDataLen);
urlcopy = initString(&urlcopy_l);
stringAndString(&urlcopy, &urlcopy_l, url);
@@ -985,8 +985,8 @@ ftpConnect(const char *url)
curlret = curl_easy_perform(curl_handle);
if(curlret == CURLE_FTP_COULDNT_RETR_FILE) {
- if(has_slash == true) /* Was a directory. */
- transfer_success = false;
+ if(has_slash == eb_true) /* Was a directory. */
+ transfer_success = eb_false;
else { /* try appending a slash. */
stringAndChar(&urlcopy, &urlcopy_l, '/');
curlret = curl_easy_setopt(curl_handle, CURLOPT_URL, urlcopy);
@@ -995,31 +995,31 @@ ftpConnect(const char *url)
curlret = curl_easy_perform(curl_handle);
if(curlret != CURLE_OK)
- transfer_success = false;
+ transfer_success = eb_false;
else {
parse_directory_listing();
- transfer_success = true;
+ transfer_success = eb_true;
}
}
} else if(curlret == CURLE_OK) {
- if(has_slash == true)
+ if(has_slash == eb_true)
parse_directory_listing();
- transfer_success = true;
+ transfer_success = eb_true;
} else
- transfer_success = false;
+ transfer_success = eb_false;
if(serverDataLen >= CHUNKSIZE)
nl(); /* We printed dots, so we terminate them with newline */
ftp_transfer_fail:
- if(transfer_success == false) {
+ if(transfer_success == eb_false) {
if(curlret != CURLE_OK)
curl_setError(curlret, urlcopy);
nzFree(serverData);
serverData = 0;
serverDataLen = 0;
}
- if(transfer_success == true && !stringEqual(url, urlcopy))
+ if(transfer_success == eb_true && !stringEqual(url, urlcopy))
changeFileName = urlcopy;
else
nzFree(urlcopy);
@@ -1327,7 +1327,7 @@ message_for_response_code(int code)
static int
prompt_and_read(int prompt, char *buffer, int buffer_length, int error_message)
{
- bool reading = true;
+ eb_bool reading = eb_true;
int n = 0;
while(reading) {
i_printf(prompt);
@@ -1341,7 +1341,7 @@ prompt_and_read(int prompt, char *buffer, int buffer_length, int error_message)
i_printf(error_message, MAXUSERPASS - 2);
nl();
} else
- reading = false;
+ reading = eb_false;
}
return n;
} /* prompt_and_read */
@@ -1350,22 +1350,22 @@ prompt_and_read(int prompt, char *buffer, int buffer_length, int error_message)
* Function: read_credentials
* Arguments:
** buffer: buffer in which to place username and password.
- * Return value: true if credentials were read, false otherwise.
+ * Return value: eb_true if credentials were read, eb_false otherwise.
* Behavior: read a username and password from the user. Store them in
* the buffer, separated by a colon.
- * This function returns false in two situations.
+ * This function returns eb_false in two situations.
* 1. The program is not being run interactively. The error message is
* set to indicate this.
* 2. The user aborted the login process by typing x"x".
* Again, the error message reflects this condition.
*/
-static bool
+static eb_bool
read_credentials(char *buffer)
{
int input_length = 0;
- bool got_creds = false;
+ eb_bool got_creds = eb_false;
if(!isInteractive)
setError(MSG_Authorize2);
@@ -1378,7 +1378,7 @@ read_credentials(char *buffer)
prompt_and_read(MSG_Password, password_ptr, MAXUSERPASS,
MSG_PasswordLong);
if(!stringEqual(password_ptr, "x")) {
- got_creds = true;
+ got_creds = eb_true;
*(password_ptr - 1) = ':'; /* separate user and password with colon. */
}
}
@@ -1469,13 +1469,13 @@ static int
curl_debug_handler(CURL * handle, curl_infotype info_desc, char *data,
size_t size, void *unused)
{
- bool is_blank_line = true;
- static bool curlon = true;
+ eb_bool is_blank_line = eb_true;
+ static eb_bool curlon = eb_true;
int i = 0;
for(i = 0; i < size; i++)
if((data[i] != '\r') && (data[i] != '\n')) {
- is_blank_line = false;
+ is_blank_line = eb_false;
break;
}
diff --git a/src/jsdom.c b/src/jsdom.c
index 20e2a73..b5c2035 100644
--- a/src/jsdom.c
+++ b/src/jsdom.c
@@ -271,7 +271,7 @@ win_close(JSContext * cx, uintN argc, jsval * vp)
{
/* It's too confusing to just close the window */
i_puts(MSG_PageDone);
- cw->jsdead = true;
+ cw->jsdead = eb_true;
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
} /* win_close */
@@ -345,13 +345,13 @@ win_confirm(JSContext * cx, uintN argc, jsval * vp)
JSString *str;
char inbuf[80];
char c;
- bool first = true;
+ eb_bool first = eb_true;
if(argc > 0 && (str = JS_ValueToString(jcx, argv[0]))) {
msg = transcode_get_js_bytes(str);
}
- while(true) {
+ while(eb_true) {
printf("%s", msg);
c = 'x';
if(*msg)
@@ -363,7 +363,7 @@ win_confirm(JSContext * cx, uintN argc, jsval * vp)
}
if(!first)
printf("[y|n] ");
- first = false;
+ first = eb_false;
fflush(stdout);
if(!fgets(inbuf, sizeof (inbuf), stdin))
exit(1);
@@ -390,7 +390,7 @@ static JSClass timer_class = {
/* Set a timer or an interval */
static JSObject *
-setTimeout(uintN argc, jsval * argv, bool isInterval)
+setTimeout(uintN argc, jsval * argv, eb_bool isInterval)
{
jsval v0, v1;
JSObject *fo = 0; /* function object */
@@ -464,7 +464,7 @@ static JSBool
win_sto(JSContext * cx, uintN argc, jsval * vp)
{
jsval *argv = JS_ARGV(cx, vp);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(setTimeout(argc, argv, false)));
+ JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(setTimeout(argc, argv, eb_false)));
return JS_TRUE;
} /* win_sto */
@@ -472,7 +472,7 @@ static JSBool
win_intv(JSContext * cx, uintN argc, jsval * vp)
{
jsval *argv = JS_ARGV(cx, vp);
- JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(setTimeout(argc, argv, true)));
+ JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(setTimeout(argc, argv, eb_true)));
return JS_TRUE;
} /* win_intv */
@@ -508,7 +508,7 @@ dwrite2(const char *s)
} /* dwrite2 */
static void
-dwrite1(uintN argc, jsval * argv, bool newline)
+dwrite1(uintN argc, jsval * argv, eb_bool newline)
{
int i;
char *msg;
@@ -528,7 +528,7 @@ static JSBool
doc_write(JSContext * cx, uintN argc, jsval * vp)
{
jsval *argv = JS_ARGV(cx, vp);
- dwrite1(argc, argv, false);
+ dwrite1(argc, argv, eb_false);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
} /* doc_write */
@@ -567,7 +567,7 @@ static JSBool
doc_writeln(JSContext * cx, uintN argc, jsval * vp)
{
jsval *argv = JS_ARGV(cx, vp);
- dwrite1(argc, argv, true);
+ dwrite1(argc, argv, eb_true);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
} /* doc_writeln */
@@ -606,7 +606,7 @@ static JSBool
form_submit(JSContext * cx, uintN argc, jsval * vp)
{
JSObject *this = JS_THIS_OBJECT(cx, vp);
- javaSubmitsForm(this, false);
+ javaSubmitsForm(this, eb_false);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
} /* form_submit */
@@ -615,7 +615,7 @@ static JSBool
form_reset(JSContext * cx, uintN argc, jsval * vp)
{
JSObject *this = JS_THIS_OBJECT(cx, vp);
- javaSubmitsForm(this, true);
+ javaSubmitsForm(this, eb_true);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
} /* form_reset */
@@ -870,17 +870,17 @@ createJavaContext(void)
/* Some visual attributes of the window.
* These are just guesses.
* Better to have something, than to leave them undefined. */
- establish_property_number(jwin, "height", 768, true);
- establish_property_number(jwin, "width", 1024, true);
- establish_property_string(jwin, "status", 0, false);
- establish_property_string(jwin, "defaultStatus", 0, false);
- establish_property_bool(jwin, "returnValue", true, false);
- establish_property_bool(jwin, "menubar", true, false);
- establish_property_bool(jwin, "scrollbars", true, false);
- establish_property_bool(jwin, "toolbar", true, false);
- establish_property_bool(jwin, "resizable", true, false);
- establish_property_bool(jwin, "directories", false, false);
- establish_property_string(jwin, "name", "unspecifiedFrame", false);
+ establish_property_number(jwin, "height", 768, eb_true);
+ establish_property_number(jwin, "width", 1024, eb_true);
+ establish_property_string(jwin, "status", 0, eb_false);
+ establish_property_string(jwin, "defaultStatus", 0, eb_false);
+ establish_property_bool(jwin, "returnValue", eb_true, eb_false);
+ establish_property_bool(jwin, "menubar", eb_true, eb_false);
+ establish_property_bool(jwin, "scrollbars", eb_true, eb_false);
+ establish_property_bool(jwin, "toolbar", eb_true, eb_false);
+ establish_property_bool(jwin, "resizable", eb_true, eb_false);
+ establish_property_bool(jwin, "directories", eb_false, eb_false);
+ establish_property_string(jwin, "name", "unspecifiedFrame", eb_false);
/* Other classes that we'll need. */
for(i = 0; domClasses[i].class; ++i) {
@@ -899,13 +899,13 @@ createJavaContext(void)
i_printfExit(MSG_JavaObjError);
establish_property_object(jwin, "document", jdoc);
- establish_property_string(jdoc, "bgcolor", "white", false);
- establish_property_string(jdoc, "cookie", 0, false);
- establish_property_string(jdoc, "referrer", cw->referrer, true);
- establish_property_url(jdoc, "URL", cw->fileName, true);
- establish_property_url(jdoc, "location", cw->fileName, false);
- establish_property_url(jwin, "location", cw->firstURL, false);
- establish_property_string(jdoc, "domain", getHostURL(cw->fileName), false);
+ establish_property_string(jdoc, "bgcolor", "white", eb_false);
+ establish_property_string(jdoc, "cookie", 0, eb_false);
+ establish_property_string(jdoc, "referrer", cw->referrer, eb_true);
+ establish_property_url(jdoc, "URL", cw->fileName, eb_true);
+ establish_property_url(jdoc, "location", cw->fileName, eb_false);
+ establish_property_url(jwin, "location", cw->firstURL, eb_false);
+ establish_property_string(jdoc, "domain", getHostURL(cw->fileName), eb_false);
/* create arrays under document */
for(i = 0; itemname = docarrays[i]; ++i)
@@ -923,25 +923,25 @@ createJavaContext(void)
establish_property_object(jwin, "navigator", nav);
/* attributes of the navigator */
- establish_property_string(nav, "appName", "edbrowse", true);
- establish_property_string(nav, "appCode Name", "edbrowse C/SMJS", true);
+ establish_property_string(nav, "appName", "edbrowse", eb_true);
+ establish_property_string(nav, "appCode Name", "edbrowse C/SMJS", eb_true);
/* Use X11 to indicate unix/linux. Sort of a standard */
sprintf(verx11, "%s%s", version, "-X11");
- establish_property_string(nav, "appVersion", version, true);
- establish_property_string(nav, "userAgent", currentAgent, true);
- establish_property_string(nav, "oscpu", currentOS(), true);
- establish_property_string(nav, "platform", currentMachine(), true);
- establish_property_string(nav, "product", "smjs", true);
- establish_property_string(nav, "productSub", "1.5", true);
- establish_property_string(nav, "vendor", "eklhad", true);
- establish_property_string(nav, "vendorSub", version, true);
+ establish_property_string(nav, "appVersion", version, eb_true);
+ establish_property_string(nav, "userAgent", currentAgent, eb_true);
+ establish_property_string(nav, "oscpu", currentOS(), eb_true);
+ establish_property_string(nav, "platform", currentMachine(), eb_true);
+ establish_property_string(nav, "product", "smjs", eb_true);
+ establish_property_string(nav, "productSub", "1.5", eb_true);
+ establish_property_string(nav, "vendor", "eklhad", eb_true);
+ establish_property_string(nav, "vendorSub", version, eb_true);
/* We need to locale-ize the next one */
- establish_property_string(nav, "userLanguage", "english", true);
- establish_property_string(nav, "language", "english", true);
+ establish_property_string(nav, "userLanguage", "english", eb_true);
+ establish_property_string(nav, "language", "english", eb_true);
JS_DefineFunction(jcx, nav, "javaEnabled", falseFunction, 0, PROP_FIXED);
JS_DefineFunction(jcx, nav, "taintEnabled", falseFunction, 0, PROP_FIXED);
- establish_property_bool(nav, "cookieEnabled", true, true);
- establish_property_bool(nav, "onLine", true, true);
+ establish_property_bool(nav, "cookieEnabled", eb_true, eb_true);
+ establish_property_bool(nav, "onLine", eb_true, eb_true);
/* Build the array of mime types and plugins,
* according to the entries in the config file. */
@@ -961,18 +961,18 @@ createJavaContext(void)
mov = OBJECT_TO_JSVAL(mo);
JS_DefineElement(jcx, navmt, i, mov, NULL, NULL, PROP_FIXED);
establish_property_object(mo, "enabledPlugin", po);
- establish_property_string(mo, "type", mt->type, true);
+ establish_property_string(mo, "type", mt->type, eb_true);
establish_property_object(navmt, mt->type, mo);
- establish_property_string(mo, "description", mt->desc, true);
- establish_property_string(mo, "suffixes", mt->suffix, true);
+ establish_property_string(mo, "description", mt->desc, eb_true);
+ establish_property_string(mo, "suffixes", mt->suffix, eb_true);
/* I don't really have enough information, from the config file, to fill
* in the attributes of the plugin object.
* I'm just going to fake it.
* Description will be the same as that of the mime type,
* and the filename will be the program to run.
* No idea if this is right or not. */
- establish_property_string(po, "description", mt->desc, true);
- establish_property_string(po, "filename", mt->program, true);
+ establish_property_string(po, "description", mt->desc, eb_true);
+ establish_property_string(po, "filename", mt->program, eb_true);
/* For the name, how about the program without its options? */
len = strcspn(mt->program, " \t");
JS_DefineProperty(jcx, po, "name",
@@ -982,35 +982,35 @@ createJavaContext(void)
screen = JS_NewObject(jcx, 0, 0, jwin);
establish_property_object(jwin, "screen", screen);
- establish_property_number(screen, "height", 768, true);
- establish_property_number(screen, "width", 1024, true);
- establish_property_number(screen, "availHeight", 768, true);
- establish_property_number(screen, "availWidth", 1024, true);
- establish_property_number(screen, "availTop", 0, true);
- establish_property_number(screen, "availLeft", 0, true);
+ establish_property_number(screen, "height", 768, eb_true);
+ establish_property_number(screen, "width", 1024, eb_true);
+ establish_property_number(screen, "availHeight", 768, eb_true);
+ establish_property_number(screen, "availWidth", 1024, eb_true);
+ establish_property_number(screen, "availTop", 0, eb_true);
+ establish_property_number(screen, "availLeft", 0, eb_true);
del = JS_NewObject(jcx, 0, 0, jdoc);
establish_property_object(jdoc, "body", del);
establish_property_object(jdoc, "documentElement", del);
- establish_property_number(del, "clientHeight", 768, true);
- establish_property_number(del, "clientWidth", 1024, true);
- establish_property_number(del, "offsetHeight", 768, true);
- establish_property_number(del, "offsetWidth", 1024, true);
- establish_property_number(del, "scrollHeight", 768, true);
- establish_property_number(del, "scrollWidth", 1024, true);
- establish_property_number(del, "scrollTop", 0, true);
- establish_property_number(del, "scrollLeft", 0, true);
+ establish_property_number(del, "clientHeight", 768, eb_true);
+ establish_property_number(del, "clientWidth", 1024, eb_true);
+ establish_property_number(del, "offsetHeight", 768, eb_true);
+ establish_property_number(del, "offsetWidth", 1024, eb_true);
+ establish_property_number(del, "scrollHeight", 768, eb_true);
+ establish_property_number(del, "scrollWidth", 1024, eb_true);
+ establish_property_number(del, "scrollTop", 0, eb_true);
+ establish_property_number(del, "scrollLeft", 0, eb_true);
hist = JS_NewObject(jcx, 0, 0, jwin);
establish_property_object(jwin, "history", hist);
/* attributes of history */
- establish_property_string(hist, "current", cw->fileName, true);
+ establish_property_string(hist, "current", cw->fileName, eb_true);
/* There's no history in edbrowse. */
/* Only the current file is known, hence length is 1. */
- establish_property_number(hist, "length", 1, true);
- establish_property_string(hist, "next", 0, true);
- establish_property_string(hist, "previous", 0, true);
+ establish_property_number(hist, "length", 1, eb_true);
+ establish_property_string(hist, "next", 0, eb_true);
+ establish_property_string(hist, "previous", 0, eb_true);
JS_DefineFunction(jcx, hist, "back", nullFunction, 0, PROP_FIXED);
JS_DefineFunction(jcx, hist, "forward", nullFunction, 0, PROP_FIXED);
JS_DefineFunction(jcx, hist, "go", nullFunction, 0, PROP_FIXED);
@@ -1030,7 +1030,7 @@ freeJavaContext(void *jsc)
} /* freeJavaContext */
void
-establish_innerHTML(void *jv, const char *start, const char *end, bool is_ta)
+establish_innerHTML(void *jv, const char *start, const char *end, eb_bool is_ta)
{
JSObject *obj = jv, *o;
jsval v;
@@ -1074,11 +1074,11 @@ jMyContext(void)
jwin = jdoc = jwloc = jdloc = 0;
} /* jMyContext */
-bool
+eb_bool
javaParseExecute(void *this, const char *str, const char *filename, int lineno)
{
JSBool ok;
- bool rc;
+ eb_bool rc;
jsval rval;
/* Sometimes Mac puts these three chars at the start of a text file. */
@@ -1088,7 +1088,7 @@ javaParseExecute(void *this, const char *str, const char *filename, int lineno)
debugPrint(6, "javascript:\n%s", str);
ok = JS_EvaluateScript(jcx, this, str, strlen(str),
filename, lineno, &rval);
- rc = true;
+ rc = eb_true;
if(JSVAL_IS_BOOLEAN(rval))
rc = JSVAL_TO_BOOLEAN(rval);
JS_GC(jcx);
@@ -1105,7 +1105,7 @@ domLink(const char *classname, /* instantiate this class */
jsval vv, listv;
jsuint length, attr = PROP_FIXED;
JSClass *cp;
- bool dupname = false;
+ eb_bool dupname = eb_false;
int i;
if(cw->jsdead)
@@ -1160,7 +1160,7 @@ Yeah, it makes my head spin too.
JS_GetProperty(jcx, owner, symname, &vv);
v = JSVAL_TO_OBJECT(vv);
} else {
- dupname = true;
+ dupname = eb_true;
}
}
}
@@ -1170,11 +1170,11 @@ Yeah, it makes my head spin too.
if(radiosel) {
v = JS_NewArrayObject(jcx, 0, NULL);
if(radiosel == 1) {
- establish_property_string(v, "type", "radio", true);
+ establish_property_string(v, "type", "radio", eb_true);
} else {
/* self-referencing - hope this is ok */
establish_property_object(v, "options", v);
- establish_property_number(v, "selectedIndex", -1, false);
+ establish_property_number(v, "selectedIndex", -1, eb_false);
// not the normal pathway; we have to create our own element methods here.
JS_DefineFunction(jcx, v, "focus", nullFunction, 0, PROP_FIXED);
JS_DefineFunction(jcx, v, "blur", nullFunction, 0, PROP_FIXED);
@@ -1190,7 +1190,7 @@ Yeah, it makes my head spin too.
} else if(symname && !dupname) {
JS_DefineProperty(jcx, owner, symname, vv, NULL, NULL, attr);
if(stringEqual(symname, "action"))
- establish_property_bool(v, "actioncrash", true, true);
+ establish_property_bool(v, "actioncrash", eb_true, eb_true);
/* link to document.all */
JS_GetProperty(jcx, jdoc, "all", &listv);
@@ -1228,23 +1228,23 @@ Yeah, it makes my head spin too.
}
if(symname)
- establish_property_string(v, "name", symname, true);
+ establish_property_string(v, "name", symname, eb_true);
if(idname) {
/* v.id becomes idname, and idMaster.idname becomes v
* In case of forms, v.id should remain undefined. So we can have
* a form field named "id". */
if(strcmp(classname, "Form") != 0)
- establish_property_string(v, "id", idname, true);
+ establish_property_string(v, "id", idname, eb_true);
JS_GetProperty(jcx, jdoc, "idMaster", &listv);
master = JSVAL_TO_OBJECT(listv);
establish_property_object(master, idname, v);
} else {
if(strcmp(classname, "Form") != 0)
- establish_property_string(v, "id", EMPTYSTRING, true);
+ establish_property_string(v, "id", EMPTYSTRING, eb_true);
}
if(href && href_url) {
- establish_property_url(v, href, href_url, false);
+ establish_property_url(v, href, href_url, eb_false);
}
if(cp == &element_class) {
diff --git a/src/jsloc.c b/src/jsloc.c
index c571693..f0aaec9 100644
--- a/src/jsloc.c
+++ b/src/jsloc.c
@@ -29,7 +29,7 @@ static const char *emptyParms[] = { 0 };
static jsval emptyArgs[] = { 0 };
static void
- url_initialize(const char *url, bool readonly, bool exclude_href);
+ url_initialize(const char *url, eb_bool readonly, eb_bool exclude_href);
const char *
stringize(jsval v)
@@ -73,22 +73,22 @@ static JSClass url_class = {
static char urlbuffer[512];
static JSObject *uo; /* the url object */
static char *uo_href;
-static bool setter_suspend;
+static eb_bool setter_suspend;
/* Are we modifying window.location? */
-/*Return false if we are, because that will put a stop to javascript. */
-static bool
+/*Return eb_false if we are, because that will put a stop to javascript. */
+static eb_bool
isWinLoc(void)
{
if(uo != jwloc && uo != jdloc) {
nzFree(uo_href);
uo_href = 0;
- return true;
+ return eb_true;
}
/* This call frees t, or takes it over, so you should not free it here. */
- gotoLocation(uo_href, (allowRedirection ? 0 : 99), false);
+ gotoLocation(uo_href, (allowRedirection ? 0 : 99), eb_false);
uo_href = 0;
- return false;
+ return eb_false;
} /* isWinLoc */
/* Converting to a string just pulls out the href property */
@@ -107,7 +107,7 @@ loc_reload(JSContext * cx, uintN argc, jsval * vp)
{
const char *s = cw->firstURL;
if(s && isURL(s))
- gotoLocation(cloneString(s), (allowRedirection ? 0 : 99), true);
+ gotoLocation(cloneString(s), (allowRedirection ? 0 : 99), eb_true);
else
JS_ReportError(jcx, "location.reload() cannot find a url to refresh");
return JS_FALSE;
@@ -127,7 +127,7 @@ loc_replace(JSContext * cx, uintN argc, jsval * vp)
t = resolveURL(cw->fileName, ss);
nzFree(ss);
/* This call frees t, or takes it over, so you should not free it here. */
- gotoLocation(t, (allowRedirection ? 0 : 99), true);
+ gotoLocation(t, (allowRedirection ? 0 : 99), eb_true);
return JS_FALSE;
}
JS_ReportError(jcx,
@@ -145,7 +145,7 @@ build_url(int exception, const char *e)
static const char *const noslashes[] = {
"mailto", "telnet", "javascript", 0
};
- setter_suspend = true;
+ setter_suspend = eb_true;
/* I'm a little worried about the first one being freed while I'm
* getting the next one.
* I just don't know that much about the js heap. */
@@ -193,7 +193,7 @@ build_url(int exception, const char *e)
/* I want control over this string */
uo_href = cloneString(new_url);
JS_smprintf_free(new_url);
- setter_suspend = false;
+ setter_suspend = eb_false;
} /* build_url */
/* Rebuild host, because hostname or port changed. */
@@ -202,7 +202,7 @@ build_host(int exception, const char *hostname, int port)
{
jsval v;
const char *oldhost;
- setter_suspend = true;
+ setter_suspend = eb_true;
if(exception == 1) {
JS_GetProperty(jcx, uo, "port", &v);
port = JSVAL_TO_INT(v);
@@ -220,7 +220,7 @@ build_host(int exception, const char *hostname, int port)
i_printfExit(MSG_PortTooLong);
v = STRING_TO_JSVAL(our_JS_NewStringCopyZ(jcx, urlbuffer));
JS_SetProperty(jcx, uo, "host", &v);
- setter_suspend = false;
+ setter_suspend = eb_false;
} /* build_host */
/* define or set a local property */
@@ -290,9 +290,9 @@ setter_loc(JSContext * cx, JSObject * obj, jsid id, JSBool strict, jsval * vp)
t = resolveURL(cw->fileName, ss);
nzFree(ss);
/* This call frees t, or takes it over, so you should not free it here. */
- gotoLocation(t, (allowRedirection ? 0 : 99), false);
+ gotoLocation(t, (allowRedirection ? 0 : 99), eb_false);
}
-/* Return false to stop javascript. */
+/* Return eb_false to stop javascript. */
/* After all, we're trying to move to a new web page. */
return JS_FALSE;
} /* setter_loc */
@@ -308,7 +308,7 @@ setter_loc_href(JSContext * cx, JSObject * obj, jsid id, JSBool strict,
if(!url)
return JS_TRUE;
uo = obj;
- url_initialize(url, false, true);
+ url_initialize(url, eb_false, eb_true);
uo_href = cloneString(url);
if(uo == jwloc || uo == jdloc) {
char *t;
@@ -413,7 +413,7 @@ setter_loc_host(JSContext * cx, JSObject * obj, jsid id, JSBool strict,
uo = obj;
build_url(2, e);
/* and we have to update hostname and port */
- setter_suspend = true;
+ setter_suspend = eb_true;
s = strchr(e, ':');
if(s)
n = s - e;
@@ -425,12 +425,12 @@ setter_loc_host(JSContext * cx, JSObject * obj, jsid id, JSBool strict,
v = INT_TO_JSVAL(atoi(s + 1));
JS_SetProperty(jcx, uo, "port", &v);
}
- setter_suspend = false;
+ setter_suspend = eb_false;
return isWinLoc();
} /* setter_loc_pathname */
static void
-url_initialize(const char *url, bool readonly, bool exclude_href)
+url_initialize(const char *url, eb_bool readonly, eb_bool exclude_href)
{
int n, port;
const char *data;
@@ -440,7 +440,7 @@ url_initialize(const char *url, bool readonly, bool exclude_href)
if(readonly)
attr |= JSPROP_READONLY;
- setter_suspend = true;
+ setter_suspend = eb_true;
/* Store the url in location.href */
if(!exclude_href) {
@@ -508,7 +508,7 @@ url_initialize(const char *url, bool readonly, bool exclude_href)
loc_def_set_part("search", s, n, setter_loc_search, attr);
- setter_suspend = false;
+ setter_suspend = eb_false;
} /* url_initialize */
static JSBool
@@ -526,7 +526,7 @@ url_ctor(JSContext * cx, uintN argc, jsval * vp)
url = s;
} /* string argument */
uo = obj;
- url_initialize(url, false, false);
+ url_initialize(url, eb_false, eb_false);
return JS_TRUE;
} /* url_ctor */
@@ -605,14 +605,14 @@ getter_cookie(JSContext * cx, JSObject * obj, jsid id, jsval * vp)
int cook_l;
char *cook = initString(&cook_l);
const char *url = cw->fileName;
- bool secure = false;
+ eb_bool secure = eb_false;
const char *proto;
char *s;
if(url) {
proto = getProtURL(url);
if(proto && stringEqualCI(proto, "https"))
- secure = true;
+ secure = eb_true;
sendCookies(&cook, &cook_l, url, secure);
if(memEqualCI(cook, "cookie: ", 8)) { /* should often happen */
strmove(cook, cook + 8);
@@ -671,7 +671,7 @@ static JSBool(*my_setter) (JSContext *, JSObject *, jsid, JSBool, jsval *);
void
establish_property_string(void *jv, const char *name, const char *value,
- bool readonly)
+ eb_bool readonly)
{
JSObject *obj = jv;
jsuint attr = JSPROP_ENUMERATE | JSPROP_PERMANENT;
@@ -698,7 +698,7 @@ establish_property_string(void *jv, const char *name, const char *value,
void
establish_property_number(void *jv, const char *name, int value,
- bool readonly)
+ eb_bool readonly)
{
JSObject *obj = jv;
jsuint attr = JSPROP_ENUMERATE | JSPROP_PERMANENT;
@@ -712,7 +712,7 @@ establish_property_number(void *jv, const char *name, int value,
} /* establish_property_number */
void
-establish_property_bool(void *jv, const char *name, bool value, bool readonly)
+establish_property_bool(void *jv, const char *name, eb_bool value, eb_bool readonly)
{
jsuint attr = JSPROP_ENUMERATE | JSPROP_PERMANENT;
if(readonly)
@@ -745,7 +745,7 @@ establish_property_object(void *parent, const char *name, void *child)
void
establish_property_url(void *jv, const char *name,
- const char *url, bool readonly)
+ const char *url, eb_bool readonly)
{
JSObject *obj = jv;
jsuint attr = JSPROP_ENUMERATE | JSPROP_PERMANENT;
@@ -761,7 +761,7 @@ establish_property_url(void *jv, const char *name,
OBJECT_TO_JSVAL(uo), NULL, my_setter, attr);
if(!url)
url = EMPTYSTRING;
- url_initialize(url, readonly, false);
+ url_initialize(url, readonly, eb_false);
if(my_setter == setter_loc) {
if(obj == jwin)
jwloc = uo;
@@ -777,11 +777,11 @@ set_property_string(void *jv, const char *name, const char *value)
{
JSObject *obj = jv;
jsval vv;
- setter_suspend = true;
+ setter_suspend = eb_true;
vv = ((value && *value) ? STRING_TO_JSVAL(our_JS_NewStringCopyZ(jcx, value))
: JS_GetEmptyStringValue(jcx));
JS_SetProperty(jcx, obj, name, &vv);
- setter_suspend = false;
+ setter_suspend = eb_false;
} /* set_property_string */
void
@@ -789,10 +789,10 @@ set_property_number(void *jv, const char *name, int value)
{
JSObject *obj = jv;
jsval vv;
- setter_suspend = true;
+ setter_suspend = eb_true;
vv = INT_TO_JSVAL(value);
JS_SetProperty(jcx, obj, name, &vv);
- setter_suspend = false;
+ setter_suspend = eb_false;
} /* set_property_number */
void
@@ -800,15 +800,15 @@ set_property_bool(void *jv, const char *name, int value)
{
JSObject *obj = jv;
jsval vv;
- setter_suspend = true;
+ setter_suspend = eb_true;
vv = (value ? JSVAL_TRUE : JSVAL_FALSE);
JS_SetProperty(jcx, obj, name, &vv);
- setter_suspend = false;
+ setter_suspend = eb_false;
} /* set_property_bool */
/* These get routines assume the property exists, and of the right type. */
char *
-get_property_url(void *jv, bool doaction)
+get_property_url(void *jv, eb_bool doaction)
{
JSObject *obj = jv;
JSObject *lo; /* location object */
@@ -816,7 +816,7 @@ get_property_url(void *jv, bool doaction)
const char *s;
char *out_str = NULL;
int out_str_l;
- JSBool found = false;
+ JSBool found = eb_false;
if(!obj)
return 0;
if(!doaction) {
@@ -889,13 +889,13 @@ get_property_string(void *jv, const char *name)
return out_str;
} /* get_property_string */
-bool
+eb_bool
get_property_bool(void *jv, const char *name)
{
JSObject *obj = jv;
jsval v;
if(!obj)
- return false;
+ return eb_false;
JS_GetProperty(jcx, obj, name, &v);
return JSVAL_TO_BOOLEAN(v);
} /* get_property_bool */
@@ -958,15 +958,15 @@ establish_js_option(void *ev, int idx)
Compile and call event handlers.
*********************************************************************/
-bool
+eb_bool
handlerGo(void *obj, const char *name)
{
jsval rval;
- bool rc;
+ eb_bool rc;
JSBool found;
JS_HasProperty(jcx, obj, name, &found);
if(!found)
- return false;
+ return eb_false;
rc = JS_CallFunctionName(jcx, obj, name, 0, emptyArgs, &rval);
if(rc && JSVAL_IS_BOOLEAN(rval))
rc = JSVAL_TO_BOOLEAN(rval);
@@ -1005,13 +1005,13 @@ link_onunload_onclick(void *jv)
JS_DefineProperty(jcx, obj, "onclick", v, 0, 0, PROP_FIXED);
} /* link_onunload_onclick */
-bool
+eb_bool
handlerPresent(void *ev, const char *name)
{
JSObject *obj = ev;
JSBool found = JS_FALSE;
if(!obj)
- return false;
+ return eb_false;
JS_HasProperty(jcx, obj, name, &found);
return found;
} /* handlerPresent */
diff --git a/src/main.c b/src/main.c
index 904b73a..98b5dfb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -19,9 +19,9 @@ const char eol[] = "\r\n";
char EMPTYSTRING[] = "";
int debugLevel = 1;
int webTimeout = 20, mailTimeout = 0;
-bool ismc, browseLocal, passMail, errorExit;
-bool isInteractive, inInput, listNA;
-volatile bool intFlag;
+eb_bool ismc, browseLocal, passMail, errorExit;
+eb_bool isInteractive, inInput, listNA;
+volatile eb_bool intFlag;
int fileSize, maxFileSize = 50000000;
int localAccount, maxAccount;
struct MACCOUNT accounts[MAXACCOUNT];
@@ -30,14 +30,14 @@ struct MIMETYPE mimetypes[MAXMIME];
static int maxTables;
static struct DBTABLE dbtables[MAXDBT];
char *dbarea, *dblogin, *dbpw; /* to log into the database */
-bool fetchBlobColumns;
+eb_bool fetchBlobColumns;
char *proxy_host;
-bool caseInsensitive, searchStringsAll;
-bool undoable;
-bool allowRedirection = true, allowJS = true, sendReferrer = false;
-bool binaryDetect = true;
-bool inputReadLine;
-bool showHiddenFiles, helpMessagesOn;
+eb_bool caseInsensitive, searchStringsAll;
+eb_bool undoable;
+eb_bool allowRedirection = eb_true, allowJS = eb_true, sendReferrer = eb_false;
+eb_bool binaryDetect = eb_true;
+eb_bool inputReadLine;
+eb_bool showHiddenFiles, helpMessagesOn;
uchar dirWrite, endMarks;
int context = 1;
uchar linePending[MAXTTYLINE];
@@ -98,7 +98,7 @@ updateConfig(void)
close(fh);
} /* updateConfig */
-bool
+eb_bool
junkSubject(const char *s, char key)
{
int l, n;
@@ -106,15 +106,15 @@ junkSubject(const char *s, char key)
long exp = nowday;
if(!s || !*s) {
i_puts(MSG_NoSubject);
- return false;
+ return eb_false;
}
if(!cfgcopy) {
i_puts(MSG_NoConfig);
- return false;
+ return eb_false;
}
if(!subjstart) {
i_puts(MSG_NoSubjFilter);
- return false;
+ return eb_false;
}
if(key == 'j')
exp += 10;
@@ -138,7 +138,7 @@ junkSubject(const char *s, char key)
filters[n_filters].redirect = "x";
++n_filters;
}
- return true;
+ return eb_true;
} /* junkSubject */
/* This routine succeeds, or aborts via i_printfExit */
@@ -149,9 +149,9 @@ readConfigFile(void)
char *cfglp, *cfgnlp;
int buflen, n;
char c, ftype;
- bool cmt = false;
- bool startline = true;
- bool cfgmodify = false;
+ eb_bool cmt = eb_false;
+ eb_bool startline = eb_true;
+ eb_bool cfgmodify = eb_false;
uchar mailblock = 0, mimeblock = 0, tabblock = 0;
int nest, ln, j;
int sn = 0; /* script number */
@@ -172,7 +172,7 @@ readConfigFile(void)
"linelength", "localizeweb", 0
};
- if(!fileTypeByName(configFile, false))
+ if(!fileTypeByName(configFile, eb_false))
return; /* config file not present */
if(!fileIntoMemory(configFile, &buf, &buflen))
showErrorAbort();
@@ -195,10 +195,10 @@ readConfigFile(void)
if(cmt) {
if(c != '\n')
continue;
- cmt = false;
+ cmt = eb_false;
}
if(c == '#' && startline) {
- cmt = true;
+ cmt = eb_true;
goto putc;
}
if(c == '\n') {
@@ -307,7 +307,7 @@ readConfigFile(void)
*t++ = c;
v = t;
++ln;
- startline = true;
+ startline = eb_true;
continue;
}
if(c == ' ' || c == '\t') {
@@ -316,7 +316,7 @@ readConfigFile(void)
} else {
if(lidx < sizeof (last) - 1)
last[lidx++] = c;
- startline = false;
+ startline = eb_false;
}
putc:
*t++ = c;
@@ -365,7 +365,7 @@ readConfigFile(void)
s = v + 1;
filters[n_filters].expire = exp;
if(exp <= nowday) {
- cfgmodify = true;
+ cfgmodify = eb_true;
memmove(cfglp, cfgnlp, cfgcopy + cfglen - cfgnlp);
cfglen -= (cfgnlp - cfglp);
cfgnlp = cfglp;
@@ -475,7 +475,7 @@ readConfigFile(void)
case 8:
if(*v == '<')
- mt->stream = true, ++v;
+ mt->stream = eb_true, ++v;
mt->type = v;
continue;
@@ -528,27 +528,27 @@ readConfigFile(void)
case 17:
addressFile = v;
- ftype = fileTypeByName(v, false);
+ ftype = fileTypeByName(v, eb_false);
if(ftype && ftype != 'f')
i_printfExit(MSG_ERBC_AbNotFile, v);
continue;
case 18:
ipbFile = v;
- ftype = fileTypeByName(v, false);
+ ftype = fileTypeByName(v, eb_false);
if(ftype && ftype != 'f')
i_printfExit(MSG_ERBC_IPNotFile, v);
continue;
case 19:
mailDir = v;
- if(fileTypeByName(v, false) != 'd')
+ if(fileTypeByName(v, eb_false) != 'd')
i_printfExit(MSG_ERBC_NotDir, v);
mailUnread = allocMem(strlen(v) + 12);
sprintf(mailUnread, "%s/unread", v);
/* We need the unread directory, else we can't fetch mail. */
/* Create it if it isn't there. */
- if(fileTypeByName(mailUnread, false) != 'd') {
+ if(fileTypeByName(mailUnread, eb_false) != 'd') {
if(mkdir(mailUnread, 0700))
i_printfExit(MSG_ERBC_NotDir, mailUnread);
}
@@ -565,7 +565,7 @@ readConfigFile(void)
case 21:
cookieFile = v;
- ftype = fileTypeByName(v, false);
+ ftype = fileTypeByName(v, eb_false);
if(ftype && ftype != 'f')
i_printfExit(MSG_ERBC_JarNotFile, v);
j = open(v, O_WRONLY | O_APPEND | O_CREAT, 0600);
@@ -587,7 +587,7 @@ readConfigFile(void)
case 23:
spamCan = v;
- ftype = fileTypeByName(v, false);
+ ftype = fileTypeByName(v, eb_false);
if(ftype && ftype != 'f')
i_printfExit(MSG_ERBC_TrashNotFile, v);
continue;
@@ -602,7 +602,7 @@ readConfigFile(void)
case 26:
sslCerts = v;
- ftype = fileTypeByName(v, false);
+ ftype = fileTypeByName(v, eb_false);
if(ftype && ftype != 'f')
i_printfExit(MSG_ERBC_SSLNoFile, v);
j = open(v, O_RDONLY);
@@ -866,7 +866,7 @@ mailRedirect(const char *to, const char *from,
if(slen < 16 || mlen < 16)
break; /* too short */
j = k = 0;
- while(true) {
+ while(eb_true) {
char c = subj[j];
char d = m[k];
if(isupperByte(c))
@@ -899,18 +899,18 @@ mailRedirect(const char *to, const char *from,
Are we ok to parse and execute javascript?
*********************************************************************/
-bool
+eb_bool
javaOK(const char *url)
{
int j, hl, dl;
const char *h, *d, *q, *path;
if(!allowJS)
- return false;
+ return eb_false;
if(!url)
- return true;
+ return eb_true;
h = getHostURL(url);
if(!h)
- return true;
+ return eb_true;
hl = strlen(h);
path = getDataURL(url);
for(j = 0; j < javaDisCount; ++j) {
@@ -931,21 +931,21 @@ javaOK(const char *url)
continue;
if(strncmp(q, path, strlen(q)))
continue;
- return false;
+ return eb_false;
} /* domain/path was specified */
if(hl == dl)
- return false;
+ return eb_false;
if(h[hl - dl - 1] == '.')
- return false;
+ return eb_false;
}
- return true;
+ return eb_true;
} /* javaOK */
/* Catch interrupt and react appropriately. */
static void
catchSig(int n)
{
- intFlag = true;
+ intFlag = eb_true;
if(inInput)
i_puts(MSG_EnterInterrupt);
/* If we were reading from a file, or socket, this signal should
@@ -1001,8 +1001,8 @@ int
main(int argc, char **argv)
{
int cx, account;
- bool rc, doConfig = true;
- bool dofetch = false, domail = false;
+ eb_bool rc, doConfig = eb_true;
+ eb_bool dofetch = eb_false, domail = eb_false;
/* In case this is being piped over to a synthesizer, or whatever. */
if(fileTypeByHandle(fileno(stdout)) != 'f')
@@ -1025,7 +1025,7 @@ main(int argc, char **argv)
/* I require this, though I'm not sure what this means for non-Unix OS's */
if(!home)
i_printfExit(MSG_NotHome);
- if(fileTypeByName(home, false) != 'd')
+ if(fileTypeByName(home, eb_false) != 'd')
i_printfExit(MSG_NotDir, home);
/* See sample.ebrc in this directory for a sample config file. */
@@ -1043,7 +1043,7 @@ main(int argc, char **argv)
edbrowseTempHTML = allocMem(strlen(recycleBin) + 13);
sprintf(edbrowseTempHTML, "%s/eb_pdf.html", recycleBin);
- if(fileTypeByName(recycleBin, false) != 'd') {
+ if(fileTypeByName(recycleBin, eb_false) != 'd') {
if(mkdir(recycleBin, 0700)) {
/* Don't want to abort here; we might be on a readonly filesystem.
* Don't have a Trash directory and can't creat one; yet we should move on. */
@@ -1055,7 +1055,7 @@ main(int argc, char **argv)
if(recycleBin) {
mailStash = allocMem(strlen(recycleBin) + 12);
sprintf(mailStash, "%s/rawmail", recycleBin);
- if(fileTypeByName(mailStash, false) != 'd') {
+ if(fileTypeByName(mailStash, eb_false) != 'd') {
if(mkdir(mailStash, 0700)) {
free(mailStash);
mailStash = 0;
@@ -1081,7 +1081,7 @@ main(int argc, char **argv)
*argv = configFile;
else
++argv, --argc;
- doConfig = false;
+ doConfig = eb_false;
} else {
readConfigFile();
if(maxAccount && !localAccount)
@@ -1109,24 +1109,24 @@ main(int argc, char **argv)
}
if(stringEqual(s, "e")) {
- errorExit = true;
+ errorExit = eb_true;
continue;
}
if(*s == 'p')
- ++s, passMail = true;
+ ++s, passMail = eb_true;
if(*s == 'm' || *s == 'f') {
if(!maxAccount)
i_printfExit(MSG_NoMailAcc);
if(*s == 'f') {
account = 0;
- dofetch = true;
+ dofetch = eb_true;
++s;
if(*s == 'm')
- domail = true, ++s;
+ domail = eb_true, ++s;
} else {
- domail = true;
+ domail = eb_true;
++s;
}
if(isdigitByte(*s)) {
@@ -1135,8 +1135,8 @@ main(int argc, char **argv)
i_printfExit(MSG_BadAccNb, maxAccount);
}
if(!*s) {
- ismc = true; /* running as a mail client */
- allowJS = false; /* no javascript in mail client */
+ ismc = eb_true; /* running as a mail client */
+ allowJS = eb_false; /* no javascript in mail client */
++argv, --argc;
if(!argc || !dofetch)
break;
@@ -1232,7 +1232,7 @@ main(int argc, char **argv)
memmove(reclist, reclist + 1, sizeof (char *) * nrec);
atlist[-1] = 0;
if(sendMail(account, (const char **)reclist, body, 1,
- (const char **)atlist, 0, nalt, true))
+ (const char **)atlist, 0, nalt, eb_true))
exit(0);
showError();
exit(1);
@@ -1252,14 +1252,14 @@ main(int argc, char **argv)
++cx;
if(cx == MAXSESSION)
i_printfExit(MSG_ManyOpen, MAXSESSION);
- cxSwitch(cx, false);
+ cxSwitch(cx, eb_false);
if(cx == 1)
runEbFunction("init");
changeFileName = 0;
cw->fileName = cloneString(file);
cw->firstURL = cloneString(file);
if(isSQL(file))
- cw->sqlMode = true;
+ cw->sqlMode = eb_true;
rc = readFile(file, "");
if(fileSize >= 0)
debugPrint(1, "%d", fileSize);
@@ -1272,7 +1272,7 @@ main(int argc, char **argv)
changeFileName = 0;
}
- cw->firstOpMode = cw->changeMode = false;
+ cw->firstOpMode = cw->changeMode = eb_false;
/* Browse the text if it's a url */
if(rc && !(cw->binMode | cw->dirMode) && cw->dol &&
isBrowseableURL(cw->fileName)) {
@@ -1285,22 +1285,22 @@ main(int argc, char **argv)
} /* loop over files */
if(!cx) { /* no files */
++cx;
- cxSwitch(cx, false);
+ cxSwitch(cx, eb_false);
runEbFunction("init");
i_puts(MSG_Ready);
}
if(cx > 1)
- cxSwitch(1, false);
- undoable = false;
+ cxSwitch(1, eb_false);
+ undoable = eb_false;
- while(true) {
+ while(eb_true) {
uchar saveline[MAXTTYLINE];
pst p = inputLine();
copyPstring(saveline, p);
if(perl2c((char *)p))
i_puts(MSG_EnterNull);
else
- edbrowseCommand((char *)p, false);
+ edbrowseCommand((char *)p, eb_false);
copyPstring(linePending, saveline);
} /* infinite loop */
} /* main */
@@ -1312,7 +1312,7 @@ balance(const char *ip, int direction)
int nest = 0;
uchar code;
- while(true) {
+ while(eb_true) {
if(direction > 0) {
ip = strchr(ip, '\n') + 1;
} else {
@@ -1337,7 +1337,7 @@ balance(const char *ip, int direction)
} /* balance */
/* Run an edbrowse function, as defined in the config file. */
-bool
+eb_bool
runEbFunction(const char *line)
{
char *linecopy = cloneString(line);
@@ -1349,13 +1349,13 @@ runEbFunction(const char *line)
int j, l, nest;
const char *ip; /* think instruction pointer */
const char *endl; /* end of line to be processed */
- bool nofail, ok;
+ eb_bool nofail, ok;
uchar code;
char stack[MAXNEST];
int loopcnt[MAXNEST];
/* Separate function name and arguments */
- spaceCrunch(linecopy, true, false);
+ spaceCrunch(linecopy, eb_true, eb_false);
if(linecopy[0] == 0) {
setError(MSG_NoFunction);
goto fail;
@@ -1383,7 +1383,7 @@ runEbFunction(const char *line)
ip = ebScript[j] + 1;
nofail = (ebScriptName[j][0] == '+');
nest = 0;
- ok = true;
+ ok = eb_true;
/* collect arguments */
j = 0;
@@ -1428,12 +1428,12 @@ runEbFunction(const char *line)
continue;
}
if(ucontrol == 'W' || ucontrol == 'U') {
- bool jump = ok;
+ eb_bool jump = ok;
if(islowerByte(control))
- jump ^= true;
+ jump ^= eb_true;
if(ucontrol == 'U')
- jump ^= true;
- ok = true;
+ jump ^= eb_true;
+ ok = eb_true;
if(jump)
ip = start;
else
@@ -1446,7 +1446,7 @@ runEbFunction(const char *line)
if(code == 0x81) {
const char *skip = balance(ip, 1);
- bool jump;
+ eb_bool jump;
char control = ip[1];
char ucontrol = toupper(control);
stack[++nest] = control;
@@ -1465,8 +1465,8 @@ runEbFunction(const char *line)
/* if or while, test on ok */
jump = ok;
if(isupperByte(control))
- jump ^= true;
- ok = true;
+ jump ^= eb_true;
+ ok = eb_true;
if(jump)
goto ahead;
goto nextline;
@@ -1509,7 +1509,7 @@ runEbFunction(const char *line)
/* Here we go! */
debugPrint(3, "< %s", new);
- ok = edbrowseCommand(new, true);
+ ok = edbrowseCommand(new, eb_true);
free(new);
nextline:
@@ -1520,16 +1520,16 @@ runEbFunction(const char *line)
goto fail;
nzFree(linecopy);
- return true;
+ return eb_true;
fail:
nzFree(linecopy);
- return false;
+ return eb_false;
} /* runEbFunction */
/* Send the contents of the current buffer to a running program */
-bool
-bufferToProgram(const char *cmd, const char *suffix, bool trailPercent)
+eb_bool
+bufferToProgram(const char *cmd, const char *suffix, eb_bool trailPercent)
{
char *buf = 0;
int buflen, n;
@@ -1541,11 +1541,11 @@ bufferToProgram(const char *cmd, const char *suffix, bool trailPercent)
FILE *f = popen(cmd, "w");
if(!f) {
setError(MSG_NoSpawn, cmd, errno);
- return false;
+ return eb_false;
}
- if(!unfoldBuffer(context, false, &buf, &buflen)) {
+ if(!unfoldBuffer(context, eb_false, &buf, &buflen)) {
pclose(f);
- return false; /* should never happen */
+ return eb_false; /* should never happen */
}
n = fwrite(buf, buflen, 1, f);
pclose(f);
@@ -1557,14 +1557,14 @@ bufferToProgram(const char *cmd, const char *suffix, bool trailPercent)
/* assume it's the same data */
*u = 0;
} else {
- if(!unfoldBuffer(context, false, &buf, &buflen)) {
+ if(!unfoldBuffer(context, eb_false, &buf, &buflen)) {
*u = 0;
- return false; /* should never happen */
+ return eb_false; /* should never happen */
}
if(!memoryOutToFile(edbrowseTempFile, buf, buflen,
MSG_TempNoCreate2, MSG_NoWrite2)) {
*u = 0;
- return false;
+ return eb_false;
}
*u = 0;
}
@@ -1572,7 +1572,7 @@ bufferToProgram(const char *cmd, const char *suffix, bool trailPercent)
}
nzFree(buf);
- return true;
+ return eb_true;
} /* bufferToProgram */
struct DBTABLE *
@@ -1659,14 +1659,14 @@ pluginCommand(const struct MIMETYPE *m, const char *file, const char *suffix)
int len, suflen;
const char *s;
char *cmd, *t;
- bool trailPercent = false;
+ eb_bool trailPercent = eb_false;
/* leave rooom for space quote quote null */
len = strlen(m->program) + 4;
if(file) {
len += strlen(file);
} else if(m->program[strlen(m->program) - 1] == '%') {
- trailPercent = true;
+ trailPercent = eb_true;
len += strlen(edbrowseTempFile) + 6;
}
diff --git a/src/messages.c b/src/messages.c
index 4b82ab3..d62bcf9 100644
--- a/src/messages.c
+++ b/src/messages.c
@@ -2685,7 +2685,7 @@ static const char *polishMessages[] = {
static const char **messageArray = englishMessages;
static int messageArrayLength = sizeof (englishMessages) / sizeof (char *);
-bool cons_utf8, iuConvert = true;
+eb_bool cons_utf8, iuConvert = eb_true;
char type8859 = 1;
void
@@ -2699,7 +2699,7 @@ selectLanguage(void)
return;
if(strstrCI(s, "utf8") || strstrCI(s, "utf-8"))
- cons_utf8 = true;
+ cons_utf8 = eb_true;
/* We roll our own international messages in this file, so you wouldn't think
* we need setlocale, but pcre needs the locale for expressions like \w,
@@ -2936,16 +2936,16 @@ static const char lowerMore[] = "";
static const char letterMore[] = "";
-static bool
+static eb_bool
i_isalphaByte(unsigned char c)
{
if(isalphaByte(c))
- return true;
- if(c == false)
+ return eb_true;
+ if(c == eb_false)
return 0;
if(strchr(letterMore, c))
- return true;
- return false;
+ return eb_true;
+ return eb_false;
} /* i_isalphaByte */
/* assumes the arg is a letter */
@@ -2980,7 +2980,7 @@ i_caseShift(unsigned char *s, char action)
unsigned char c;
/* The McDonalds conversion is very English - should we do it in all languages? */
int mc = 0;
- bool ws = true;
+ eb_bool ws = eb_true;
for(; c = *s; ++s) {
if(action == 'u') {
@@ -3011,11 +3011,11 @@ i_caseShift(unsigned char *s, char action)
} else
mc = 0;
*s = c;
- ws = false;
+ ws = eb_false;
continue;
}
- ws = true, mc = 0;
+ ws = eb_true, mc = 0;
} /* loop */
} /* caseShift */
diff --git a/src/sendmail.c b/src/sendmail.c
index c384537..84c4196 100644
--- a/src/sendmail.c
+++ b/src/sendmail.c
@@ -15,8 +15,8 @@
char serverLine[MAXMSLINE];
static char spareLine[MAXMSLINE];
int mssock; /* mail server socket */
-static bool doSignature;
-static bool ssl_on;
+static eb_bool doSignature;
+static eb_bool ssl_on;
static const char *mailhost;
static char subjectLine[200];
static int mailAccount;
@@ -29,25 +29,25 @@ static int nads; /* number of addresses */
static time_t adbooktime;
/* read and/or refresh the address book */
-bool
+eb_bool
loadAddressBook(void)
{
char *buf, *bufend, *v, *last, *s, *t;
- bool cmt = false;
+ eb_bool cmt = eb_false;
char state = 0, c;
int j, buflen, ln = 1;
time_t mtime;
if(!addressFile ||
(mtime = fileTimeByName(addressFile)) == -1 || mtime <= adbooktime)
- return true;
+ return eb_true;
debugPrint(3, "loading address book");
nzFree(addressList);
addressList = 0;
nads = 0;
if(!fileIntoMemory(addressFile, &buf, &buflen))
- return false;
+ return eb_false;
bufend = buf + buflen;
for(s = t = last = buf; s < bufend; ++s) {
@@ -55,7 +55,7 @@ loadAddressBook(void)
if(cmt) {
if(c != '\n')
continue;
- cmt = false;
+ cmt = eb_false;
}
if(c == ':') { /* delimiter */
if(state == 0) {
@@ -63,7 +63,7 @@ loadAddressBook(void)
freefail:
nzFree(buf);
nads = 0;
- return false;
+ return eb_false;
}
while(t[-1] == ' ' || t[-1] == '\t')
--t;
@@ -75,7 +75,7 @@ loadAddressBook(void)
c = '#'; /* extra fields are ignored */
} /* : */
if(c == '#') {
- cmt = true;
+ cmt = eb_true;
continue;
}
if(c == '\n') {
@@ -156,7 +156,7 @@ loadAddressBook(void)
/* aliases are present */
nzFree(buf);
adbooktime = mtime;
- return true;
+ return eb_true;
} /* loadAddressBook */
const char *
@@ -179,8 +179,8 @@ Put and get lines from the mail server.
Print the lines if the debug level calls for it.
*********************************************************************/
-bool
-mailPutLine(const char *buf, bool realdot)
+eb_bool
+mailPutLine(const char *buf, eb_bool realdot)
{
int n, j, len = strlen(buf);
char c;
@@ -241,12 +241,12 @@ mailPutLine(const char *buf, bool realdot)
if(n < len) {
setError(MSG_MailWrite);
- return false;
+ return eb_false;
}
- return true;
+ return eb_true;
} /* mailPutLine */
-bool
+eb_bool
mailGetLine(void)
{
int n, len, slen;
@@ -259,7 +259,7 @@ mailGetLine(void)
while(!s) {
if(slen + 1 == sizeof (serverLine)) {
setError(MSG_MailResponseLong);
- return false;
+ return eb_false;
}
if(ssl_on)
len = ssl_read(serverLine + slen, sizeof (serverLine) - 1 - slen);
@@ -269,7 +269,7 @@ mailGetLine(void)
sizeof (serverLine) - 1 - slen);
if(len <= 0) {
setError(MSG_MailRead);
- return false;
+ return eb_false;
}
slen += len;
serverLine[slen] = 0;
@@ -280,17 +280,17 @@ mailGetLine(void)
if(s > serverLine && s[-1] == '\r')
*--s = 0;
debugPrint(4, "< %s", serverLine);
- return true;
+ return eb_true;
} /* mailGetLine */
-static bool
+static eb_bool
mailPutGet(const char *line)
{
- if(!mailPutLine(line, false))
- return false;
+ if(!mailPutLine(line, eb_false))
+ return eb_false;
if(!mailGetLine())
- return false;
- return true;
+ return eb_false;
+ return eb_true;
} /* mailPutGet */
void
@@ -303,7 +303,7 @@ mailPutGetError(const char *line)
void
mailClose(void)
{
- mailPutLine("quit\r\n", false);
+ mailPutLine("quit\r\n", eb_false);
/* the other side has to have time to process the quit command, before we simply hang up. */
usleep(400000);
if(ssl_on)
@@ -312,21 +312,21 @@ mailClose(void)
} /* mailClose */
/* Connect to the mail server */
-bool
+eb_bool
mailConnect(const char *host, int port, int secure)
{
- ssl_on = false;
+ ssl_on = eb_false;
IP32bit ip = tcp_name_ip(host);
if(ip == NULL_IP) {
setError((intFlag ? MSG_Interrupted : MSG_MailLocate), host);
- return false;
+ return eb_false;
}
debugPrint(4, "%s -> %s", host, tcp_ip_dots(ip));
mailhost = host;
mssock = tcp_connect(ip, port, mailTimeout);
if(mssock < 0) {
setError(intFlag ? MSG_Interrupted : MSG_MailConnect);
- return false;
+ return eb_false;
}
debugPrint(4, "connected to port %d", port);
spareLine[0] = 0;
@@ -337,18 +337,18 @@ mailConnect(const char *host, int port, int secure)
setError(MSG_NoCertify, host);
else
setError(MSG_WebConnectSecure, host, n);
- return false;
+ return eb_false;
}
debugPrint(3, "secure connection established");
- ssl_on = true;
+ ssl_on = eb_true;
}
- return true;
+ return eb_true;
} /* mailConnect */
static char base64_chars[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
char *
-base64Encode(const char *inbuf, int inlen, bool lines)
+base64Encode(const char *inbuf, int inlen, eb_bool lines)
{
char *out, *outstr;
uchar *in = (uchar *) inbuf;
@@ -445,7 +445,7 @@ isoEncode(char *start, char *end)
if(nacount * 4 >= count && count > 8) {
code = 'B';
- s = base64Encode(start, end - start, false);
+ s = base64Encode(start, end - start, eb_false);
goto package;
}
@@ -489,13 +489,13 @@ charsetString(const char *ct, const char *ce)
* In fact ismail indicates the line that holds the subject.
* If ismail is negative, then -ismail indicates the subject line,
* and the string file is not the filename, but rather, the mail to send. */
-bool
-encodeAttachment(const char *file, int ismail, bool webform,
+eb_bool
+encodeAttachment(const char *file, int ismail, eb_bool webform,
const char **type_p, const char **enc_p, char **data_p)
{
char *buf;
char c;
- bool longline;
+ eb_bool longline;
char *s, *t, *v;
char *ct, *ce; /* content type, content encoding */
int buflen, i, cx;
@@ -510,8 +510,8 @@ encodeAttachment(const char *file, int ismail, bool webform,
if(!ismc && (cx = stringIsNum(file)) >= 0) {
static char newfilename[16];
- if(!unfoldBuffer(cx, false, &buf, &buflen))
- return false;
+ if(!unfoldBuffer(cx, eb_false, &buf, &buflen))
+ return eb_false;
if(!buflen) {
if(webform) {
empty:
@@ -529,7 +529,7 @@ encodeAttachment(const char *file, int ismail, bool webform,
file = sessionList[cx].lw->fileName;
} else {
if(!fileIntoMemory(file, &buf, &buflen))
- return false;
+ return eb_false;
if(!buflen) {
if(webform)
goto empty;
@@ -600,10 +600,10 @@ encodeAttachment(const char *file, int ismail, bool webform,
if(doSignature) { /* Append .signature file. */
/* Try account specific .signature file, then fall back to .signature */
sprintf(sigFileEnd, "%d", mailAccount);
- c = fileTypeByName(sigFile, false);
+ c = fileTypeByName(sigFile, eb_false);
if(!c) {
*sigFileEnd = 0;
- c = fileTypeByName(sigFile, false);
+ c = fileTypeByName(sigFile, eb_false);
}
if(c != 0) {
int fd, n;
@@ -654,7 +654,7 @@ encodeAttachment(const char *file, int ismail, bool webform,
/* Count the nonascii characters */
nacount = nullcount = nlcount = 0;
- longline = false;
+ longline = eb_false;
s = 0;
for(i = 0; i < buflen; ++i) {
c = buf[i];
@@ -667,16 +667,16 @@ encodeAttachment(const char *file, int ismail, bool webform,
++nlcount;
t = buf + i;
if(s && t - s > 120)
- longline = true;
+ longline = eb_true;
if(!s && i > 120)
- longline = true;
+ longline = eb_true;
s = t;
}
t = buf + i;
if(s && t - s > 120)
- longline = true;
+ longline = eb_true;
if(!s && i > 120)
- longline = true;
+ longline = eb_true;
debugPrint(6, "attaching %s length %d nonascii %d nulls %d longline %d",
file, buflen, nacount, nullcount, longline);
nacount += nullcount;
@@ -699,7 +699,7 @@ encodeAttachment(const char *file, int ismail, bool webform,
setError(MSG_MailBinary, file);
goto freefail;
}
- s = base64Encode(buf, buflen, true);
+ s = base64Encode(buf, buflen, eb_true);
nzFree(buf);
buf = s;
ce = "base64";
@@ -785,11 +785,11 @@ encodeAttachment(const char *file, int ismail, bool webform,
*enc_p = ce;
*type_p = ct;
*data_p = buf;
- return true;
+ return eb_true;
freefail:
nzFree(buf);
- return false;
+ return eb_false;
} /* encodeAttachment */
static char *
@@ -854,10 +854,10 @@ makeBoundary(void)
} /* makeBoundary */
/* Send mail to the smtp server. */
-bool
+eb_bool
sendMail(int account, const char **recipients, const char *body,
int subjat, const char **attachments, const char *refline,
- int nalt, bool dosig)
+ int nalt, eb_bool dosig)
{
char *from, *fromiso, *reply, *login, *smlogin, *pass;
const struct MACCOUNT *a, *ao, *localMail;
@@ -866,14 +866,14 @@ sendMail(int account, const char **recipients, const char *body,
char *t;
int nat, cx, i, j;
char *out = 0;
- bool mustmime = false;
- bool firstgreet = true;
- bool firstrec;
+ eb_bool mustmime = eb_false;
+ eb_bool firstgreet = eb_true;
+ eb_bool firstrec;
const char *ct, *ce;
char *encoded = 0;
if(!validAccount(account))
- return false;
+ return eb_false;
mailAccount = account;
localMail = accounts + localAccount - 1;
@@ -896,14 +896,14 @@ sendMail(int account, const char **recipients, const char *body,
++nat;
}
if(nat)
- mustmime = true;
+ mustmime = eb_true;
if(nalt && nalt < nat) {
setError(MSG_AttAlternate);
- return false;
+ return eb_false;
}
if(!loadAddressBook())
- return false;
+ return eb_false;
/* set copy flags */
for(j = 0; s = recipients[j]; ++j) {
@@ -912,7 +912,7 @@ sendMail(int account, const char **recipients, const char *body,
cc = *s++;
if(j == MAXRECAT) {
setError(MSG_RecipMany, MAXRECAT);
- return false;
+ return eb_false;
}
recipients[j] = s;
reccc[j] = cc;
@@ -939,53 +939,53 @@ sendMail(int account, const char **recipients, const char *body,
}
if(!addressFile) {
setError(MSG_ABMissing);
- return false;
+ return eb_false;
}
setError(MSG_ABNoAlias2, s);
- return false;
+ return eb_false;
} /* recipients */
if(!j) {
setError(MSG_RecipNone);
- return false;
+ return eb_false;
}
/* verify attachments are readable */
for(j = 0; s = attachments[j]; ++j) {
if(!ismc && (cx = stringIsNum(s)) >= 0) {
if(!cxCompare(cx) || !cxActive(cx))
- return false;
+ return eb_false;
if(!sessionList[cx].lw->dol) {
setError(MSG_AttSessionEmpty, cx);
- return false;
+ return eb_false;
}
} else {
- char ftype = fileTypeByName(s, false);
+ char ftype = fileTypeByName(s, eb_false);
if(!ftype) {
setError(MSG_AttAccess, s);
- return false;
+ return eb_false;
}
if(ftype != 'f') {
setError(MSG_AttRegular, s);
- return false;
+ return eb_false;
}
if(!fileSizeByName(s)) {
setError(MSG_AttEmpty2, s);
- return false;
+ return eb_false;
}
}
} /* loop over attachments */
- if(!encodeAttachment(body, subjat, false, &ct, &ce, &encoded))
- return false;
+ if(!encodeAttachment(body, subjat, eb_false, &ct, &ce, &encoded))
+ return eb_false;
if(ce[0] == 'q')
- mustmime = true;
+ mustmime = eb_true;
boundary = makeBoundary();
if(!mailConnect(ao->outurl, ao->outport, ao->outssl)) {
nzFree(encoded);
- return false;
+ return eb_false;
}
if(!mailGetLine())
goto mailfail;
@@ -1000,7 +1000,7 @@ sendMail(int account, const char **recipients, const char *body,
sayhello:
sprintf(serverLine, "%s %s%s", (a->outssl ? "ehlo" : "Helo"), smlogin, eol);
- if(!mailPutLine(serverLine, false))
+ if(!mailPutLine(serverLine, eb_false))
goto mailfail;
get250:
if(!mailGetLine())
@@ -1034,10 +1034,10 @@ sendMail(int account, const char **recipients, const char *body,
goto mailfail;
}
debugPrint(3, "secure connection established");
- ssl_on = true;
+ ssl_on = eb_true;
/* We have to send EHLO after starttls, per RFC 2487 */
- firstgreet = false;
+ firstgreet = eb_false;
goto sayhello;
}
@@ -1048,7 +1048,7 @@ sendMail(int account, const char **recipients, const char *body,
setError(MSG_AuthLoginOnly);
goto mailfail;
}
- b = base64Encode(login, strlen(login), false);
+ b = base64Encode(login, strlen(login), eb_false);
sprintf(serverLine, "%s%s", b, eol);
nzFree(b);
if(!mailPutGet(serverLine))
@@ -1057,7 +1057,7 @@ sendMail(int account, const char **recipients, const char *body,
setError(MSG_AuthLoginOnly);
goto mailfail;
}
- b = base64Encode(pass, strlen(pass), false);
+ b = base64Encode(pass, strlen(pass), eb_false);
sprintf(serverLine, "%s%s", b, eol);
nzFree(b);
if(!mailPutGet(serverLine))
@@ -1096,35 +1096,35 @@ sendMail(int account, const char **recipients, const char *body,
/* Build the outgoing mail, and send it in one go, as one string. */
out = initString(&j);
- firstrec = true;
+ firstrec = eb_true;
for(i = 0; s = recipients[i]; ++i) {
if(reccc[i])
continue;
stringAndString(&out, &j, firstrec ? "To:" : ",\r\n ");
stringAndString(&out, &j, s);
- firstrec = false;
+ firstrec = eb_false;
}
if(!firstrec)
stringAndString(&out, &j, eol);
- firstrec = true;
+ firstrec = eb_true;
for(i = 0; s = recipients[i]; ++i) {
if(reccc[i] != '^')
continue;
stringAndString(&out, &j, firstrec ? "CC:" : ",\r\n ");
stringAndString(&out, &j, s);
- firstrec = false;
+ firstrec = eb_false;
}
if(!firstrec)
stringAndString(&out, &j, eol);
- firstrec = true;
+ firstrec = eb_true;
for(i = 0; s = recipients[i]; ++i) {
if(reccc[i] != '?')
continue;
stringAndString(&out, &j, firstrec ? "BCC:" : ",\r\n ");
stringAndString(&out, &j, s);
- firstrec = false;
+ firstrec = eb_false;
}
if(!firstrec)
stringAndString(&out, &j, eol);
@@ -1181,8 +1181,8 @@ this format, some or all of this message may not be legible.\r\n\r\n--");
if(mustmime) {
for(i = 0; s = attachments[i]; ++i) {
- if(!encodeAttachment(s, 0, false, &ct, &ce, &encoded))
- return false;
+ if(!encodeAttachment(s, 0, eb_false, &ct, &ce, &encoded))
+ return eb_false;
sprintf(serverLine, "%s--%s%sContent-Type: %s%s", eol, boundary,
eol, ct, charsetString(ct, ce));
stringAndString(&out, &j, serverLine);
@@ -1208,7 +1208,7 @@ this format, some or all of this message may not be legible.\r\n\r\n--");
/* mime format */
/* A dot alone ends the transmission */
stringAndString(&out, &j, ".\r\n");
- if(!mailPutLine(out, true))
+ if(!mailPutLine(out, eb_true))
goto mailfail;
nzFree(out);
out = 0;
@@ -1224,31 +1224,31 @@ this format, some or all of this message may not be legible.\r\n\r\n--");
}
mailClose();
- return true;
+ return eb_true;
mailfail:
nzFree(encoded);
nzFree(out);
close(mssock);
- return false;
+ return eb_false;
} /* sendMail */
-bool
+eb_bool
validAccount(int n)
{
if(!maxAccount) {
setError(MSG_MailAccountsNone);
- return false;
+ return eb_false;
}
if(n <= 0 || n > maxAccount) {
setError(MSG_MailAccountBad, n, maxAccount);
- return false;
+ return eb_false;
}
- return true;
+ return eb_true;
} /* validAccount */
-bool
-sendMailCurrent(int sm_account, bool dosig)
+eb_bool
+sendMailCurrent(int sm_account, eb_bool dosig)
{
const char *reclist[MAXRECAT + 1];
char *recmem;
@@ -1261,32 +1261,32 @@ sendMailCurrent(int sm_account, bool dosig)
int nrec = 0, nat = 0, nalt = 0;
int account = localAccount;
int j;
- bool rc = false;
- bool subj = false;
+ eb_bool rc = eb_false;
+ eb_bool subj = eb_false;
if(cw->browseMode) {
setError(MSG_MailBrowse);
- return false;
+ return eb_false;
}
if(cw->sqlMode) {
setError(MSG_MailDB);
- return false;
+ return eb_false;
}
if(cw->dirMode) {
setError(MSG_MailDir);
- return false;
+ return eb_false;
}
if(cw->binMode) {
setError(MSG_MailBinary2);
- return false;
+ return eb_false;
}
if(!cw->dol) {
setError(MSG_MailEmpty);
- return false;
+ return eb_false;
}
if(!validAccount(account))
- return false;
+ return eb_false;
recmem = initString(&lr);
atmem = initString(&la);
@@ -1380,7 +1380,7 @@ sendMailCurrent(int sm_account, bool dosig)
setError(MSG_SubjectEmpty2);
goto done;
}
- subj = true;
+ subj = eb_true;
}
break;
diff --git a/src/stringfile.c b/src/stringfile.c
index 4920272..110cd80 100644
--- a/src/stringfile.c
+++ b/src/stringfile.c
@@ -135,22 +135,22 @@ stripWhite(char *s)
/* compress white space */
void
-spaceCrunch(char *s, bool onespace, bool unprint)
+spaceCrunch(char *s, eb_bool onespace, eb_bool unprint)
{
int i, j;
char c;
- bool space = true;
+ eb_bool space = eb_true;
for(i = j = 0; c = s[i]; ++i) {
if(isspaceByte(c)) {
if(!onespace)
continue;
if(!space)
- s[j++] = ' ', space = true;
+ s[j++] = ' ', space = eb_true;
continue;
}
if(unprint && !isprintByte(c))
continue;
- s[j++] = c, space = false;
+ s[j++] = c, space = eb_false;
}
if(space && j)
--j; /* drop trailing space */
@@ -374,17 +374,17 @@ stringIsNum(const char *s)
return n;
} /* stringIsNum */
-bool
+eb_bool
stringIsFloat(const char *s, double *dp)
{
const char *t;
*dp = strtod(s, (char **)&t);
if(*t)
- return false; /* extra stuff at the end */
- return true;
+ return eb_false; /* extra stuff at the end */
+ return eb_true;
} /* stringIsFloat */
-bool
+eb_bool
stringIsPDF(const char *s)
{
int j = 0;
@@ -393,17 +393,17 @@ stringIsPDF(const char *s)
return j >= 5 && stringEqual(s + j - 4, ".pdf");
} /* stringIsPDF */
-bool
+eb_bool
isSQL(const char *s)
{
char c;
const char *c1 = 0, *c2 = 0;
c = *s;
#ifndef HAVE_SQL
- return false;
+ return eb_false;
#endif
if(isURL(s))
- return false;
+ return eb_false;
if(!isalphaByte(c))
goto no;
for(++s; c = *s; ++s) {
@@ -423,12 +423,12 @@ isSQL(const char *s)
}
}
no:
- return false;
+ return eb_false;
yes:
- return true;
+ return eb_true;
} /* isSQL */
-bool
+eb_bool
memEqualCI(const char *s, const char *t, int len)
{
char c, d;
@@ -439,10 +439,10 @@ memEqualCI(const char *s, const char *t, int len)
if(islowerByte(d))
d = toupper(d);
if(c != d)
- return false;
+ return eb_false;
++s, ++t;
}
- return true;
+ return eb_true;
} /* memEqualCI */
char *
@@ -457,7 +457,7 @@ strstrCI(const char *base, const char *search)
return 0;
} /* strstrCI */
-bool
+eb_bool
stringEqualCI(const char *s, const char *t)
{
char c, d;
@@ -467,14 +467,14 @@ stringEqualCI(const char *s, const char *t)
if(islowerByte(d))
d = toupper(d);
if(c != d)
- return false;
+ return eb_false;
++s, ++t;
}
if(*s)
- return false;
+ return eb_false;
if(*t)
- return false;
- return true;
+ return eb_false;
+ return eb_true;
} /* stringEqualCI */
int
@@ -523,7 +523,7 @@ charInList(const char *list, char c)
/* In an empty list, next and prev point back to the list, not to 0. */
/* We also allow zero. */
-bool
+eb_bool
listIsEmpty(const struct listHead * l)
{
return l->next == l || l->next == 0;
@@ -585,15 +585,15 @@ freeList(struct listHead *l)
} /* freeList */
/* like isalnumByte, but allows _ and - */
-bool
+eb_bool
isA(char c)
{
if(isalnumByte(c))
- return true;
+ return eb_true;
return (c == '_' || c == '-');
} /* isA */
-bool
+eb_bool
isquote(char c)
{
return c == '"' || c == '\'';
@@ -701,7 +701,7 @@ copyPstring(pst s, const pst t)
* This solves an outstanding issue, and it is needed for forthcoming
* functionality, such as edpager.
*/
-bool
+eb_bool
fdIntoMemory(int fd, char **data, int *len)
{
int length, n;
@@ -720,7 +720,7 @@ fdIntoMemory(int fd, char **data, int *len)
*data = EMPTYSTRING;
*len = 0;
setError(MSG_NoRead, "file descriptor");
- return false;
+ return eb_false;
}
if(n > 0)
@@ -731,27 +731,27 @@ fdIntoMemory(int fd, char **data, int *len)
buf = reallocMem(buf, length + 2);
*data = buf;
*len = length;
- return true;
+ return eb_true;
} /* fdIntoMemory */
-bool
+eb_bool
fileIntoMemory(const char *filename, char **data, int *len)
{
int fh;
- char ftype = fileTypeByName(filename, false);
- bool ret;
+ char ftype = fileTypeByName(filename, eb_false);
+ eb_bool ret;
if(ftype && ftype != 'f') {
setError(MSG_RegularFile, filename);
- return false;
+ return eb_false;
}
fh = open(filename, O_RDONLY | O_BINARY);
if(fh < 0) {
setError(MSG_NoOpen, filename);
- return false;
+ return eb_false;
}
ret = fdIntoMemory(fh, data, len);
- if(ret == false)
+ if(ret == eb_false)
setError(MSG_NoRead2, filename);
close(fh);
@@ -759,7 +759,7 @@ fileIntoMemory(const char *filename, char **data, int *len)
} /* fileIntoMemory */
/* inverse of the above */
-bool
+eb_bool
memoryOutToFile(const char *filename, const char *data, int len,
/* specify the error messages */
int msgcreate, int msgwrite)
@@ -767,15 +767,15 @@ memoryOutToFile(const char *filename, const char *data, int len,
int fh = open(filename, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0666);
if(fh < 0) {
setError(msgcreate, filename, errno);
- return false;
+ return eb_false;
}
if(write(fh, data, len) < len) {
setError(msgwrite, filename, errno);
close(fh);
- return false;
+ return eb_false;
}
close(fh);
- return true;
+ return eb_true;
} /* memoryOutToFile */
/* shift string to upper, lower, or mixed case */
@@ -785,7 +785,7 @@ caseShift(char *s, char action)
{
char c;
int mc = 0;
- bool ws = true;
+ eb_bool ws = eb_true;
for(; c = *s; ++s) {
if(action == 'u') {
@@ -814,10 +814,10 @@ caseShift(char *s, char action)
} else
mc = 0;
*s = c;
- ws = false;
+ ws = eb_false;
continue;
}
- ws = true, mc = 0;
+ ws = eb_true, mc = 0;
} /* loop */
} /* caseShift */
@@ -834,10 +834,10 @@ is ported to other operating systems.
* But the link feature is Unix specific. */
char
-fileTypeByName(const char *name, bool showlink)
+fileTypeByName(const char *name, eb_bool showlink)
{
struct stat buf;
- bool islink = false;
+ eb_bool islink = eb_false;
char c;
int mode;
if(lstat(name, &buf)) {
@@ -846,7 +846,7 @@ fileTypeByName(const char *name, bool showlink)
}
mode = buf.st_mode & S_IFMT;
if(mode == S_IFLNK) { /* symbolic link */
- islink = true;
+ islink = eb_true;
/* If this fails, I'm guessing it's just a file. */
if(stat(name, &buf))
return (showlink ? 'F' : 0);
@@ -960,7 +960,7 @@ ttyRestoreSettings(void)
* min=0 time>0: return 1 char, or 0 if the timer expires.
* min=0 time=0: nonblocking, return whatever chars have been received. */
static void
-ttyRaw(int charcount, int timeout, bool isecho)
+ttyRaw(int charcount, int timeout, eb_bool isecho)
{
termstruct buf = savettybuf; /* structure copy */
buf.c_cc[VMIN] = charcount;
@@ -977,7 +977,7 @@ getche(void)
{
char c;
fflush(stdout);
- ttyRaw(1, 0, true);
+ ttyRaw(1, 0, eb_true);
read(0, &c, 1);
ttyRestoreSettings();
return c;
@@ -988,7 +988,7 @@ getch(void)
{
char c;
fflush(stdout);
- ttyRaw(1, 0, false);
+ ttyRaw(1, 0, eb_false);
read(0, &c, 1);
ttyRestoreSettings();
return c;
@@ -1000,7 +1000,7 @@ char
getLetter(const char *s)
{
char c;
- while(true) {
+ while(eb_true) {
c = getch();
if(strchr(s, c))
break;
@@ -1013,7 +1013,7 @@ getLetter(const char *s)
/* loop through the files in a directory */
/* Hides the differences between DOS, Unix, and NT. */
-static bool dirstart = true;
+static eb_bool dirstart = eb_true;
char *
nextScanFile(const char *base)
@@ -1021,10 +1021,10 @@ nextScanFile(const char *base)
char *s;
#ifdef DOSLIKE
static char global[] = "/*.*";
- bool rc;
+ eb_bool rc;
short len;
char *p;
- bool allocate = false;
+ eb_bool allocate = eb_false;
#ifdef MSDOS
static struct _find_t dta;
#else
@@ -1042,7 +1042,7 @@ nextScanFile(const char *base)
len = strlen(base) - 1;
p = allocMem(len + 6);
strcpy(p, base);
- allocate = true;
+ allocate = eb_true;
if(p[len] == '/' || p[len] == '\\')
p[len] = 0;
strcat(p, global);
@@ -1051,10 +1051,10 @@ nextScanFile(const char *base)
#ifdef MSDOS
rc = _dos_findfirst(p, (showHiddenFiles ? 077 : 073), &dta);
#else
- rc = false;
+ rc = eb_false;
handle = _findfirst(p, &dta);
if(handle < 0)
- rc = true;
+ rc = eb_true;
#endif
if(allocate)
nzFree(p);
@@ -1072,7 +1072,7 @@ nextScanFile(const char *base)
#endif
#ifdef DOSLIKE
- while(true) {
+ while(eb_true) {
/* read the next file */
if(!dirStart) {
#ifdef MSDOS
@@ -1080,7 +1080,7 @@ nextScanFile(const char *base)
#else
rc = _findnext(handle, &dta);
#endif
- dirstart = false;
+ dirstart = eb_false;
}
if(rc)
break;
@@ -1116,18 +1116,18 @@ nextScanFile(const char *base)
} /* nextScanFile */
/* Sorted directory list. Uses textLines[]. */
-bool
+eb_bool
sortedDirList(const char *dir, int *start, int *end)
{
char *f;
int j;
- bool change;
+ eb_bool change;
*start = *end = textLinesCount;
while(f = nextScanFile(dir)) {
if(!linesComing(1))
- return false;
+ return eb_false;
textLines[textLinesCount] = allocMem(strlen(f) + 3);
strcpy((char *)textLines[textLinesCount], f);
textLinesCount++;
@@ -1135,23 +1135,23 @@ sortedDirList(const char *dir, int *start, int *end)
*end = textLinesCount;
if(*end == *start)
- return true;
+ return eb_true;
/* Bubble sort, the list shouldn't be too long. */
- change = true;
+ change = eb_true;
while(change) {
- change = false;
+ change = eb_false;
for(j = *start; j < *end - 1; ++j) {
if(strcmp((char *)textLines[j], (char *)textLines[j + 1]) > 0) {
pst swap = textLines[j];
textLines[j] = textLines[j + 1];
textLines[j + 1] = swap;
- change = true;
+ change = eb_true;
}
}
}
- return true;
+ return eb_true;
} /* sortedDirList */
/* Expand environment variables, then wild cards.
@@ -1160,7 +1160,7 @@ sortedDirList(const char *dir, int *start, int *end)
* Neither the original line nore the new line is allocated.
* They are static char buffers that are just plain long enough. */
-bool
+eb_bool
envFile(const char *line, const char **expanded)
{
static char line1[MAXTTYLINE];
@@ -1168,7 +1168,7 @@ envFile(const char *line, const char **expanded)
const char *s, *value, *basedir;
char *t, *dollar, *cut, *file;
char c;
- bool cc, badBrackets;
+ eb_bool cc, badBrackets;
int filecount;
char re[MAXRE + 20];
const char *re_error;
@@ -1179,20 +1179,20 @@ envFile(const char *line, const char **expanded)
/* ` supresses this stuff */
if(*line == '`') {
*expanded = line + 1;
- return true;
+ return eb_true;
}
/* quick check, nothing to do */
if(!strpbrk(line, "$[*?") && line[0] != '~') {
*expanded = line;
- return true;
+ return eb_true;
}
/* first the env variables */
s = line;
t = line1;
dollar = 0;
- while(true) {
+ while(eb_true) {
if(t >= line1 + sizeof (line1))
goto longvar;
c = *s;
@@ -1209,7 +1209,7 @@ envFile(const char *line, const char **expanded)
value = getenv(dollar + 1);
if(!value) {
setError(MSG_NoEnvVar, dollar + 1);
- return false;
+ return eb_false;
}
if(dollar + strlen(value) >= line1 + sizeof (line1) - 1)
goto longvar;
@@ -1239,34 +1239,34 @@ envFile(const char *line, const char **expanded)
}
if(!dollar) { /* nothing meta */
*expanded = line1;
- return true;
+ return eb_true;
}
if(cut && dollar < cut) {
setError(MSG_EarlyExpand);
- return false;
+ return eb_false;
}
/* Make sure its a directory, and build a perl regexp for the pattern. */
if(cut) {
*cut = 0;
- if(cut > line1 && fileTypeByName(line1, false) != 'd') {
+ if(cut > line1 && fileTypeByName(line1, eb_false) != 'd') {
setError(MSG_NoAccessDir, line1);
- return false;
+ return eb_false;
}
}
s = cut ? cut + 1 : line1;
t = re;
*t++ = '^';
- cc = badBrackets = false;
+ cc = badBrackets = eb_false;
while(c = *s) {
if(t >= re + sizeof (re) - 3) {
setError(MSG_ShellPatternLong);
- return false;
+ return eb_false;
}
if(c == '\\') {
setError(MSG_ExpandBackslash);
- return false;
+ return eb_false;
}
/* things we need to escape */
if(strchr("().+|", c))
@@ -1278,13 +1278,13 @@ envFile(const char *line, const char **expanded)
*t++ = c;
if(c == '[') {
if(cc)
- badBrackets = true;
- cc = true;
+ badBrackets = eb_true;
+ cc = eb_true;
}
if(c == ']') {
if(!cc)
- badBrackets = true;
- cc = false;
+ badBrackets = eb_true;
+ cc = eb_false;
}
++s;
} /* loop over shell pattern */
@@ -1292,18 +1292,18 @@ envFile(const char *line, const char **expanded)
*t = 0;
if(badBrackets | cc) {
setError(MSG_ShellSyntax);
- return false;
+ return eb_false;
}
debugPrint(7, "shell regexp %s", re);
re_cc = pcre_compile(re, 0, &re_error, &re_offset, 0);
if(!re_cc) {
setError(MSG_ShellCompile, re_error);
- return false;
+ return eb_false;
}
filecount = 0;
- cc = false; /* long flag */
+ cc = eb_false; /* long flag */
basedir = 0;
if(cut) {
if(cut == line1)
@@ -1318,7 +1318,7 @@ envFile(const char *line, const char **expanded)
if(re_count < -1) {
pcre_free(re_cc);
setError(MSG_ShellExpand);
- return false;
+ return eb_false;
}
if(re_count < 0)
continue;
@@ -1326,7 +1326,7 @@ envFile(const char *line, const char **expanded)
if(filecount > 1)
continue;
if((cut ? strlen(line1) : 0) + strlen(file) >= sizeof (line2) - 2)
- cc = true;
+ cc = eb_true;
else if(cut)
sprintf(line2, "%s/%s", line1, file);
else
@@ -1335,17 +1335,17 @@ envFile(const char *line, const char **expanded)
pcre_free(re_cc);
if(filecount != 1) {
setError((filecount > 0) + MSG_ShellNoMatch);
- return false;
+ return eb_false;
}
if(cc)
goto longvar;
*expanded = line2;
- return true;
+ return eb_true;
longvar:
setError(MSG_ShellLineLong);
- return false;
+ return eb_false;
} /* envFile */
static struct utsname utsbuf;
diff --git a/src/url.c b/src/url.c
index 67b2dc3..c66e626 100644
--- a/src/url.c
+++ b/src/url.c
@@ -10,33 +10,33 @@
struct {
char *prot;
int port;
- bool free_syntax;
- bool need_slashes;
- bool need_slash_after_host;
+ eb_bool free_syntax;
+ eb_bool need_slashes;
+ eb_bool need_slash_after_host;
} protocols[] = {
{
- "file", 0, true, true, false}, {
- "http", 80, false, true, true}, {
- "https", 443, false, true, true}, {
- "proxy", 3128, false, true, true}, {
- "ftp", 21, false, true, true}, {
- "rtsp", 554, false, true, true}, {
- "pnm", 7070, false, true, true}, {
- "finger", 79, false, true, true}, {
- "smb", 139, false, true, true}, {
- "mailto", 0, false, false, false}, {
- "telnet", 23, false, false, false}, {
- "tn3270", 0, false, false, false}, {
- "javascript", 0, true, false, false}, {
-"git", 0, false, false, false}, {
-"svn", 0, false, false, false}, {
-"gopher", 70, false, false, false}, {
-"magnet", 0, false, false, false}, {
-"irc", 0, false, false, false}, {
+ "file", 0, eb_true, eb_true, eb_false}, {
+ "http", 80, eb_false, eb_true, eb_true}, {
+ "https", 443, eb_false, eb_true, eb_true}, {
+ "proxy", 3128, eb_false, eb_true, eb_true}, {
+ "ftp", 21, eb_false, eb_true, eb_true}, {
+ "rtsp", 554, eb_false, eb_true, eb_true}, {
+ "pnm", 7070, eb_false, eb_true, eb_true}, {
+ "finger", 79, eb_false, eb_true, eb_true}, {
+ "smb", 139, eb_false, eb_true, eb_true}, {
+ "mailto", 0, eb_false, eb_false, eb_false}, {
+ "telnet", 23, eb_false, eb_false, eb_false}, {
+ "tn3270", 0, eb_false, eb_false, eb_false}, {
+ "javascript", 0, eb_true, eb_false, eb_false}, {
+"git", 0, eb_false, eb_false, eb_false}, {
+"svn", 0, eb_false, eb_false, eb_false}, {
+"gopher", 70, eb_false, eb_false, eb_false}, {
+"magnet", 0, eb_false, eb_false, eb_false}, {
+"irc", 0, eb_false, eb_false, eb_false}, {
NULL, 0}
};
-static bool free_syntax;
+static eb_bool free_syntax;
static int
protocolByName(const char *p, int l)
@@ -78,7 +78,7 @@ unpercentURL(char *url)
} /* unpercentURL */
/* Decide if it looks like a web url. */
-static bool
+static eb_bool
httpDefault(const char *url)
{
static const char *const domainSuffix[] = {
@@ -104,25 +104,25 @@ httpDefault(const char *url)
if(*s == '.' && s[-1] != '.' && s[1] != '.')
++n, lastdot = s;
if(n < 2)
- return false;
+ return eb_false;
/* All digits, like an ip address, is ok. */
if(n == 3) {
for(s = url; s < end; ++s)
if(!isdigitByte(*s) && *s != '.')
break;
if(s == end)
- return true;
+ return eb_true;
}
/* Look for standard domain suffix */
++lastdot;
len = end - lastdot;
for(n = 0; domainSuffix[n]; ++n)
if(memEqualCI(lastdot, domainSuffix[n], len) && !domainSuffix[n][len])
- return true;
+ return eb_true;
/* www.anything.xx is ok */
if(len == 2 && memEqualCI(url, "www.", 4))
- return true;
- return false;
+ return eb_true;
+ return eb_false;
} /* httpDefault */
static int
@@ -160,7 +160,7 @@ parseURL(const char *url, const char **proto, int *prlen, const char **user, int
*dalen = 0;
if(post)
*post = NULL;
- free_syntax = false;
+ free_syntax = eb_false;
if(!url)
return -1;
@@ -178,7 +178,7 @@ parseURL(const char *url, const char **proto, int *prlen, const char **user, int
while(isspaceByte(*q))
++q;
if(!*q)
- return false;
+ return eb_false;
a = protocolByName(url, p - url);
}
if(a >= 0) {
@@ -223,14 +223,14 @@ parseURL(const char *url, const char **proto, int *prlen, const char **user, int
}
if(a < 0)
- return false;
+ return eb_false;
if(free_syntax = protocols[a].free_syntax) {
if(data)
*data = p;
if(dalen)
*dalen = strlen(p);
- return true;
+ return eb_true;
}
q = p + strcspn(p, "@?#/\1");
@@ -292,27 +292,27 @@ parseURL(const char *url, const char **proto, int *prlen, const char **user, int
*dalen = q - p;
if(post)
*post = *q ? q + 1 : NULL;
- return true;
+ return eb_true;
} /* parseURL */
-bool
+eb_bool
isURL(const char *url)
{
int j = parseURL(url, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
if(j < 0)
- return false;
+ return eb_false;
return j;
} /* isURL */
/* non-FTP URLs are always browsable. FTP URLs are browsable if they end with
* a slash. */
-bool
+eb_bool
isBrowseableURL(const char *url)
{
if(isURL(url))
return (!memEqualCI(url, "ftp://", 6)) || (url[strlen(url) - 1] == '/');
else
- return false;
+ return eb_false;
} /* isBrowseableURL */
/* Helper functions to return pieces of the URL.
@@ -480,15 +480,15 @@ getDirURL(const char *url, const char **start_p, const char **end_p)
*end_p = myslash + 1;
} /* getDirURL */
-bool
+eb_bool
getPortLocURL(const char *url, const char **portloc, int *port)
{
int rc = parseURL(url, 0, 0, 0, 0, 0, 0, 0, 0, portloc, port, 0, 0, 0);
if(rc <= 0)
- return false;
+ return eb_false;
if(free_syntax)
- return false;
- return true;
+ return eb_false;
+ return eb_true;
} /* getPortLocURL */
int
@@ -503,21 +503,21 @@ getPortURL(const char *url)
return port;
} /* getPortURL */
-bool
+eb_bool
isProxyURL(const char *url)
{
return ((url[0] | 0x20) == 'p');
}
/*
- * hasPrefix: return true if s has a prefix of p, false otherwise.
+ * hasPrefix: return eb_true if s has a prefix of p, eb_false otherwise.
*/
-static bool
+static eb_bool
hasPrefix(char *s, char *p)
{
- bool ret = false;
+ eb_bool ret = eb_false;
if(!p[0])
- ret = true; /* Empty string is a prefix of all strings. */
+ ret = eb_true; /* Empty string is a prefix of all strings. */
else {
size_t slen = strlen(s);
size_t plen = strlen(p);
@@ -710,7 +710,7 @@ resolveURL(const char *base, const char *rel)
} /* resolveURL */
/* This routine could be, should be, more sophisticated */
-bool
+eb_bool
sameURL(const char *s, const char *t)
{
const char *u, *v;
@@ -728,7 +728,7 @@ sameURL(const char *s, const char *t)
v -= 7;
l = u - s;
if(l != v - t)
- return false;
+ return eb_false;
return !memcmp(s, t, l);
} /* sameURL */
@@ -752,7 +752,7 @@ altText(const char *base)
if(recount >= 2)
return 0;
strncpy(buf, base, sizeof (buf) - 1);
- spaceCrunch(buf, true, false);
+ spaceCrunch(buf, eb_true, eb_false);
len = strlen(buf);
if(len && !isalnumByte(buf[len - 1]))
buf[--len] = 0;
--
1.8.5.2.297.g3e57c29
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Edbrowse-dev] [PATCH 4/4] Add ifdef guard to js.h
2013-12-24 15:38 [Edbrowse-dev] [PATCH 1/4] Add check to eb.h so functions work in c++ Adam Thompson
2013-12-24 15:38 ` [Edbrowse-dev] [PATCH 2/4] Alter bool typedef to eb_bool in eb.h Adam Thompson
2013-12-24 15:38 ` [Edbrowse-dev] [PATCH 3/4] Alter c files to use new eb_bool typedef Adam Thompson
@ 2013-12-24 15:38 ` Adam Thompson
2 siblings, 0 replies; 4+ messages in thread
From: Adam Thompson @ 2013-12-24 15:38 UTC (permalink / raw)
To: edbrowse-dev
---
src/js.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/js.h b/src/js.h
index 1b383c6..d965be3 100644
--- a/src/js.h
+++ b/src/js.h
@@ -4,7 +4,8 @@
* can be combined to this file, jsdom.c and jsloc.c.
* No other file need know about the javascript API,
* and no other file should include jsapi.h. */
-
+#ifndef _JS_H
+#define _JS_H
#include <jsapi.h>
extern JSContext *jcx; /* javascript context */
@@ -18,4 +19,4 @@ JSString * our_JS_NewStringCopyZ(JSContext * cx, const char *s) ;
char * our_JSEncodeString(JSString *str) ;
const char * stringize(jsval v) ;
void initLocationClass(void) ;
-
+#endif
--
1.8.5.2.297.g3e57c29
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-12-24 15:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-24 15:38 [Edbrowse-dev] [PATCH 1/4] Add check to eb.h so functions work in c++ Adam Thompson
2013-12-24 15:38 ` [Edbrowse-dev] [PATCH 2/4] Alter bool typedef to eb_bool in eb.h Adam Thompson
2013-12-24 15:38 ` [Edbrowse-dev] [PATCH 3/4] Alter c files to use new eb_bool typedef Adam Thompson
2013-12-24 15:38 ` [Edbrowse-dev] [PATCH 4/4] Add ifdef guard to js.h Adam Thompson
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).