aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2001-11-24 02:01:26 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2001-11-24 02:01:26 +0000
commit975c8f9d43d4026bf1d669b08646e9d29a9d02e4 (patch)
treefd8aed139ffef712ccbb2d392c13b3949b0192c5
parent[w3m-dev 02530] segfault for bad cookie from local (diff)
downloadw3m-975c8f9d43d4026bf1d669b08646e9d29a9d02e4.tar.gz
w3m-975c8f9d43d4026bf1d669b08646e9d29a9d02e4.zip
run make indent
-rw-r--r--ChangeLog5
-rw-r--r--Makefile25
-rw-r--r--Str.c16
-rw-r--r--Str.h8
-rw-r--r--anchor.c169
-rw-r--r--backend.c508
-rw-r--r--buffer.c110
-rw-r--r--conv.c111
-rw-r--r--cookie.c81
-rw-r--r--display.c175
-rw-r--r--entity.c78
-rw-r--r--entity.h718
-rw-r--r--etc.c166
-rw-r--r--file.c1044
-rw-r--r--fm.h27
-rw-r--r--form.c279
-rw-r--r--form.h12
-rw-r--r--frame.c141
-rw-r--r--ftp.c76
-rw-r--r--func.c76
-rw-r--r--hash.c4
-rw-r--r--hash.h3
-rw-r--r--history.c38
-rw-r--r--history.h8
-rw-r--r--html.c486
-rw-r--r--html.h16
-rw-r--r--indep.c98
-rw-r--r--inflate.c15
-rw-r--r--islang.c47
-rw-r--r--istream.c50
-rw-r--r--istream.h74
-rw-r--r--keybind.c262
-rw-r--r--keybind_lynx.c146
-rw-r--r--linein.c191
-rw-r--r--local.c211
-rw-r--r--mailcap.c197
-rw-r--r--main.c1121
-rw-r--r--map.c25
-rw-r--r--menu.c234
-rw-r--r--mimehead.c14
-rw-r--r--mktable.c20
-rw-r--r--myctype.c87
-rw-r--r--parsetagx.c24
-rw-r--r--parsetagx.h12
-rw-r--r--proto.h304
-rw-r--r--rc.c421
-rw-r--r--regex.c31
-rw-r--r--regex.h8
-rw-r--r--scrsize.c70
-rw-r--r--search.c10
-rw-r--r--table.c402
-rw-r--r--table.h4
-rw-r--r--terms.c261
-rw-r--r--textlist.c18
-rw-r--r--textlist.h12
-rw-r--r--ucs_eucjp.h237
-rw-r--r--ucs_latin1.h71
-rw-r--r--url.c485
-rw-r--r--w3mbookmark.c65
-rw-r--r--w3mhelperpanel.c73
60 files changed, 4981 insertions, 4699 deletions
diff --git a/ChangeLog b/ChangeLog
index 0926c17..0eacde1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2001-11-24 Fumitoshi UKAI <ukai@debian.or.jp>
+ * Makefile (indent): indent
+ * run make indent
+
+2001-11-24 Fumitoshi UKAI <ukai@debian.or.jp>
+
* [w3m-dev 02530]
* file.c (readHeader): NULL check for domain
diff --git a/Makefile b/Makefile
index e2a476f..c190ec0 100644
--- a/Makefile
+++ b/Makefile
@@ -39,7 +39,30 @@ bindist: XXMakefile
$(MAKE) -f XXMakefile bindist
indent:
- indent -orig -nce -ncdb -i4 -di1 -nbc *.c *.h
+# indent -orig -nce -ncdb -i4 -di1 -nbc *.c *.h
+ indent -orig -nce -ncdb -i4 -di1 -nbc -l79 -ncs -npcs -nfca -ss \
+ -TAnchor -TAnchorList -TBuffer -TBufferPoint -TBreakpoint \
+ -TDirectory \
+ -TFuncList -TKeyListItem -TKeyList \
+ -TFormList -TFormItemList \
+ -TFormSelectOption -TFormSelectOptionItem \
+ -THist -THistItem -THistList \
+ -THmarkerList -THRequest \
+ -TLine -TLineprop -TLinecolor \
+ -TListItem -TGeneralList -TTextListItem -TTextList \
+ -TMapList -TMatrix \
+ -TMenu -TMenuItem -TMenuList \
+ -TParsedURL \
+ -TRegex \
+ -TStr -TStreamBuffer \
+ -TBaseStream -TFileStream -TStrStream -TSSLStream \
+ -TEncodedStrStream -TInputStream \
+ -TTagAttrInfo \
+ -Ttable_attr \
+ -TTextLine -TTextLineList -TTextLineListItem \
+ -TURLOption -TURLFile \
+ -TVector \
+ *.c *.h
XXMakefile: XMakefile config.h
awk '/^#ifdef makefile_parameter/,/^#else/' config.h | cat - XMakefile > XXMakefile
diff --git a/Str.c b/Str.c
index b0f4565..501e7db 100644
--- a/Str.c
+++ b/Str.c
@@ -1,4 +1,4 @@
-/* $Id: Str.c,v 1.4 2001/11/16 22:02:00 ukai Exp $ */
+/* $Id: Str.c,v 1.5 2001/11/24 02:01:26 ukai Exp $ */
/*
* String manipulation library for Boehm GC
*
@@ -17,7 +17,7 @@
#include <gc.h>
#include <stdarg.h>
#include <string.h>
-#ifdef __EMX__ /* or include "fm.h" for HAVE_BCOPY? */
+#ifdef __EMX__ /* or include "fm.h" for HAVE_BCOPY? */
#include <strings.h>
#endif
#include "Str.h"
@@ -67,12 +67,12 @@ Strnew_charp(char *p)
x->ptr = GC_MALLOC_ATOMIC(n);
x->area_size = n;
x->length = n - 1;
- bcopy((void *)p, (void*)x->ptr, n);
+ bcopy((void *)p, (void *)x->ptr, n);
return x;
}
Str
-Strnew_m_charp(char *p,...)
+Strnew_m_charp(char *p, ...)
{
va_list ap;
Str r = Strnew();
@@ -216,7 +216,7 @@ Strcat_charp(Str x, char *y)
}
void
-Strcat_m_charp(Str x,...)
+Strcat_m_charp(Str x, ...)
{
va_list ap;
char *p;
@@ -351,7 +351,7 @@ Strremovefirstspaces(Str s)
int i;
STR_LENGTH_CHECK(s);
- for (i = 0; i < s->length && IS_SPACE(s->ptr[i]); i++);
+ for (i = 0; i < s->length && IS_SPACE(s->ptr[i]); i++) ;
if (i == 0)
return;
Strdelete(s, 0, i);
@@ -363,7 +363,7 @@ Strremovetrailingspaces(Str s)
int i;
STR_LENGTH_CHECK(s);
- for (i = s->length - 1; i >= 0 && IS_SPACE(s->ptr[i]); i--);
+ for (i = s->length - 1; i >= 0 && IS_SPACE(s->ptr[i]); i--) ;
s->length = i + 1;
s->ptr[i + 1] = '\0';
}
@@ -424,7 +424,7 @@ Stralign_center(Str s, int width)
#define SP_PREC2 2
Str
-Sprintf(char *fmt,...)
+Sprintf(char *fmt, ...)
{
int len = 0;
int status = SP_NORMAL;
diff --git a/Str.h b/Str.h
index 288000d..74c00c4 100644
--- a/Str.h
+++ b/Str.h
@@ -1,4 +1,4 @@
-/* $Id: Str.h,v 1.3 2001/11/15 00:32:13 a-ito Exp $ */
+/* $Id: Str.h,v 1.4 2001/11/24 02:01:26 ukai Exp $ */
/*
* String manipulation library for Boehm GC
*
@@ -32,7 +32,7 @@ Str Strnew();
Str Strnew_size(int);
Str Strnew_charp(char *);
Str Strnew_charp_n(char *, int);
-Str Strnew_m_charp(char *,...);
+Str Strnew_m_charp(char *, ...);
Str Strdup(Str);
void Strclear(Str);
void Strfree(Str);
@@ -42,7 +42,7 @@ void Strcopy_charp_n(Str, char *, int);
void Strcat_charp_n(Str, char *, int);
void Strcat(Str, Str);
void Strcat_charp(Str, char *);
-void Strcat_m_charp(Str,...);
+void Strcat_m_charp(Str, ...);
Str Strsubstr(Str, int, int);
void Strinsert_char(Str, int, char);
void Strinsert_charp(Str, int, char *);
@@ -59,7 +59,7 @@ Str Stralign_left(Str, int);
Str Stralign_right(Str, int);
Str Stralign_center(Str, int);
-Str Sprintf(char *fmt,...);
+Str Sprintf(char *fmt, ...);
Str Strfgets(FILE *);
Str Strfgetall(FILE *);
diff --git a/anchor.c b/anchor.c
index a56690f..02e7ef1 100644
--- a/anchor.c
+++ b/anchor.c
@@ -1,4 +1,4 @@
-/* $Id: anchor.c,v 1.5 2001/11/22 14:07:38 ukai Exp $ */
+/* $Id: anchor.c,v 1.6 2001/11/24 02:01:26 ukai Exp $ */
#include "fm.h"
#include "myctype.h"
#include "regex.h"
@@ -6,7 +6,8 @@
#define FIRST_ANCHOR_SIZE 30
AnchorList *
-putAnchor(AnchorList * al, char *url, char *target, Anchor ** anchor_return, char *referer, int line, int pos)
+putAnchor(AnchorList *al, char *url, char *target, Anchor **anchor_return,
+ char *referer, int line, int pos)
{
int n, i, j;
Anchor *a;
@@ -22,24 +23,23 @@ putAnchor(AnchorList * al, char *url, char *target, Anchor ** anchor_return, cha
al->anchors = New_N(Anchor, FIRST_ANCHOR_SIZE);
al->anchormax = FIRST_ANCHOR_SIZE;
}
- if (al->nanchor == al->anchormax) { /* need realloc */
+ if (al->nanchor == al->anchormax) { /* need realloc */
al->anchormax *= 2;
- al->anchors = New_Reuse(Anchor, al->anchors,
- al->anchormax);
+ al->anchors = New_Reuse(Anchor, al->anchors, al->anchormax);
}
bp.line = line;
bp.pos = pos;
n = al->nanchor;
- if (!n || bpcmp(al->anchors[n-1].start, bp) < 0)
+ if (!n || bpcmp(al->anchors[n - 1].start, bp) < 0)
i = n;
else
- for (i = 0; i < n; i++) {
- if (bpcmp(al->anchors[i].start, bp) >= 0) {
- for (j = n; j > i; j--)
- al->anchors[j] = al->anchors[j - 1];
- break;
+ for (i = 0; i < n; i++) {
+ if (bpcmp(al->anchors[i].start, bp) >= 0) {
+ for (j = n; j > i; j--)
+ al->anchors[j] = al->anchors[j - 1];
+ break;
+ }
}
- }
a = &al->anchors[i];
a->url = url;
a->target = target;
@@ -54,7 +54,8 @@ putAnchor(AnchorList * al, char *url, char *target, Anchor ** anchor_return, cha
Anchor *
-registerHref(Buffer * buf, char *url, char *target, char *referer, int line, int pos)
+registerHref(Buffer *buf, char *url, char *target, char *referer, int line,
+ int pos)
{
Anchor *a;
buf->href = putAnchor(buf->href, url, target, &a, referer, line, pos);
@@ -62,7 +63,7 @@ registerHref(Buffer * buf, char *url, char *target, char *referer, int line, int
}
Anchor *
-registerName(Buffer * buf, char *url, int line, int pos)
+registerName(Buffer *buf, char *url, int line, int pos)
{
Anchor *a;
buf->name = putAnchor(buf->name, url, NULL, &a, NULL, line, pos);
@@ -70,7 +71,7 @@ registerName(Buffer * buf, char *url, int line, int pos)
}
Anchor *
-registerImg(Buffer * buf, char *url, int line, int pos)
+registerImg(Buffer *buf, char *url, int line, int pos)
{
Anchor *a;
buf->img = putAnchor(buf->img, url, NULL, &a, NULL, line, pos);
@@ -78,7 +79,8 @@ registerImg(Buffer * buf, char *url, int line, int pos)
}
Anchor *
-registerForm(Buffer * buf, FormList * flist, struct parsed_tag * tag, int line, int pos)
+registerForm(Buffer *buf, FormList *flist, struct parsed_tag *tag, int line,
+ int pos)
{
Anchor *a;
FormItemList *fi;
@@ -87,16 +89,12 @@ registerForm(Buffer * buf, FormList * flist, struct parsed_tag * tag, int line,
if (fi == NULL)
return NULL;
buf->formitem = putAnchor(buf->formitem,
- (char *) fi,
- flist->target,
- &a,
- NULL,
- line, pos);
+ (char *)fi, flist->target, &a, NULL, line, pos);
return a;
}
int
-onAnchor(Anchor * a, int line, int pos)
+onAnchor(Anchor *a, int line, int pos)
{
BufferPoint bp;
bp.line = line;
@@ -110,7 +108,7 @@ onAnchor(Anchor * a, int line, int pos)
}
Anchor *
-retrieveAnchor(AnchorList * al, int line, int pos)
+retrieveAnchor(AnchorList *al, int line, int pos)
{
Anchor *a;
size_t b, e;
@@ -138,37 +136,32 @@ retrieveAnchor(AnchorList * al, int line, int pos)
}
Anchor *
-retrieveCurrentAnchor(Buffer * buf)
+retrieveCurrentAnchor(Buffer *buf)
{
if (buf->currentLine == NULL)
return NULL;
- return retrieveAnchor(buf->href,
- buf->currentLine->linenumber,
- buf->pos);
+ return retrieveAnchor(buf->href, buf->currentLine->linenumber, buf->pos);
}
Anchor *
-retrieveCurrentImg(Buffer * buf)
+retrieveCurrentImg(Buffer *buf)
{
if (buf->currentLine == NULL)
return NULL;
- return retrieveAnchor(buf->img,
- buf->currentLine->linenumber,
- buf->pos);
+ return retrieveAnchor(buf->img, buf->currentLine->linenumber, buf->pos);
}
Anchor *
-retrieveCurrentForm(Buffer * buf)
+retrieveCurrentForm(Buffer *buf)
{
if (buf->currentLine == NULL)
return NULL;
return retrieveAnchor(buf->formitem,
- buf->currentLine->linenumber,
- buf->pos);
+ buf->currentLine->linenumber, buf->pos);
}
Anchor *
-searchAnchor(AnchorList * al, char *str)
+searchAnchor(AnchorList *al, char *str)
{
int i;
Anchor *a;
@@ -183,14 +176,14 @@ searchAnchor(AnchorList * al, char *str)
}
Anchor *
-searchURLLabel(Buffer * buf, char *url)
+searchURLLabel(Buffer *buf, char *url)
{
return searchAnchor(buf->name, url);
}
#ifdef USE_NNTP
static Anchor *
-_put_anchor_news(Buffer * buf, char *p1, char *p2, int line, int pos)
+_put_anchor_news(Buffer *buf, char *p1, char *p2, int line, int pos)
{
Str tmp = Strnew_charp("news:");
@@ -205,13 +198,14 @@ _put_anchor_news(Buffer * buf, char *p1, char *p2, int line, int pos)
#endif /* USE_NNTP */
static Anchor *
-_put_anchor_all(Buffer * buf, char *p1, char *p2, int line, int pos)
+_put_anchor_all(Buffer *buf, char *p1, char *p2, int line, int pos)
{
- return registerHref(buf, allocStr(p1, p2 - p1), NULL, NO_REFERER, line, pos);
+ return registerHref(buf, allocStr(p1, p2 - p1), NULL, NO_REFERER, line,
+ pos);
}
static void
-reseq_anchor0(AnchorList * al, short *seqmap)
+reseq_anchor0(AnchorList *al, short *seqmap)
{
int i;
Anchor *a;
@@ -229,7 +223,7 @@ reseq_anchor0(AnchorList * al, short *seqmap)
/* renumber anchor */
static void
-reseq_anchor(Buffer * buf)
+reseq_anchor(Buffer *buf)
{
int i, j, n, nmark = (buf->hmarklist) ? buf->hmarklist->nmark : 0;
short *seqmap;
@@ -259,8 +253,10 @@ reseq_anchor(Buffer * buf)
a = &buf->href->anchors[i];
if (a->hseq == -2) {
a->hseq = n;
- a1 = closest_next_anchor(buf->href, NULL, a->start.pos, a->start.line);
- a1 = closest_next_anchor(buf->formitem, a1, a->start.pos, a->start.line);
+ a1 = closest_next_anchor(buf->href, NULL, a->start.pos,
+ a->start.line);
+ a1 = closest_next_anchor(buf->formitem, a1, a->start.pos,
+ a->start.line);
if (a1 && a1->hseq >= 0) {
seqmap[n] = seqmap[a1->hseq];
for (j = a1->hseq; j < nmark; j++)
@@ -284,7 +280,8 @@ reseq_anchor(Buffer * buf)
/* search regexp and register them as anchors */
/* returns error message if any */
static char *
-reAnchorAny(Buffer * buf, char *re, Anchor * (*anchorproc) (Buffer *, char *, char *, int, int))
+reAnchorAny(Buffer *buf, char *re,
+ Anchor *(*anchorproc) (Buffer *, char *, char *, int, int))
{
Line *l;
char *p, *p1, *p2;
@@ -327,14 +324,14 @@ reAnchorAny(Buffer * buf, char *re, Anchor * (*anchorproc) (Buffer *, char *, ch
}
char *
-reAnchor(Buffer * buf, char *re)
+reAnchor(Buffer *buf, char *re)
{
return reAnchorAny(buf, re, _put_anchor_all);
}
#ifdef USE_NNTP
char *
-reAnchorNews(Buffer * buf, char *re)
+reAnchorNews(Buffer *buf, char *re)
{
return reAnchorAny(buf, re, _put_anchor_news);
}
@@ -342,7 +339,7 @@ reAnchorNews(Buffer * buf, char *re)
#define FIRST_MARKER_SIZE 30
HmarkerList *
-putHmarker(HmarkerList * ml, int line, int pos, int seq)
+putHmarker(HmarkerList *ml, int line, int pos, int seq)
{
if (ml == NULL) {
ml = New(HmarkerList);
@@ -360,8 +357,7 @@ putHmarker(HmarkerList * ml, int line, int pos, int seq)
ml->nmark = seq + 1;
if (ml->nmark >= ml->markmax) {
ml->markmax = ml->nmark * 2;
- ml->marks = New_Reuse(BufferPoint, ml->marks,
- ml->markmax);
+ ml->marks = New_Reuse(BufferPoint, ml->marks, ml->markmax);
}
ml->marks[seq].line = line;
ml->marks[seq].pos = pos;
@@ -369,7 +365,7 @@ putHmarker(HmarkerList * ml, int line, int pos, int seq)
}
Anchor *
-closest_next_anchor(AnchorList * a, Anchor * an, int x, int y)
+closest_next_anchor(AnchorList *a, Anchor *an, int x, int y)
{
int i;
@@ -379,7 +375,7 @@ closest_next_anchor(AnchorList * a, Anchor * an, int x, int y)
if (a->anchors[i].hseq < 0)
continue;
if (a->anchors[i].start.line > y ||
- (a->anchors[i].start.line == y && a->anchors[i].start.pos > x)) {
+ (a->anchors[i].start.line == y && a->anchors[i].start.pos > x)) {
if (an == NULL || an->start.line > a->anchors[i].start.line ||
(an->start.line == a->anchors[i].start.line &&
an->start.pos > a->anchors[i].start.pos))
@@ -390,7 +386,7 @@ closest_next_anchor(AnchorList * a, Anchor * an, int x, int y)
}
Anchor *
-closest_prev_anchor(AnchorList * a, Anchor * an, int x, int y)
+closest_prev_anchor(AnchorList *a, Anchor *an, int x, int y)
{
int i;
@@ -419,49 +415,50 @@ addMultirowsForm(Buffer *buf, AnchorList *al)
Line *l, *ls;
if (al == NULL || al->nanchor == 0)
- return;
+ return;
for (i = 0; i < al->nanchor; i++) {
- a_form = al->anchors[i];
- al->anchors[i].rows = 1;
- if (a_form.hseq < 0 || a_form.rows <= 1)
- continue;
- for (l = buf->firstLine; l != NULL; l = l->next) {
- if (l->linenumber == a_form.y)
- break;
- }
- if (! l)
- continue;
+ a_form = al->anchors[i];
+ al->anchors[i].rows = 1;
+ if (a_form.hseq < 0 || a_form.rows <= 1)
+ continue;
+ for (l = buf->firstLine; l != NULL; l = l->next) {
+ if (l->linenumber == a_form.y)
+ break;
+ }
+ if (!l)
+ continue;
if (a_form.y == a_form.start.line)
ls = l;
else {
for (ls = l; ls != NULL;
- ls = (a_form.y < a_form.start.line) ? ls->next : ls->prev) {
+ ls = (a_form.y < a_form.start.line) ? ls->next : ls->prev) {
if (ls->linenumber == a_form.start.line)
break;
}
- if (! ls)
+ if (!ls)
+ continue;
+ }
+ fi = (FormItemList *)a_form.url;
+ col = COLPOS(ls, a_form.start.pos);
+ ecol = COLPOS(ls, a_form.end.pos);
+ for (j = 0; l && j < a_form.rows; l = l->next, j++) {
+ pos = columnPos(l, col);
+ if (j == 0) {
+ buf->hmarklist->marks[a_form.hseq].line = l->linenumber;
+ buf->hmarklist->marks[a_form.hseq].pos = pos;
+ }
+ if (a_form.start.line == l->linenumber)
continue;
+ buf->formitem = putAnchor(buf->formitem, a_form.url,
+ a_form.target, &a, NULL, l->linenumber,
+ pos);
+ a->hseq = a_form.hseq;
+ a->y = a_form.y;
+ a->end.pos = pos + ecol - col;
+ l->lineBuf[pos - 1] = '[';
+ l->lineBuf[a->end.pos] = ']';
+ for (k = pos; k < a->end.pos; k++)
+ l->propBuf[k] |= PE_FORM;
}
- fi = (FormItemList *) a_form.url;
- col = COLPOS(ls, a_form.start.pos);
- ecol = COLPOS(ls, a_form.end.pos);
- for (j = 0; l && j < a_form.rows; l = l->next, j++) {
- pos = columnPos(l, col);
- if (j == 0) {
- buf->hmarklist->marks[a_form.hseq].line = l->linenumber;
- buf->hmarklist->marks[a_form.hseq].pos = pos;
- }
- if (a_form.start.line == l->linenumber)
- continue;
- buf->formitem = putAnchor(buf->formitem, a_form.url,
- a_form.target, &a, NULL, l->linenumber, pos);
- a->hseq = a_form.hseq;
- a->y = a_form.y;
- a->end.pos = pos + ecol - col;
- l->lineBuf[pos - 1] = '[';
- l->lineBuf[a->end.pos] = ']';
- for (k = pos; k < a->end.pos; k++)
- l->propBuf[k] |= PE_FORM;
- }
}
}
diff --git a/backend.c b/backend.c
index e80cebb..248185b 100644
--- a/backend.c
+++ b/backend.c
@@ -1,4 +1,4 @@
-/* $Id: backend.c,v 1.4 2001/11/21 19:24:35 ukai Exp $ */
+/* $Id: backend.c,v 1.5 2001/11/24 02:01:26 ukai Exp $ */
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
@@ -11,150 +11,166 @@
/* Prototype declaration of internal functions */
#ifdef HAVE_READLINE
#include <readline/readline.h>
-#else /* ! HAVE_READLINE */
-static char *readline( char* );
-#endif /* ! HAVE_READLINE */
-static TextList* split( char * );
+#else /* ! HAVE_READLINE */
+static char *readline(char *);
+#endif /* ! HAVE_READLINE */
+static TextList *split(char *);
/* Prototype declaration of command functions */
-static void get( TextList* );
-static void post( TextList* );
-static void set( TextList* );
-static void show( TextList* );
-static void quit( TextList* );
-static void help( TextList* );
+static void get(TextList *);
+static void post(TextList *);
+static void set(TextList *);
+static void show(TextList *);
+static void quit(TextList *);
+static void help(TextList *);
+/* *INDENT-OFF* */
/* Table of command functions */
struct {
const char *name;
const char *option_string;
const char *help;
- void (*func)( TextList* );
+ void (*func)(TextList*);
} command_table[] = {
- { "get", "[-download_only] URL", "Retrieve URL.", get },
- { "post", "[-download_only] [-target TARGET] [-charset CHARSET]"
- " [-enctype ENCTYPE] [-body BODY] [-boundary BOUNDARY] [-length LEN] URL",
- "Retrieve URL.", post },
- { "set", "VARIABLE VALUE", "Set VALUE to VARIABLE.", set },
- { "show", "VARIABLE", "Show value of VARIABLE.", show },
- { "quit", "", "Quit program.", quit },
- { "help", "", "Display help messages.", help },
- { NULL, NULL, NULL, NULL },
+ {"get", "[-download_only] URL", "Retrieve URL.", get},
+ {"post", "[-download_only] [-target TARGET] [-charset CHARSET]"
+ " [-enctype ENCTYPE] [-body BODY] [-boundary BOUNDARY] [-length LEN] URL",
+ "Retrieve URL.", post},
+ {"set", "VARIABLE VALUE", "Set VALUE to VARIABLE.", set},
+ {"show", "VARIABLE", "Show value of VARIABLE.", show},
+ {"quit", "", "Quit program.", quit},
+ {"help", "", "Display help messages.", help},
+ {NULL, NULL, NULL, NULL},
};
-
+/* *INDENT-ON* */
/* Prototype declaration of functions to manipulate configuration variables */
-static void set_column( TextList* );
-static void show_column( TextList* );
+static void set_column(TextList *);
+static void show_column(TextList *);
+/* *INDENT-OFF* */
/* Table of configuration variables */
struct {
const char *name;
- void (*set_func)( TextList* );
- void (*show_func)( TextList* );
+ void (*set_func)(TextList*);
+ void (*show_func)(TextList*);
} variable_table[] = {
- { "column", set_column, show_column },
- { NULL, NULL, NULL },
+ {"column", set_column, show_column},
+ {NULL, NULL, NULL},
};
+/* *INDENT-ON* */
-
-static char* get_mime_charset_name( int coding ){
+static char *
+get_mime_charset_name(int coding)
+{
Str r;
- switch( coding ){
- case CODE_EUC:
- r = Strnew_charp( "euc-japan" );
- break;
- case CODE_SJIS:
- r = Strnew_charp( "shift_jis" );
- break;
- case CODE_JIS_m:
- case CODE_JIS_n:
- case CODE_JIS_N:
- case CODE_JIS_j:
- case CODE_JIS_J:
- r = Strnew_charp( "iso-2022-jp" );
- break;
- default:
- return NULL;
+ switch (coding) {
+ case CODE_EUC:
+ r = Strnew_charp("euc-japan");
+ break;
+ case CODE_SJIS:
+ r = Strnew_charp("shift_jis");
+ break;
+ case CODE_JIS_m:
+ case CODE_JIS_n:
+ case CODE_JIS_N:
+ case CODE_JIS_j:
+ case CODE_JIS_J:
+ r = Strnew_charp("iso-2022-jp");
+ break;
+ default:
+ return NULL;
}
return r->ptr;
}
-static void print_headers( Buffer *buf, int len ){
+static void
+print_headers(Buffer *buf, int len)
+{
TextListItem *tp;
- if( buf->document_header ){
- for( tp = buf->document_header->first; tp; tp = tp->next )
- printf( "%s\n", tp->ptr );
+ if (buf->document_header) {
+ for (tp = buf->document_header->first; tp; tp = tp->next)
+ printf("%s\n", tp->ptr);
}
- printf( "w3m-content-type: %s\n", buf->type );
+ printf("w3m-content-type: %s\n", buf->type);
#ifdef JP_CHARSET
- if( buf->document_code )
- printf( "w3m-content-charset: %s\n",
- get_mime_charset_name( buf->document_code ) );
+ if (buf->document_code)
+ printf("w3m-content-charset: %s\n",
+ get_mime_charset_name(buf->document_code));
#endif
- if( len > 0 )
- printf( "w3m-content-length: %d\n", len );
+ if (len > 0)
+ printf("w3m-content-length: %d\n", len);
}
-static void print_formlist( int fid, FormList *fp ){
- Str s = Sprintf( "w3m-form: (formlist (fid %d) (action \"%s\") (method \"%s\")",
- fid,
- fp->action->ptr,
- ( fp->method == FORM_METHOD_POST )? "post"
- :( ( fp->method == FORM_METHOD_INTERNAL )? "internal" : "get" ) );
- if( fp->target )
- Strcat( s, Sprintf( " (target \"%s\")", fp->target ) );
- if( fp->charset )
- Strcat( s, Sprintf( " (charset '%s)", get_mime_charset_name(fp->charset) ) );
- if( fp->enctype == FORM_ENCTYPE_MULTIPART )
- Strcat_charp( s, " (enctype \"multipart/form-data\")" );
- if( fp->boundary )
- Strcat( s, Sprintf( " (boundary \"%s\")", fp->boundary ) );
- Strcat_charp( s, ")\n" );
- Strfputs( s, stdout );
+static void
+print_formlist(int fid, FormList *fp)
+{
+ Str s =
+ Sprintf("w3m-form: (formlist (fid %d) (action \"%s\") (method \"%s\")",
+ fid,
+ fp->action->ptr,
+ (fp->method == FORM_METHOD_POST) ? "post"
+ : ((fp->method == FORM_METHOD_INTERNAL) ? "internal" : "get"));
+ if (fp->target)
+ Strcat(s, Sprintf(" (target \"%s\")", fp->target));
+ if (fp->charset)
+ Strcat(s,
+ Sprintf(" (charset '%s)", get_mime_charset_name(fp->charset)));
+ if (fp->enctype == FORM_ENCTYPE_MULTIPART)
+ Strcat_charp(s, " (enctype \"multipart/form-data\")");
+ if (fp->boundary)
+ Strcat(s, Sprintf(" (boundary \"%s\")", fp->boundary));
+ Strcat_charp(s, ")\n");
+ Strfputs(s, stdout);
}
-static void internal_get( char *url, int flag, FormList *request ){
+static void
+internal_get(char *url, int flag, FormList *request)
+{
Buffer *buf;
- backend_halfdump_str = Strnew_charp( "<pre>\n" );
+ backend_halfdump_str = Strnew_charp("<pre>\n");
do_download = flag;
- buf = loadGeneralFile( url, NULL, NO_REFERER, 0, request );
+ buf = loadGeneralFile(url, NULL, NO_REFERER, 0, request);
do_download = FALSE;
- if( buf != NULL && buf != NO_BUFFER ){
- if( !strcasecmp( buf->type, "text/html" ) ){
- Strcat( backend_halfdump_str,
- Sprintf( "</pre><title>%s</title>\n", buf->buffername ) );
- print_headers( buf, backend_halfdump_str->length );
- if( buf->formlist ){
+ if (buf != NULL && buf != NO_BUFFER) {
+ if (!strcasecmp(buf->type, "text/html")) {
+ Strcat(backend_halfdump_str,
+ Sprintf("</pre><title>%s</title>\n", buf->buffername));
+ print_headers(buf, backend_halfdump_str->length);
+ if (buf->formlist) {
FormList *fp;
int fid = 0;
- for( fp = buf->formlist; fp; fp = fp->next ) fid++;
- for( fp = buf->formlist; fp; fp = fp->next )
- print_formlist( --fid, fp );
+ for (fp = buf->formlist; fp; fp = fp->next)
+ fid++;
+ for (fp = buf->formlist; fp; fp = fp->next)
+ print_formlist(--fid, fp);
}
- printf( "\n" );
- Strfputs( backend_halfdump_str, stdout );
- } else {
- if( !strcasecmp( buf->type, "text/plain" ) ){
+ printf("\n");
+ Strfputs(backend_halfdump_str, stdout);
+ }
+ else {
+ if (!strcasecmp(buf->type, "text/plain")) {
Line *lp;
int len = 0;
- for( lp = buf->firstLine; lp; lp = lp->next ){
+ for (lp = buf->firstLine; lp; lp = lp->next) {
len += lp->len;
- if( lp->lineBuf[lp->len-1] != '\n' ) len++;
+ if (lp->lineBuf[lp->len - 1] != '\n')
+ len++;
}
- print_headers( buf, len );
- printf( "\n" );
- saveBuffer( buf, stdout );
- } else {
- print_headers( buf, 0 );
+ print_headers(buf, len);
+ printf("\n");
+ saveBuffer(buf, stdout);
+ }
+ else {
+ print_headers(buf, 0);
}
}
}
@@ -162,66 +178,73 @@ static void internal_get( char *url, int flag, FormList *request ){
/* Command: get */
-static void get( TextList *argv ){
+static void
+get(TextList *argv)
+{
char *p, *url = NULL;
int flag = FALSE;
- while(( p = popText( argv ) )){
- if( !strcasecmp( p, "-download_only" ) )
+ while ((p = popText(argv))) {
+ if (!strcasecmp(p, "-download_only"))
flag = TRUE;
else
url = p;
}
- if( url ){
- internal_get( url, flag, NULL );
+ if (url) {
+ internal_get(url, flag, NULL);
}
}
/* Command: post */
-static void post( TextList *argv ){
+static void
+post(TextList *argv)
+{
FormList *request;
char *p, *target = NULL, *charset = NULL,
*enctype = NULL, *body = NULL, *boundary = NULL, *url = NULL;
int flag = FALSE, length = 0;
- while(( p = popText( argv ) )){
- if( !strcasecmp( p, "-download_only" ) )
+ while ((p = popText(argv))) {
+ if (!strcasecmp(p, "-download_only"))
flag = TRUE;
- else if( !strcasecmp( p, "-target" ) )
- target = popText( argv );
- else if( !strcasecmp( p, "-charset" ) )
- charset = popText( argv );
- else if( !strcasecmp( p, "-enctype" ) )
- enctype = popText( argv );
- else if( !strcasecmp( p, "-body" ) )
- body = popText( argv );
- else if( !strcasecmp( p, "-boundary" ) )
- boundary = popText( argv );
- else if( !strcasecmp( p, "-length" ) )
- length = atol( popText( argv ) );
+ else if (!strcasecmp(p, "-target"))
+ target = popText(argv);
+ else if (!strcasecmp(p, "-charset"))
+ charset = popText(argv);
+ else if (!strcasecmp(p, "-enctype"))
+ enctype = popText(argv);
+ else if (!strcasecmp(p, "-body"))
+ body = popText(argv);
+ else if (!strcasecmp(p, "-boundary"))
+ boundary = popText(argv);
+ else if (!strcasecmp(p, "-length"))
+ length = atol(popText(argv));
else
url = p;
}
- if( url ){
- request = newFormList( NULL, "post", charset, enctype, target, NULL, NULL );
+ if (url) {
+ request =
+ newFormList(NULL, "post", charset, enctype, target, NULL, NULL);
request->body = body;
request->boundary = boundary;
- request->length = ( length > 0 )? length : ( body ? strlen(body) : 0 );
- internal_get( url, flag, request );
+ request->length = (length > 0) ? length : (body ? strlen(body) : 0);
+ internal_get(url, flag, request);
}
}
/* Command: set */
-static void set( TextList *argv ){
- if( argv->nitem > 1 ){
+static void
+set(TextList *argv)
+{
+ if (argv->nitem > 1) {
int i;
- for( i = 0; variable_table[i].name; i++ ){
- if( !strcasecmp( variable_table[i].name, argv->first->ptr ) ){
- popText( argv );
- if( variable_table[i].set_func )
- variable_table[i].set_func( argv );
+ for (i = 0; variable_table[i].name; i++) {
+ if (!strcasecmp(variable_table[i].name, argv->first->ptr)) {
+ popText(argv);
+ if (variable_table[i].set_func)
+ variable_table[i].set_func(argv);
break;
}
}
@@ -230,14 +253,16 @@ static void set( TextList *argv ){
/* Command: show */
-static void show( TextList *argv ){
- if( argv->nitem >= 1 ){
+static void
+show(TextList *argv)
+{
+ if (argv->nitem >= 1) {
int i;
- for( i = 0; variable_table[i].name; i++ ){
- if( !strcasecmp( variable_table[i].name, argv->first->ptr ) ){
- popText( argv );
- if( variable_table[i].show_func )
- variable_table[i].show_func( argv );
+ for (i = 0; variable_table[i].name; i++) {
+ if (!strcasecmp(variable_table[i].name, argv->first->ptr)) {
+ popText(argv);
+ if (variable_table[i].show_func)
+ variable_table[i].show_func(argv);
break;
}
}
@@ -246,48 +271,57 @@ static void show( TextList *argv ){
/* Command: quit */
-static void quit( TextList *argv ){
+static void
+quit(TextList *argv)
+{
#ifdef USE_COOKIE
save_cookies();
-#endif /* USE_COOKIE */
+#endif /* USE_COOKIE */
w3m_exit(0);
}
/* Command: help */
-static void help( TextList *argv ){
+static void
+help(TextList *argv)
+{
int i;
- for( i = 0; command_table[i].name; i++ )
- printf( "%s %s\n %s\n",
- command_table[i].name,
- command_table[i].option_string,
- command_table[i].help );
+ for (i = 0; command_table[i].name; i++)
+ printf("%s %s\n %s\n",
+ command_table[i].name,
+ command_table[i].option_string, command_table[i].help);
}
/* Sub command: set COLS */
-static void set_column( TextList *argv ){
- if( argv->nitem == 1 ){
- COLS = atol( argv->first->ptr );
+static void
+set_column(TextList *argv)
+{
+ if (argv->nitem == 1) {
+ COLS = atol(argv->first->ptr);
}
}
/* Sub command: show COLS */
-static void show_column( TextList *argv ){
- fprintf( stdout, "column=%d\n", COLS );
+static void
+show_column(TextList *argv)
+{
+ fprintf(stdout, "column=%d\n", COLS);
}
/* Call appropriate command function based on given string */
-static void call_command_function( char *str ){
+static void
+call_command_function(char *str)
+{
int i;
- TextList *argv = split( str );
- if( argv->nitem > 0 ){
- for( i = 0; command_table[i].name; i++ ){
- if( !strcasecmp( command_table[i].name, argv->first->ptr ) ){
- popText( argv );
- if( command_table[i].func )
- command_table[i].func( argv );
+ TextList *argv = split(str);
+ if (argv->nitem > 0) {
+ for (i = 0; command_table[i].name; i++) {
+ if (!strcasecmp(command_table[i].name, argv->first->ptr)) {
+ popText(argv);
+ if (command_table[i].func)
+ command_table[i].func(argv);
break;
}
}
@@ -296,107 +330,117 @@ static void call_command_function( char *str ){
/* Main function */
-int backend( void ){
+int
+backend(void)
+{
char *str;
- w3m_dump = 0;
- if (COLS == 0) COLS = 80;
+ w3m_dump = 0;
+ if (COLS == 0)
+ COLS = 80;
#ifdef USE_MOUSE
use_mouse = FALSE;
-#endif /* USE_MOUSE */
-
- if( backend_batch_commands ){
- while(( str = popText(backend_batch_commands) ))
- call_command_function( str );
- } else {
- while(( str = readline( "w3m> " ) ))
- call_command_function( str );
+#endif /* USE_MOUSE */
+
+ if (backend_batch_commands) {
+ while ((str = popText(backend_batch_commands)))
+ call_command_function(str);
}
- quit( NULL );
+ else {
+ while ((str = readline("w3m> ")))
+ call_command_function(str);
+ }
+ quit(NULL);
return 0;
}
/* Dummy function of readline(). */
#ifndef HAVE_READLINE
-static char *readline( char *prompt ){
+static char *
+readline(char *prompt)
+{
Str s;
- fputs( prompt, stdout );
- fflush( stdout );
- s = Strfgets( stdin );
- if( feof( stdin ) && (strlen( s->ptr ) == 0) )
+ fputs(prompt, stdout);
+ fflush(stdout);
+ s = Strfgets(stdin);
+ if (feof(stdin) && (strlen(s->ptr) == 0))
return NULL;
else
return s->ptr;
}
-#endif /* ! HAVE_READLINE */
+#endif /* ! HAVE_READLINE */
/* Splits a string into a list of tokens and returns that list. */
-static TextList* split( char *p ){
+static TextList *
+split(char *p)
+{
int in_double_quote = FALSE, in_single_quote = FALSE;
Str s = Strnew();
- TextList* tp = newTextList();
-
- for( ; *p; p++ ){
- switch( *p ){
- case '"':
- if( in_single_quote )
- Strcat_char( s, '"' );
- else
- in_double_quote = !in_double_quote;
- break;
- case '\'':
- if( in_double_quote )
- Strcat_char( s, '\'' );
- else
- in_single_quote = !in_single_quote;
- break;
- case '\\':
- if( !in_single_quote ){
- /* Process escape characters. */
- p++;
- switch( *p ){
- case 't':
- Strcat_char( s, '\t' );
- break;
- case 'r':
- Strcat_char( s, '\r' );
- break;
- case 'f':
- Strcat_char( s, '\f' );
- break;
- case 'n':
- Strcat_char( s, '\n' );
- break;
- case '\0':
- goto LAST;
- default:
- Strcat_char( s, *p );
- }
- } else {
- Strcat_char( s, *p );
- }
- break;
- case ' ':
- case '\t':
- case '\r':
- case '\f':
- case '\n':
- /* Separators are detected. */
- if( in_double_quote || in_single_quote ){
- Strcat_char( s, *p );
- } else if( s->length > 0 ){
- pushText( tp, s->ptr );
- s = Strnew();
+ TextList *tp = newTextList();
+
+ for (; *p; p++) {
+ switch (*p) {
+ case '"':
+ if (in_single_quote)
+ Strcat_char(s, '"');
+ else
+ in_double_quote = !in_double_quote;
+ break;
+ case '\'':
+ if (in_double_quote)
+ Strcat_char(s, '\'');
+ else
+ in_single_quote = !in_single_quote;
+ break;
+ case '\\':
+ if (!in_single_quote) {
+ /* Process escape characters. */
+ p++;
+ switch (*p) {
+ case 't':
+ Strcat_char(s, '\t');
+ break;
+ case 'r':
+ Strcat_char(s, '\r');
+ break;
+ case 'f':
+ Strcat_char(s, '\f');
+ break;
+ case 'n':
+ Strcat_char(s, '\n');
+ break;
+ case '\0':
+ goto LAST;
+ default:
+ Strcat_char(s, *p);
}
- break;
- default:
- Strcat_char( s, *p );
+ }
+ else {
+ Strcat_char(s, *p);
+ }
+ break;
+ case ' ':
+ case '\t':
+ case '\r':
+ case '\f':
+ case '\n':
+ /* Separators are detected. */
+ if (in_double_quote || in_single_quote) {
+ Strcat_char(s, *p);
+ }
+ else if (s->length > 0) {
+ pushText(tp, s->ptr);
+ s = Strnew();
+ }
+ break;
+ default:
+ Strcat_char(s, *p);
}
}
-LAST:
- if( s->length > 0 )
- pushText( tp, s->ptr );
+ LAST:
+ if (s->length > 0)
+ pushText(tp, s->ptr);
return tp;
}
diff --git a/buffer.c b/buffer.c
index 9915df5..b0adce4 100644
--- a/buffer.c
+++ b/buffer.c
@@ -1,4 +1,4 @@
-/* $Id: buffer.c,v 1.5 2001/11/21 19:24:35 ukai Exp $ */
+/* $Id: buffer.c,v 1.6 2001/11/24 02:01:26 ukai Exp $ */
#include "fm.h"
#ifdef USE_MOUSE
@@ -16,8 +16,7 @@ extern int do_getch();
#include <strings.h>
#endif
char *NullLine = "";
-Lineprop NullProp[] =
-{0};
+Lineprop NullProp[] = { 0 };
/*
* Buffer creation
@@ -30,7 +29,7 @@ newBuffer(int width)
n = New(Buffer);
if (n == NULL)
return NULL;
- bzero((void *) n, sizeof(Buffer));
+ bzero((void *)n, sizeof(Buffer));
n->width = width;
n->COLS = COLS;
n->currentURL.scheme = SCM_UNKNOWN;
@@ -65,7 +64,7 @@ nullBuffer(void)
* clearBuffer: clear buffer content
*/
void
-clearBuffer(Buffer * buf)
+clearBuffer(Buffer *buf)
{
buf->firstLine = buf->topLine = buf->currentLine = buf->lastLine = NULL;
buf->allLine = 0;
@@ -76,7 +75,7 @@ clearBuffer(Buffer * buf)
*/
void
-discardBuffer(Buffer * buf)
+discardBuffer(Buffer *buf)
{
int i;
Buffer *b;
@@ -102,7 +101,7 @@ discardBuffer(Buffer * buf)
unlink(buf->mailcap_source);
while (buf->frameset) {
deleteFrameSet(buf->frameset);
- buf->frameset = popFrameTree(&(buf->frameQ));
+ buf->frameset = popFrameTree(&(buf->frameQ));
}
}
@@ -110,7 +109,7 @@ discardBuffer(Buffer * buf)
* namedBuffer: Select buffer which have specified name
*/
Buffer *
-namedBuffer(Buffer * first, char *name)
+namedBuffer(Buffer *first, char *name)
{
Buffer *buf;
@@ -129,7 +128,7 @@ namedBuffer(Buffer * first, char *name)
* deleteBuffer: delete buffer
*/
Buffer *
-deleteBuffer(Buffer * first, Buffer * delbuf)
+deleteBuffer(Buffer *first, Buffer *delbuf)
{
Buffer *buf, *b;
@@ -150,7 +149,7 @@ deleteBuffer(Buffer * first, Buffer * delbuf)
* replaceBuffer: replace buffer
*/
Buffer *
-replaceBuffer(Buffer * first, Buffer * delbuf, Buffer * newbuf)
+replaceBuffer(Buffer *first, Buffer *delbuf, Buffer *newbuf)
{
Buffer *buf;
@@ -174,7 +173,7 @@ replaceBuffer(Buffer * first, Buffer * delbuf, Buffer * newbuf)
}
Buffer *
-nthBuffer(Buffer * firstbuf, int n)
+nthBuffer(Buffer *firstbuf, int n)
{
int i;
Buffer *buf = firstbuf;
@@ -190,7 +189,7 @@ nthBuffer(Buffer * firstbuf, int n)
}
static void
-writeBufferName(Buffer * buf, int n)
+writeBufferName(Buffer *buf, int n)
{
Str msg;
int all;
@@ -226,7 +225,7 @@ writeBufferName(Buffer * buf, int n)
* gotoLine: go to line number
*/
void
-gotoLine(Buffer * buf, int n)
+gotoLine(Buffer *buf, int n)
{
char msg[32];
Line *l = buf->firstLine;
@@ -237,7 +236,7 @@ gotoLine(Buffer * buf, int n)
if (buf->lastLine->linenumber < n)
getNextPage(buf, n - buf->lastLine->linenumber);
while ((buf->lastLine->linenumber < n) &&
- (getNextPage(buf, 1) != NULL));
+ (getNextPage(buf, 1) != NULL)) ;
}
if (l->linenumber > n) {
sprintf(msg, "First line is #%ld", l->linenumber);
@@ -250,7 +249,7 @@ gotoLine(Buffer * buf, int n)
sprintf(msg, "Last line is #%ld", buf->lastLine->linenumber);
disp_message(msg, FALSE);
buf->currentLine = l;
- buf->topLine = lineSkip(buf, buf->currentLine, - (LASTLINE - 1), FALSE);
+ buf->topLine = lineSkip(buf, buf->currentLine, -(LASTLINE - 1), FALSE);
return;
}
for (; l != NULL; l = l->next) {
@@ -268,7 +267,7 @@ gotoLine(Buffer * buf, int n)
* gotoRealLine: go to real line number
*/
void
-gotoRealLine(Buffer * buf, int n)
+gotoRealLine(Buffer *buf, int n)
{
char msg[32];
Line *l = buf->firstLine;
@@ -279,7 +278,7 @@ gotoRealLine(Buffer * buf, int n)
if (buf->lastLine->real_linenumber < n)
getNextPage(buf, n - buf->lastLine->real_linenumber);
while ((buf->lastLine->real_linenumber < n) &&
- (getNextPage(buf, 1) != NULL));
+ (getNextPage(buf, 1) != NULL)) ;
}
if (l->real_linenumber > n) {
sprintf(msg, "First line is #%ld", l->real_linenumber);
@@ -292,7 +291,7 @@ gotoRealLine(Buffer * buf, int n)
sprintf(msg, "Last line is #%ld", buf->lastLine->real_linenumber);
disp_message(msg, FALSE);
buf->currentLine = l;
- buf->topLine = lineSkip(buf, buf->currentLine, - (LASTLINE - 1), FALSE);
+ buf->topLine = lineSkip(buf, buf->currentLine, -(LASTLINE - 1), FALSE);
return;
}
for (; l != NULL; l = l->next) {
@@ -308,7 +307,7 @@ gotoRealLine(Buffer * buf, int n)
static Buffer *
-listBuffer(Buffer * top, Buffer * current)
+listBuffer(Buffer *top, Buffer *current)
{
int i, c = 0;
Buffer *buf = top;
@@ -345,10 +344,11 @@ listBuffer(Buffer * top, Buffer * current)
buf = buf->nextBuffer;
}
standout();
- message("Buffer selection mode: SPC for select / D for delete buffer", 0, 0);
+ message("Buffer selection mode: SPC for select / D for delete buffer", 0,
+ 0);
standend();
-/*
- * move(LASTLINE, COLS - 1); */
+ /*
+ * move(LASTLINE, COLS - 1); */
move(c, 0);
refresh();
return buf->nextBuffer;
@@ -359,7 +359,7 @@ listBuffer(Buffer * top, Buffer * current)
* Select buffer visually
*/
Buffer *
-selectBuffer(Buffer * firstbuf, Buffer * currentbuf, char *selectchar)
+selectBuffer(Buffer *firstbuf, Buffer *currentbuf, char *selectchar)
{
int i, cpoint, /* Current Buffer Number */
spoint, /* Current Line on Screen */
@@ -406,20 +406,20 @@ selectBuffer(Buffer * firstbuf, Buffer * currentbuf, char *selectchar)
}
}
#ifdef __EMX__
- else if(!c)
- switch(getch()){
+ else if (!c)
+ switch (getch()) {
case K_UP:
- c='k';
+ c = 'k';
break;
case K_DOWN:
- c='j';
+ c = 'j';
break;
case K_RIGHT:
- c=' ';
+ c = ' ';
break;
case K_LEFT:
- c='B';
- }
+ c = 'B';
+ }
#endif
switch (c) {
case CTRL_N:
@@ -472,9 +472,9 @@ selectBuffer(Buffer * firstbuf, Buffer * currentbuf, char *selectchar)
*selectchar = c;
return currentbuf;
}
-/*
- * move(LASTLINE, COLS - 1);
- */
+ /*
+ * move(LASTLINE, COLS - 1);
+ */
move(spoint, 0);
refresh();
}
@@ -484,23 +484,25 @@ selectBuffer(Buffer * firstbuf, Buffer * currentbuf, char *selectchar)
* Reshape HTML buffer
*/
void
-reshapeBuffer(Buffer * buf)
+reshapeBuffer(Buffer *buf)
{
URLFile f;
int top, linenum, cursorY, pos, currentColumn;
AnchorList *formitem;
if (buf->sourcefile == NULL)
- return;
+ return;
init_stream(&f, SCM_LOCAL, NULL);
- examineFile(buf->mailcap_source ? buf->mailcap_source : buf->sourcefile, &f);
+ examineFile(buf->mailcap_source ? buf->mailcap_source : buf->sourcefile,
+ &f);
if (f.stream == NULL)
- return;
+ return;
if (buf->firstLine == NULL) {
top = 1;
linenum = 1;
- } else {
+ }
+ else {
top = buf->topLine->linenumber;
linenum = buf->currentLine->linenumber;
}
@@ -510,7 +512,7 @@ reshapeBuffer(Buffer * buf)
clearBuffer(buf);
while (buf->frameset) {
deleteFrameSet(buf->frameset);
- buf->frameset = popFrameTree(&(buf->frameQ));
+ buf->frameset = popFrameTree(&(buf->frameQ));
}
formitem = buf->formitem;
@@ -524,10 +526,10 @@ reshapeBuffer(Buffer * buf)
UseContentCharset = FALSE;
UseAutoDetect = FALSE;
#endif
- if (! strcasecmp(buf->type, "text/html"))
- loadHTMLBuffer(&f, buf);
+ if (!strcasecmp(buf->type, "text/html"))
+ loadHTMLBuffer(&f, buf);
else
- loadBuffer(&f, buf);
+ loadBuffer(&f, buf);
UFclose(&f);
#ifdef JP_CHARSET
UseContentCharset = TRUE;
@@ -551,18 +553,18 @@ reshapeBuffer(Buffer * buf)
/* shallow copy */
void
-copyBuffer(Buffer * a, Buffer * b)
+copyBuffer(Buffer *a, Buffer *b)
{
readBufferCache(b);
- bcopy((void *) b, (void *) a, sizeof(Buffer));
+ bcopy((void *)b, (void *)a, sizeof(Buffer));
}
Buffer *
-prevBuffer(Buffer * first, Buffer * buf)
+prevBuffer(Buffer *first, Buffer *buf)
{
Buffer *b;
- for (b = first; b != NULL && b->nextBuffer != buf; b = b->nextBuffer);
+ for (b = first; b != NULL && b->nextBuffer != buf; b = b->nextBuffer) ;
return b;
}
@@ -604,7 +606,7 @@ writeBufferCache(Buffer *buf)
fwrite(l->propBuf, sizeof(Lineprop), l->len, cache) < l->len)
goto _error;
#ifdef USE_ANSI_COLOR
- colorflag = l->colorBuf ? 1 : 0;
+ colorflag = l->colorBuf ? 1 : 0;
if (fwrite1(colorflag, cache))
goto _error;
if (colorflag) {
@@ -616,10 +618,10 @@ writeBufferCache(Buffer *buf)
fclose(cache);
return 0;
- _error:
+ _error:
fclose(cache);
unlink(buf->savecache);
- _error1:
+ _error1:
buf->savecache = NULL;
return -1;
}
@@ -638,9 +640,7 @@ readBufferCache(Buffer *buf)
return -1;
cache = fopen(buf->savecache, "r");
- if (cache == NULL ||
- fread1(clnum, cache) ||
- fread1(tlnum, cache)) {
+ if (cache == NULL || fread1(clnum, cache) || fread1(tlnum, cache)) {
buf->savecache = NULL;
return -1;
}
@@ -661,8 +661,7 @@ readBufferCache(Buffer *buf)
buf->topLine = l;
if (fread1(l->real_linenumber, cache) ||
fread1(l->usrflags, cache) ||
- fread1(l->width, cache) ||
- fread1(l->len, cache))
+ fread1(l->width, cache) || fread1(l->len, cache))
break;
l->lineBuf = NewAtom_N(char, l->len + 1);
fread(l->lineBuf, 1, l->len, cache);
@@ -675,7 +674,8 @@ readBufferCache(Buffer *buf)
if (colorflag) {
l->colorBuf = NewAtom_N(Linecolor, l->len);
fread(l->colorBuf, sizeof(Linecolor), l->len, cache);
- } else {
+ }
+ else {
l->colorBuf = NULL;
}
#endif
diff --git a/conv.c b/conv.c
index 379f5f9..50c32a6 100644
--- a/conv.c
+++ b/conv.c
@@ -1,4 +1,4 @@
-/* $Id: conv.c,v 1.3 2001/11/20 17:49:23 ukai Exp $ */
+/* $Id: conv.c,v 1.4 2001/11/24 02:01:26 ukai Exp $ */
#include <stdio.h>
#include <string.h>
#include "fm.h"
@@ -76,8 +76,7 @@ static Str cConvSE(Str is);
static Str cConvJE(Str is);
char checkShiftCode(Str buf, uchar);
-static char *han2zen_tab[] =
-{
+static char *han2zen_tab[] = {
"!!", "!#", "!V", "!W", "!\"", "!&", "%r", "%!",
"%#", "%%", "%'", "%)", "%c", "%e", "%g", "%C",
"!<", "%\"", "%$", "%&", "%(", "%*", "%+", "%-",
@@ -90,31 +89,29 @@ static char *han2zen_tab[] =
typedef struct _ConvRoutine {
char key;
- Str(*routine) ();
+ Str (*routine) ();
char *ShiftIn, *ShiftOut;
} ConvRoutine;
-static ConvRoutine FromEJ[] =
-{
+static ConvRoutine FromEJ[] = {
{CODE_JIS_J, cConvEJ, JSIcode, JSOcode},
{CODE_JIS_N, cConvEJ, NSIcode, NSOcode},
{CODE_JIS_n, cConvEJ, N2SIcode, N2SOcode},
{CODE_JIS_m, cConvEJ, N3SIcode, N3SOcode},
{CODE_JIS_j, cConvEJ, J2SIcode, J2SOcode},
- {CODE_SJIS, cConvES, "", ""},
- {CODE_EUC, cConvEE, "", ""},
+ {CODE_SJIS, cConvES, "", ""},
+ {CODE_EUC, cConvEE, "", ""},
{'\0', NULL, NULL, NULL}
};
-static ConvRoutine ToEJ[] =
-{
+static ConvRoutine ToEJ[] = {
{CODE_JIS_J, cConvJE, JSIcode, JSOcode},
{CODE_JIS_N, cConvJE, NSIcode, NSOcode},
{CODE_JIS_n, cConvJE, N2SIcode, N2SOcode},
{CODE_JIS_m, cConvJE, N3SIcode, N3SOcode},
{CODE_JIS_j, cConvJE, J2SIcode, J2SOcode},
- {CODE_SJIS, cConvSE, "", ""},
- {CODE_EUC, cConvEE, "", ""},
+ {CODE_SJIS, cConvSE, "", ""},
+ {CODE_EUC, cConvEE, "", ""},
{'\0', NULL, NULL, NULL}
};
@@ -122,7 +119,7 @@ char *
GetSICode(char key)
{
int i;
- for (i = 0; FromEJ[i].key != '\0' ; i++)
+ for (i = 0; FromEJ[i].key != '\0'; i++)
if (FromEJ[i].key == key)
return FromEJ[i].ShiftIn;
return "";
@@ -141,7 +138,8 @@ GetSOCode(char key)
static void
n_impr(char s)
{
- fprintf(stderr, "conv: option %c(0x%02x) is not implemented yet... sorry\n", s, s);
+ fprintf(stderr,
+ "conv: option %c(0x%02x) is not implemented yet... sorry\n", s, s);
w3m_exit(1);
}
@@ -172,7 +170,7 @@ conv_str(Str is, char fc, char tc)
n_impr(fc);
return NULL;
}
- next:
+ next:
os = conv_from(is);
}
if (tc == CODE_INNER_EUC || tc == CODE_EUC)
@@ -191,7 +189,7 @@ conv_str(Str is, char fc, char tc)
n_impr(tc);
return NULL;
}
- next2:
+ next2:
return conv_to(os);
}
}
@@ -226,41 +224,40 @@ cConvSE(Str is)
uchar *p, ub, lb;
int state = SJIS_NOSTATE;
Str os = Strnew_size(is->length);
- uchar *endp = (uchar *) &is->ptr[is->length];
+ uchar *endp = (uchar *) & is->ptr[is->length];
for (p = (uchar *) is->ptr; p < endp; p++) {
switch (state) {
case SJIS_NOSTATE:
if (!(*p & 0x80)) /* ASCII */
- Strcat_char(os, (char) (*p));
+ Strcat_char(os, (char)(*p));
else if (0x81 <= *p && *p <= 0x9f) { /* JIS X 0208,
* 0213 */
ub = *p & 0x7f;
state = SJIS_SHIFT_L;
}
else if (0xe0 <= *p && *p <= 0xef) { /* JIS X 0208 */
- /* } else if (0xe0 <= *p && *p <= 0xfc) { *//* JIS X 0213 */
+/* } else if (0xe0 <= *p && *p <= 0xfc) { *//* JIS X 0213 */
ub = (*p & 0x7f) - 0x40;
state = SJIS_SHIFT_H;
}
else if (0xa0 <= *p && *p <= 0xdf) { /* JIS X 0201-Kana
*/
- Strcat_char(os, (char) (han2zen_tab[*p - 0xa0][0] | 0x80));
- Strcat_char(os, (char) (han2zen_tab[*p - 0xa0][1] | 0x80));
+ Strcat_char(os, (char)(han2zen_tab[*p - 0xa0][0] | 0x80));
+ Strcat_char(os, (char)(han2zen_tab[*p - 0xa0][1] | 0x80));
}
break;
case SJIS_SHIFT_L:
case SJIS_SHIFT_H:
- if ((0x40 <= *p && *p <= 0x7e) ||
- (0x80 <= *p && *p <= 0xfc)) { /* JIS X 0208, 0213 */
+ if ((0x40 <= *p && *p <= 0x7e) || (0x80 <= *p && *p <= 0xfc)) { /* JIS X 0208, 0213 */
lb = getSLb(p, &ub);
ub += 0x20;
lb += 0x20;
- Strcat_char(os, (char) (ub | 0x80));
- Strcat_char(os, (char) (lb | 0x80));
+ Strcat_char(os, (char)(ub | 0x80));
+ Strcat_char(os, (char)(lb | 0x80));
}
else if (!(*p & 0x80)) /* broken ? */
- Strcat_char(os, (char) (*p));
+ Strcat_char(os, (char)(*p));
state = SJIS_NOSTATE;
break;
}
@@ -275,7 +272,7 @@ cConvJE(Str is)
char cset = CSET_ASCII;
int state = ISO_NOSTATE;
Str os = Strnew_size(is->length);
- uchar *endp = (uchar *) &is->ptr[is->length];
+ uchar *endp = (uchar *) & is->ptr[is->length];
for (p = (uchar *) is->ptr; p < endp; p++) {
switch (state) {
@@ -283,7 +280,7 @@ cConvJE(Str is)
if (*p == ESC_CODE) /* ESC sequence */
state = ISO_ESC;
else if (cset == CSET_ASCII || *p < 0x21)
- Strcat_char(os, (char) (*p));
+ Strcat_char(os, (char)(*p));
else if (cset == CSET_X0208 && *p <= 0x7e) {
/* JIS X 0208 */
ub = *p;
@@ -291,20 +288,20 @@ cConvJE(Str is)
}
else if (cset == CSET_X0201K && *p <= 0x5f) {
/* JIS X 0201-Kana */
- Strcat_char(os, (char) (han2zen_tab[*p - 0x20][0] | 0x80));
- Strcat_char(os, (char) (han2zen_tab[*p - 0x20][1] | 0x80));
+ Strcat_char(os, (char)(han2zen_tab[*p - 0x20][0] | 0x80));
+ Strcat_char(os, (char)(han2zen_tab[*p - 0x20][1] | 0x80));
}
break;
case ISO_MBYTE1:
if (*p == ESC_CODE) /* ESC sequence */
state = ISO_ESC;
else if (0x21 <= *p && *p <= 0x7e) { /* JIS X 0208 */
- Strcat_char(os, (char) (ub | 0x80));
- Strcat_char(os, (char) (*p | 0x80));
+ Strcat_char(os, (char)(ub | 0x80));
+ Strcat_char(os, (char)(*p | 0x80));
state = ISO_NOSTATE;
}
else {
- Strcat_char(os, (char) (*p));
+ Strcat_char(os, (char)(*p));
state = ISO_NOSTATE;
}
break;
@@ -315,7 +312,7 @@ cConvJE(Str is)
state = ISO_MBCS;
else {
Strcat_char(os, ESC_CODE);
- Strcat_char(os, (char) (*p));
+ Strcat_char(os, (char)(*p));
state = ISO_NOSTATE;
}
break;
@@ -327,7 +324,7 @@ cConvJE(Str is)
else {
Strcat_char(os, ESC_CODE);
Strcat_char(os, '(');
- Strcat_char(os, (char) (*p));
+ Strcat_char(os, (char)(*p));
}
state = ISO_NOSTATE;
break;
@@ -344,7 +341,7 @@ cConvJE(Str is)
Strcat_char(os, '$');
if (state == (ISO_MBCS | ISO_CS94))
Strcat_char(os, '(');
- Strcat_char(os, (char) (*p));
+ Strcat_char(os, (char)(*p));
}
state = ISO_NOSTATE;
break;
@@ -361,7 +358,7 @@ _cConvEE(Str is, char is_euc)
int state = EUC_NOSTATE;
char cset = CSET_ASCII;
Str os;
- uchar *endp = (uchar *) &is->ptr[is->length];
+ uchar *endp = (uchar *) & is->ptr[is->length];
if (is_euc) {
os = Strnew_size(is->length);
@@ -378,7 +375,7 @@ _cConvEE(Str is, char is_euc)
Strcat_charp(os, SOcode);
cset = CSET_ASCII;
}
- Strcat_char(os, (char) (*p));
+ Strcat_char(os, (char)(*p));
}
else if (0xa1 <= *p && *p <= 0xfe) { /* JIS X 0208,
* 0213-1 */
@@ -396,15 +393,15 @@ _cConvEE(Str is, char is_euc)
Strcat_charp(os, SIcode);
cset = CSET_X0208;
}
- Strcat_char(os, (char) ((ub & 0x7f) | euc));
- Strcat_char(os, (char) ((*p & 0x7f) | euc));
+ Strcat_char(os, (char)((ub & 0x7f) | euc));
+ Strcat_char(os, (char)((*p & 0x7f) | euc));
}
else if (!(*p & 0x80)) { /* broken ? */
if (!is_euc && cset != CSET_ASCII) {
Strcat_charp(os, SOcode);
cset = CSET_ASCII;
}
- Strcat_char(os, (char) (*p));
+ Strcat_char(os, (char)(*p));
}
state = EUC_NOSTATE;
break;
@@ -414,8 +411,8 @@ _cConvEE(Str is, char is_euc)
Strcat_charp(os, SIcode);
cset = CSET_X0208;
}
- Strcat_char(os, (char) (han2zen_tab[*p - 0xa0][0] | euc));
- Strcat_char(os, (char) (han2zen_tab[*p - 0xa0][1] | euc));
+ Strcat_char(os, (char)(han2zen_tab[*p - 0xa0][0] | euc));
+ Strcat_char(os, (char)(han2zen_tab[*p - 0xa0][1] | euc));
}
state = EUC_NOSTATE;
break;
@@ -458,8 +455,8 @@ put_sjis(Str os, uchar ub, uchar lb)
if (lb > 0x7e)
lb++;
- Strcat_char(os, (char) (ub));
- Strcat_char(os, (char) (lb));
+ Strcat_char(os, (char)(ub));
+ Strcat_char(os, (char)(lb));
}
static Str
@@ -468,13 +465,13 @@ cConvES(Str is)
uchar *p, ub;
int state = EUC_NOSTATE;
Str os = Strnew_size(is->length);
- uchar *endp = (uchar *) &is->ptr[is->length];
+ uchar *endp = (uchar *) & is->ptr[is->length];
for (p = (uchar *) is->ptr; p < endp; p++) {
switch (state) {
case EUC_NOSTATE:
if (!(*p & 0x80)) /* ASCII */
- Strcat_char(os, (char) (*p));
+ Strcat_char(os, (char)(*p));
else if (0xa1 <= *p && *p <= 0xfe) { /* JIS X 0208,
* 0213-1 */
ub = *p;
@@ -489,13 +486,13 @@ cConvES(Str is)
if (0xa1 <= *p && *p <= 0xfe) /* JIS X 0208, 0213-1 */
put_sjis(os, ub & 0x7f, *p & 0x7f);
else if (!(*p & 0x80)) /* broken ? */
- Strcat_char(os, (char) (*p));
+ Strcat_char(os, (char)(*p));
state = EUC_NOSTATE;
break;
case EUC_SS2:
if (0xa0 <= *p && *p <= 0xdf) /* JIS X 0201-Kana */
put_sjis(os, han2zen_tab[*p - 0xa0][0],
- han2zen_tab[*p - 0xa0][1]);
+ han2zen_tab[*p - 0xa0][1]);
state = EUC_NOSTATE;
break;
case EUC_SS3:
@@ -522,7 +519,7 @@ checkShiftCode(Str buf, uchar hint)
int euc = (CODE_NORMAL | EUC_NOSTATE),
sjis = (CODE_NORMAL | SJIS_NOSTATE), sjis_kana = CODE_NORMAL,
iso = (CODE_NORMAL | ISO_NOSTATE), iso_kana = CODE_NORMAL;
- uchar *endp = (uchar *) &buf->ptr[buf->length];
+ uchar *endp = (uchar *) & buf->ptr[buf->length];
if (hint == CODE_INNER_EUC)
return '\0';
@@ -569,7 +566,7 @@ checkShiftCode(Str buf, uchar hint)
if (!(*p & 0x80)) /* ASCII */
;
else if (0xa1 <= *p && *p <= 0xfe) /* JIS X 0208,
- * 0213-1 */
+ * * * * * 0213-1 */
euc = (CODE_STATE(euc) | EUC_MBYTE1);
else if (*p == EUC_SS2_CODE) /* SS2 + JIS X 0201-Kana */
euc = (CODE_STATE(euc) | EUC_SS2);
@@ -610,7 +607,9 @@ checkShiftCode(Str buf, uchar hint)
;
else if (0x81 <= *p && *p <= 0x9f)
sjis = (CODE_STATE(sjis) | SJIS_SHIFT_L);
- else if (0xe0 <= *p && *p <= 0xef) /* JIS X 0208 */
+ else if (0xe0 <= *p && *p <= 0xef)
+
+ /* JIS X 0208 */
/* else if (0xe0 <= *p && *p <= 0xfc) */
/* JIS X 0213 */
sjis = (CODE_STATE(sjis) | SJIS_SHIFT_H);
@@ -626,9 +625,8 @@ checkShiftCode(Str buf, uchar hint)
case SJIS_SHIFT_H:
if (CODE_STATE(sjis) == CODE_NORMAL)
sjis = CODE_OK;
- if ((0x40 <= *p && *p <= 0x7e) ||
- (0x80 <= *p && *p <= 0xfc)) /* JIS X 0208,
- * 0213 */
+ if ((0x40 <= *p && *p <= 0x7e) || (0x80 <= *p && *p <= 0xfc)) /* JIS X 0208,
+ * * * * * 0213 */
sjis = (CODE_STATE(sjis) | SJIS_NOSTATE);
else if (sjis & CODE_BROKEN)
sjis = CODE_ERROR;
@@ -683,7 +681,8 @@ checkShiftCode(Str buf, uchar hint)
if (hint == CODE_EUC) {
if (euc != CODE_ERROR)
return CODE_EUC;
- } else if (hint == CODE_SJIS) {
+ }
+ else if (hint == CODE_SJIS) {
if (sjis != CODE_ERROR)
return CODE_SJIS;
}
diff --git a/cookie.c b/cookie.c
index 41000e6..18bb304 100644
--- a/cookie.c
+++ b/cookie.c
@@ -1,4 +1,4 @@
-/* $Id: cookie.c,v 1.4 2001/11/16 22:02:00 ukai Exp $ */
+/* $Id: cookie.c,v 1.5 2001/11/24 02:01:26 ukai Exp $ */
/*
* References for version 0 cookie:
@@ -59,8 +59,7 @@ domain_match(char *host, char *domain)
* "." match all domains (w3m only),
* and ".local" match local domains ([DRAFT 12] s. 2)
*/
- if (strcasecmp(domain, ".") == 0 ||
- strcasecmp(domain, ".local") == 0) {
+ if (strcasecmp(domain, ".") == 0 || strcasecmp(domain, ".local") == 0) {
offset = strlen(host);
domain_p = &host[offset];
if (domain[1] == '\0' || contain_no_dots(host, domain_p))
@@ -135,8 +134,7 @@ check_expired_cookies(void)
if (!First_cookie)
return;
- if (First_cookie->expires != (time_t) - 1 &&
- First_cookie->expires < now) {
+ if (First_cookie->expires != (time_t) - 1 && First_cookie->expires < now) {
if (!(First_cookie->flag & COO_DISCARD))
is_saved = 0;
First_cookie = First_cookie->next;
@@ -163,7 +161,7 @@ make_cookie(struct cookie *cookie)
}
static int
-match_cookie(ParsedURL * pu, struct cookie *cookie)
+match_cookie(ParsedURL *pu, struct cookie *cookie)
{
char *domainname = (cookie->version == 0) ? FQDN(pu->host) : pu->host;
@@ -194,15 +192,14 @@ get_cookie_info(Str domain, Str path, Str name)
for (p = First_cookie; p; p = p->next) {
if (Strcasecmp(p->domain, domain) == 0 &&
- Strcmp(p->path, path) == 0 &&
- Strcasecmp(p->name, name) == 0)
+ Strcmp(p->path, path) == 0 && Strcasecmp(p->name, name) == 0)
return p;
}
return NULL;
}
Str
-find_cookie(ParsedURL * pu)
+find_cookie(ParsedURL *pu)
{
Str tmp;
struct cookie *p, *p1, *fco = NULL;
@@ -211,7 +208,8 @@ find_cookie(ParsedURL * pu)
check_expired_cookies();
for (p = First_cookie; p; p = p->next) {
if (p->flag & COO_USE && match_cookie(pu, p)) {
- for (p1 = fco; p1 && Strcasecmp(p1->name, p->name); p1 = p1->next);
+ for (p1 = fco; p1 && Strcasecmp(p1->name, p->name);
+ p1 = p1->next) ;
if (p1)
continue;
p1 = New(struct cookie);
@@ -240,21 +238,21 @@ find_cookie(ParsedURL * pu)
if (p1->flag & COO_DOMAIN)
Strcat(tmp, Sprintf("; $Domain=\"%s\"", p1->domain->ptr));
if (p1->portl)
- Strcat(tmp, Sprintf("; $Port=\"%s\"", portlist2str(p1->portl)));
+ Strcat(tmp,
+ Sprintf("; $Port=\"%s\"", portlist2str(p1->portl)));
}
}
return tmp;
}
-char *special_domain[] =
-{
- ".com", ".edu", ".gov", ".mil", ".net", ".org", ".int", NULL};
+char *special_domain[] = {
+ ".com", ".edu", ".gov", ".mil", ".net", ".org", ".int", NULL
+};
int
-add_cookie(ParsedURL * pu, Str name, Str value,
+add_cookie(ParsedURL *pu, Str name, Str value,
time_t expires, Str domain, Str path,
- int flag, Str comment, int version,
- Str port, Str commentURL)
+ int flag, Str comment, int version, Str port, Str commentURL)
{
struct cookie *p;
char *domainname = (version == 0) ? FQDN(pu->host) : pu->host;
@@ -278,7 +276,7 @@ add_cookie(ParsedURL * pu, Str name, Str value,
#endif /* DEBUG */
/* [RFC 2109] s. 4.3.2 case 2; but this (no request-host) shouldn't happen */
if (!domainname)
- return COO_ENODOT;
+ return COO_ENODOT;
if (domain) {
char *dp;
@@ -299,7 +297,8 @@ add_cookie(ParsedURL * pu, Str name, Str value,
3);
if (n < 2) {
COOKIE_ERROR(COO_ESPECIAL);
- } else if (n == 2) {
+ }
+ else if (n == 2) {
char **sdomain;
int ok = 0;
for (sdomain = special_domain; !ok && *sdomain; sdomain++) {
@@ -311,7 +310,8 @@ add_cookie(ParsedURL * pu, Str name, Str value,
if (!ok)
COOKIE_ERROR(COO_ESPECIAL);
}
- } else {
+ }
+ else {
/* [DRAFT 12] s. 4.3.2 case 2 */
if (strcasecmp(domain->ptr, ".local") != 0 &&
contain_no_dots(&domain->ptr[1], &domain->ptr[domain->length]))
@@ -328,7 +328,7 @@ add_cookie(ParsedURL * pu, Str name, Str value,
}
if (path) {
/* [RFC 2109] s. 4.3.2 case 1 */
- if (version > 0 && strncmp(path->ptr, pu->file, path->length) != 0)
+ if (version > 0 && strncmp(path->ptr, pu->file, path->length) != 0)
COOKIE_ERROR(COO_EPATH);
}
if (port) {
@@ -461,7 +461,7 @@ load_cookies(void)
return;
if (First_cookie) {
- for (p = First_cookie; p->next; p = p->next);
+ for (p = First_cookie; p->next; p = p->next) ;
}
else {
p = NULL;
@@ -551,9 +551,10 @@ cookie_list_panel(void)
tmp = html_quote(parsedURL2Str(&p->url)->ptr);
if (p->expires != (time_t) - 1) {
#ifdef HAVE_STRFTIME
- strftime(tmp2, 80, "%a, %d %b %Y %H:%M:%S GMT", gmtime(&p->expires));
-#else /* not HAVE_STRFTIME */
- struct tm *gmt;
+ strftime(tmp2, 80, "%a, %d %b %Y %H:%M:%S GMT",
+ gmtime(&p->expires));
+#else /* not HAVE_STRFTIME */
+ struct tm *gmt;
static char *dow[] = {
"Sun ", "Mon ", "Tue ", "Wed ", "Thu ", "Fri ", "Sat "
};
@@ -561,18 +562,18 @@ cookie_list_panel(void)
"Jan ", "Feb ", "Mar ", "Apr ", "May ", "Jun ",
"Jul ", "Aug ", "Sep ", "Oct ", "Nov ", "Dec "
};
- gmt = gmtime( &p->expires );
- strcpy(tmp2,dow[gmt->tm_wday]);
- sprintf( &tmp2[4], "%02d ", gmt->tm_mday );
- strcpy(&tmp2[7],month[gmt->tm_mon]);
- if( gmt->tm_year < 1900 )
- sprintf( &tmp2[11], "%04d %02d:%02d:%02d GMT",
- (gmt->tm_year) + 1900, gmt->tm_hour, gmt->tm_min,
- gmt->tm_sec );
- else
- sprintf( &tmp2[11], "%04d %02d:%02d:%02d GMT",
- gmt->tm_year, gmt->tm_hour, gmt->tm_min, gmt->tm_sec );
-#endif /* not HAVE_STRFTIME */
+ gmt = gmtime(&p->expires);
+ strcpy(tmp2, dow[gmt->tm_wday]);
+ sprintf(&tmp2[4], "%02d ", gmt->tm_mday);
+ strcpy(&tmp2[7], month[gmt->tm_mon]);
+ if (gmt->tm_year < 1900)
+ sprintf(&tmp2[11], "%04d %02d:%02d:%02d GMT",
+ (gmt->tm_year) + 1900, gmt->tm_hour, gmt->tm_min,
+ gmt->tm_sec);
+ else
+ sprintf(&tmp2[11], "%04d %02d:%02d:%02d GMT",
+ gmt->tm_year, gmt->tm_hour, gmt->tm_min, gmt->tm_sec);
+#endif /* not HAVE_STRFTIME */
}
else
tmp2[0] = '\0';
@@ -595,7 +596,8 @@ cookie_list_panel(void)
Strcat_charp(src, "</td></tr>");
}
if (p->commentURL) {
- Strcat_charp(src, "<tr><td width=\"80\"><b>CommentURL:</b></td><td>");
+ Strcat_charp(src,
+ "<tr><td width=\"80\"><b>CommentURL:</b></td><td>");
Strcat_charp(src, "<a href=\"");
Strcat_charp(src, html_quote(p->commentURL->ptr));
Strcat_charp(src, "\">");
@@ -638,7 +640,8 @@ cookie_list_panel(void)
"<input type=radio name=\"%d\" value=0%s>No",
i, (p->flag & COO_USE) ? " checked" : "",
i, (!(p->flag & COO_USE)) ? " checked" : ""));
- Strcat_charp(src, "</td></tr><tr><td><input type=submit value=\"OK\"></table><p>");
+ Strcat_charp(src,
+ "</td></tr><tr><td><input type=submit value=\"OK\"></table><p>");
}
Strcat_charp(src, "</ol></form></body></html>");
return loadHTMLString(src);
diff --git a/display.c b/display.c
index 267f601..4e1244a 100644
--- a/display.c
+++ b/display.c
@@ -1,4 +1,4 @@
-/* $Id: display.c,v 1.7 2001/11/23 19:00:47 ukai Exp $ */
+/* $Id: display.c,v 1.8 2001/11/24 02:01:26 ukai Exp $ */
#include <signal.h>
#include "fm.h"
@@ -43,17 +43,22 @@
#define EFFECT_ACTIVE_END_NC underlineend()
#define EFFECT_ACTIVE_START_M bold()
#define EFFECT_ACTIVE_END_M boldend()
-#define EFFECT_VISITED_START_M /**/
-#define EFFECT_VISITED_END_M /**/
-
+#define EFFECT_VISITED_START_M /**/
+#define EFFECT_VISITED_END_M /**/
#define define_effect(name_start,name_end,color_start,color_end,mono_start,mono_end) \
static void name_start { if (useColor) { color_start; } else { mono_start; }}\
static void name_end { if (useColor) { color_end; } else { mono_end; }}
-
-define_effect(EFFECT_ANCHOR_START, EFFECT_ANCHOR_END, EFFECT_ANCHOR_START_C, EFFECT_ANCHOR_END_C, EFFECT_ANCHOR_START_M, EFFECT_ANCHOR_END_M)
-define_effect(EFFECT_IMAGE_START, EFFECT_IMAGE_END, EFFECT_IMAGE_START_C, EFFECT_IMAGE_END_C, EFFECT_IMAGE_START_M, EFFECT_IMAGE_END_M)
-define_effect(EFFECT_FORM_START, EFFECT_FORM_END, EFFECT_FORM_START_C, EFFECT_FORM_END_C, EFFECT_FORM_START_M, EFFECT_FORM_END_M)
-static void EFFECT_ACTIVE_START
+define_effect(EFFECT_ANCHOR_START, EFFECT_ANCHOR_END, EFFECT_ANCHOR_START_C,
+ EFFECT_ANCHOR_END_C, EFFECT_ANCHOR_START_M, EFFECT_ANCHOR_END_M)
+define_effect(EFFECT_IMAGE_START, EFFECT_IMAGE_END, EFFECT_IMAGE_START_C,
+ EFFECT_IMAGE_END_C, EFFECT_IMAGE_START_M, EFFECT_IMAGE_END_M)
+define_effect(EFFECT_FORM_START, EFFECT_FORM_END, EFFECT_FORM_START_C,
+ EFFECT_FORM_END_C, EFFECT_FORM_START_M, EFFECT_FORM_END_M)
+
+/*****************/
+/* *INDENT-OFF* */
+static void
+EFFECT_ACTIVE_START
{
if (useColor) {
if (useActiveColor) {
@@ -73,7 +78,8 @@ static void EFFECT_ACTIVE_START
}
}
-static void EFFECT_ACTIVE_END
+static void
+EFFECT_ACTIVE_END
{
if (useColor) {
if (useActiveColor) {
@@ -82,11 +88,12 @@ static void EFFECT_ACTIVE_END
EFFECT_ACTIVE_END_NC;
}
} else {
- EFFECT_ACTIVE_END_M;
+ EFFECT_ACTIVE_END_M;
}
}
-static void EFFECT_VISITED_START
+static void
+EFFECT_VISITED_START
{
if (useVisitedColor) {
if (useColor) {
@@ -97,7 +104,8 @@ static void EFFECT_VISITED_START
}
}
-static void EFFECT_VISITED_END
+static void
+EFFECT_VISITED_END
{
if (useVisitedColor) {
if (useColor) {
@@ -107,7 +115,7 @@ static void EFFECT_VISITED_END
}
}
}
-
+/* *INDENT-ON* */
#else /* not USE_COLOR */
#define EFFECT_ANCHOR_START underline()
@@ -118,12 +126,9 @@ static void EFFECT_VISITED_END
#define EFFECT_FORM_END standend()
#define EFFECT_ACTIVE_START bold()
#define EFFECT_ACTIVE_END boldend()
-#define EFFECT_VISITED_START /**/
-#define EFFECT_VISITED_END /**/
-
+#define EFFECT_VISITED_START /**/
+#define EFFECT_VISITED_END /**/
#endif /* not USE_COLOR */
-
-
#ifndef KANJI_SYMBOLS
static char g_rule[] = "ntwluxkavmqajaaa";
#endif /* not KANJI_SYMBOLS */
@@ -174,7 +179,7 @@ static int ccolumn = -1;
static int ulmode = 0, somode = 0, bomode = 0;
static int anch_mode = 0, emph_mode = 0, imag_mode = 0, form_mode = 0,
- active_mode = 0, visited_mode = 0;
+ active_mode = 0, visited_mode = 0;
#ifndef KANJI_SYMBOLS
static int graph_mode = 0;
#endif /* not KANJI_SYMBOLS */
@@ -189,7 +194,7 @@ static Buffer *save_current_buf = NULL;
int in_check_url = FALSE;
void
-displayBuffer(Buffer * buf, int mode)
+displayBuffer(Buffer *buf, int mode)
{
Str msg;
Anchor *aa = NULL;
@@ -204,7 +209,8 @@ displayBuffer(Buffer * buf, int mode)
buf->width = COLS;
if (buf->height == 0)
buf->height = LASTLINE + 1;
- if (buf->width != INIT_BUFFER_WIDTH && buf->type && !strcmp(buf->type, "text/html")) {
+ if (buf->width != INIT_BUFFER_WIDTH && buf->type
+ && !strcmp(buf->type, "text/html")) {
in_check_url = TRUE;
reshapeBuffer(buf);
in_check_url = FALSE;
@@ -212,18 +218,18 @@ displayBuffer(Buffer * buf, int mode)
if (showLineNum) {
if (buf->lastLine && buf->lastLine->real_linenumber > 0)
buf->rootX = (int)(log(buf->lastLine->real_linenumber + 0.1)
- / log(10)) + 2;
+ / log(10)) + 2;
if (buf->rootX < 5)
buf->rootX = 5;
if (buf->rootX > COLS)
buf->rootX = COLS;
- } else
+ }
+ else
buf->rootX = 0;
buf->COLS = COLS - buf->rootX;
if (mode == B_FORCE_REDRAW ||
mode == B_SCROLL ||
- cline != buf->topLine ||
- ccolumn != buf->currentColumn) {
+ cline != buf->topLine || ccolumn != buf->currentColumn) {
if (mode == B_SCROLL && cline && buf->currentColumn == ccolumn) {
int n = buf->topLine->linenumber - cline->linenumber;
if (n > 0 && n < LASTLINE) {
@@ -281,10 +287,12 @@ displayBuffer(Buffer * buf, int mode)
#endif /* LANG != JA */
l = buf->width - msg->length;
Strcat(msg, Strsubstr(s, s->length - l, l));
- } else {
+ }
+ else {
msg = s;
}
- } else {
+ }
+ else {
l -= s->length;
if (msg->length > l) {
#ifdef JP_CHARSET
@@ -302,7 +310,8 @@ displayBuffer(Buffer * buf, int mode)
Strcat_charp(msg, "> ");
Strcat(msg, s);
}
- } else {
+ }
+ else {
Strcat_charp(msg, ">");
}
if (buf->firstLine == NULL) {
@@ -322,13 +331,13 @@ displayBuffer(Buffer * buf, int mode)
}
void
-redrawBuffer(Buffer * buf)
+redrawBuffer(Buffer *buf)
{
redrawNLine(buf, LASTLINE);
}
void
-redrawNLine(Buffer * buf, int n)
+redrawNLine(Buffer *buf, int n)
{
Line *l, *l0;
int i;
@@ -358,7 +367,7 @@ redrawNLine(Buffer * buf, int n)
#define addKanji(pc,pr) (addChar((pc)[0],(pr)[0]),addChar((pc)[1],(pr)[1]))
Line *
-redrawLine(Buffer * buf, Line * l, int i)
+redrawLine(Buffer *buf, Line *l, int i)
{
int j, pos, rcol, ncol, delta;
int column = buf->currentColumn;
@@ -385,10 +394,10 @@ redrawLine(Buffer * buf, Line * l, int i)
move(i, 0);
if (showLineNum) {
char tmp[16];
- if (! buf->rootX) {
+ if (!buf->rootX) {
if (buf->lastLine->real_linenumber > 0)
buf->rootX = (int)(log(buf->lastLine->real_linenumber + 0.1)
- / log(10)) + 2;
+ / log(10)) + 2;
if (buf->rootX < 5)
buf->rootX = 5;
if (buf->rootX > COLS)
@@ -522,7 +531,7 @@ redrawLine(Buffer * buf, Line * l, int i)
}
int
-redrawLineRegion(Buffer * buf, Line * l, int i, int bpos, int epos)
+redrawLineRegion(Buffer *buf, Line *l, int i, int bpos, int epos)
{
int j, pos, rcol, ncol, delta;
int column = buf->currentColumn;
@@ -681,7 +690,8 @@ do_effects(Lineprop m)
do_effect2(PE_ANCHOR, anch_mode, EFFECT_ANCHOR_START, EFFECT_ANCHOR_END);
do_effect2(PE_IMAGE, imag_mode, EFFECT_IMAGE_START, EFFECT_IMAGE_END);
do_effect2(PE_FORM, form_mode, EFFECT_FORM_START, EFFECT_FORM_END);
- do_effect2(PE_VISITED, visited_mode, EFFECT_VISITED_START, EFFECT_VISITED_END);
+ do_effect2(PE_VISITED, visited_mode, EFFECT_VISITED_START,
+ EFFECT_VISITED_END);
do_effect2(PE_ACTIVE, active_mode, EFFECT_ACTIVE_START, EFFECT_ACTIVE_END);
#ifndef KANJI_SYMBOLS
if (graph_mode) {
@@ -698,7 +708,8 @@ do_effects(Lineprop m)
do_effect1(PE_ANCHOR, anch_mode, EFFECT_ANCHOR_START, EFFECT_ANCHOR_END);
do_effect1(PE_IMAGE, imag_mode, EFFECT_IMAGE_START, EFFECT_IMAGE_END);
do_effect1(PE_FORM, form_mode, EFFECT_FORM_START, EFFECT_FORM_END);
- do_effect1(PE_VISITED, visited_mode, EFFECT_VISITED_START, EFFECT_VISITED_END);
+ do_effect1(PE_VISITED, visited_mode, EFFECT_VISITED_START,
+ EFFECT_VISITED_END);
do_effect1(PE_ACTIVE, active_mode, EFFECT_ACTIVE_START, EFFECT_ACTIVE_END);
#ifndef KANJI_SYMBOLS
if (m & PC_RULE) {
@@ -736,14 +747,15 @@ addChar(char c, Lineprop mode)
#ifdef JP_CHARSET
if (CharType(mode) != PC_KANJI2)
#endif /* JP_CHARSET */
- do_effects(m);
+ do_effects(m);
#ifndef KANJI_SYMBOLS
if (m & PC_RULE) {
if (graph_mode)
addch(g_rule[c & 0xF]);
else
addch(alt_rule[c & 0xF]);
- } else
+ }
+ else
#endif /* not KANJI_SYMBOLS */
if (IS_UNPRINTABLE_ASCII(c, mode)) {
addstr(Sprintf("\\%3o", (unsigned char)c)->ptr);
@@ -759,7 +771,7 @@ addChar(char c, Lineprop mode)
}
else if (c != '\n')
addch(c);
- else /* \n */
+ else /* \n */
addch(' ');
}
@@ -790,10 +802,11 @@ message_list_panel(void)
"<html><head><title>List of error messages</title></head><body>"
"<h1>List of error messages</h1><table cellpadding=0>\n");
if (message_list)
- for (p = message_list->last ; p ; p = p->prev)
- Strcat_m_charp(tmp, "<tr><td><pre>", html_quote(p->ptr), "</pre></td></tr>\n", NULL);
+ for (p = message_list->last; p; p = p->prev)
+ Strcat_m_charp(tmp, "<tr><td><pre>", html_quote(p->ptr),
+ "</pre></td></tr>\n", NULL);
else
- Strcat_charp(tmp, "<tr><td>(no message recorded)</td></tr>\n");
+ Strcat_charp(tmp, "<tr><td>(no message recorded)</td></tr>\n");
Strcat_charp(tmp, "</table></body></html>");
return loadHTMLString(tmp);
}
@@ -817,7 +830,8 @@ disp_message_nsec(char *s, int redraw_current, int sec, int purge, int mouse)
return;
}
if (Currentbuf != NULL)
- message(s, Currentbuf->cursorX + Currentbuf->rootX, Currentbuf->cursorY);
+ message(s, Currentbuf->cursorX + Currentbuf->rootX,
+ Currentbuf->cursorY);
else
message(s, LASTLINE, 0);
refresh();
@@ -848,14 +862,14 @@ disp_message_nomouse(char *s, int redraw_current)
#endif
void
-cursorUp(Buffer * buf, int n)
+cursorUp(Buffer *buf, int n)
{
if (buf->firstLine == NULL)
return;
if (buf->cursorY > 0)
cursorUpDown(buf, -1);
else {
- buf->topLine = lineSkip(buf, buf->topLine, - n, FALSE);
+ buf->topLine = lineSkip(buf, buf->topLine, -n, FALSE);
if (buf->currentLine->prev != NULL)
buf->currentLine = buf->currentLine->prev;
arrangeLine(buf);
@@ -863,14 +877,14 @@ cursorUp(Buffer * buf, int n)
}
void
-cursorDown(Buffer * buf, int n)
+cursorDown(Buffer *buf, int n)
{
if (buf->firstLine == NULL)
return;
if (buf->cursorY < LASTLINE - 1)
cursorUpDown(buf, 1);
else {
- buf->topLine = lineSkip(buf, buf->topLine, n, FALSE);
+ buf->topLine = lineSkip(buf, buf->topLine, n, FALSE);
if (buf->currentLine->next != NULL)
buf->currentLine = buf->currentLine->next;
arrangeLine(buf);
@@ -878,7 +892,7 @@ cursorDown(Buffer * buf, int n)
}
void
-cursorUpDown(Buffer * buf, int n)
+cursorUpDown(Buffer *buf, int n)
{
Line *cl = buf->currentLine;
@@ -890,7 +904,7 @@ cursorUpDown(Buffer * buf, int n)
}
void
-cursorRight(Buffer * buf, int n)
+cursorRight(Buffer *buf, int n)
{
int i, delta = 1, cpos, vpos2;
Line *l = buf->currentLine;
@@ -910,32 +924,32 @@ cursorRight(Buffer * buf, int n)
buf->pos = i + delta;
}
else if (l->len == 0) {
- buf->pos = 0;
+ buf->pos = 0;
}
else {
- buf->pos = l->len -1;
+ buf->pos = l->len - 1;
#ifdef JP_CHARSET
- if (CharType(p[buf->pos]) == PC_KANJI2)
- buf->pos--;
-#endif /* JP_CHARSET */
+ if (CharType(p[buf->pos]) == PC_KANJI2)
+ buf->pos--;
+#endif /* JP_CHARSET */
}
cpos = COLPOS(l, buf->pos);
buf->visualpos = cpos - buf->currentColumn;
delta = 1;
#ifdef JP_CHARSET
if (CharType(p[buf->pos]) == PC_KANJI1)
- delta = 2;
-#endif /* JP_CHARSET */
+ delta = 2;
+#endif /* JP_CHARSET */
vpos2 = COLPOS(l, buf->pos + delta) - buf->currentColumn - 1;
if (vpos2 >= buf->COLS && n) {
- columnSkip(buf, n + (vpos2 - buf->COLS) - (vpos2 - buf->COLS) % n);
- buf->visualpos = cpos - buf->currentColumn;
+ columnSkip(buf, n + (vpos2 - buf->COLS) - (vpos2 - buf->COLS) % n);
+ buf->visualpos = cpos - buf->currentColumn;
}
buf->cursorX = buf->visualpos;
}
void
-cursorLeft(Buffer * buf, int n)
+cursorLeft(Buffer *buf, int n)
{
int i, delta = 1, cpos;
Line *l = buf->currentLine;
@@ -956,14 +970,14 @@ cursorLeft(Buffer * buf, int n)
cpos = COLPOS(l, buf->pos);
buf->visualpos = cpos - buf->currentColumn;
if (buf->visualpos < 0 && n) {
- columnSkip(buf, - n + buf->visualpos - buf->visualpos % n);
+ columnSkip(buf, -n + buf->visualpos - buf->visualpos % n);
buf->visualpos = cpos - buf->currentColumn;
}
buf->cursorX = buf->visualpos;
}
void
-cursorHome(Buffer * buf)
+cursorHome(Buffer *buf)
{
buf->visualpos = 0;
buf->cursorX = buf->cursorY = 0;
@@ -975,9 +989,9 @@ cursorHome(Buffer * buf)
* current position.
*/
void
-arrangeCursor(Buffer * buf)
+arrangeCursor(Buffer *buf)
{
- int col,col2;
+ int col, col2;
int delta = 1;
if (buf == NULL || buf->currentLine == NULL)
return;
@@ -998,26 +1012,28 @@ arrangeCursor(Buffer * buf)
col = COLPOS(buf->currentLine, buf->pos);
#ifdef JP_CHARSET
if (CharType(buf->currentLine->propBuf[buf->pos]) == PC_KANJI1)
- delta = 2;
-#endif /* JP_CHARSET */
+ delta = 2;
+#endif /* JP_CHARSET */
col2 = COLPOS(buf->currentLine, buf->pos + delta);
if (col < buf->currentColumn || col2 > buf->COLS + buf->currentColumn) {
buf->currentColumn = 0;
- if (col2 > buf->COLS)
+ if (col2 > buf->COLS)
columnSkip(buf, col);
}
/* Arrange cursor */
buf->cursorY = buf->currentLine->linenumber - buf->topLine->linenumber;
- buf->visualpos = buf->cursorX = COLPOS(buf->currentLine, buf->pos) - buf->currentColumn;
+ buf->visualpos = buf->cursorX =
+ COLPOS(buf->currentLine, buf->pos) - buf->currentColumn;
#ifdef DISPLAY_DEBUG
- fprintf(stderr, "arrangeCursor: column=%d, cursorX=%d, visualpos=%d, pos=%d, len=%d\n",
- buf->currentColumn, buf->cursorX, buf->visualpos,
- buf->pos, buf->currentLine->len);
+ fprintf(stderr,
+ "arrangeCursor: column=%d, cursorX=%d, visualpos=%d, pos=%d, len=%d\n",
+ buf->currentColumn, buf->cursorX, buf->visualpos, buf->pos,
+ buf->currentLine->len);
#endif
}
void
-arrangeLine(Buffer * buf)
+arrangeLine(Buffer *buf)
{
int i, cpos;
@@ -1047,14 +1063,15 @@ arrangeLine(Buffer * buf)
buf->pos = 0;
}
#ifdef DISPLAY_DEBUG
- fprintf(stderr, "arrangeLine: column=%d, cursorX=%d, visualpos=%d, pos=%d, len=%d\n",
- buf->currentColumn, buf->cursorX, buf->visualpos,
- buf->pos, buf->currentLine->len);
+ fprintf(stderr,
+ "arrangeLine: column=%d, cursorX=%d, visualpos=%d, pos=%d, len=%d\n",
+ buf->currentColumn, buf->cursorX, buf->visualpos, buf->pos,
+ buf->currentLine->len);
#endif
}
void
-cursorXY(Buffer * buf, int x, int y)
+cursorXY(Buffer *buf, int x, int y)
{
int oldX;
@@ -1062,19 +1079,19 @@ cursorXY(Buffer * buf, int x, int y)
if (buf->cursorX > x) {
while (buf->cursorX > x)
- cursorLeft(buf, buf->COLS / 2);
+ cursorLeft(buf, buf->COLS / 2);
}
else if (buf->cursorX < x) {
while (buf->cursorX < x) {
oldX = buf->cursorX;
- cursorRight(buf, buf->COLS / 2);
+ cursorRight(buf, buf->COLS / 2);
if (oldX == buf->cursorX)
break;
}
if (buf->cursorX > x)
- cursorLeft(buf, buf->COLS / 2);
+ cursorLeft(buf, buf->COLS / 2);
}
}
diff --git a/entity.c b/entity.c
index bae695a..c6abfc5 100644
--- a/entity.c
+++ b/entity.c
@@ -1,4 +1,4 @@
-/* $Id: entity.c,v 1.2 2001/11/20 17:49:23 ukai Exp $ */
+/* $Id: entity.c,v 1.3 2001/11/24 02:01:26 ukai Exp $ */
#include "fm.h"
#include <stdio.h>
#include "indep.h"
@@ -13,17 +13,16 @@ typedef struct {
#ifdef JP_CHARSET
#include "ucs_eucjp.h"
-static char *latin1_eucjp_map[ 96 ] =
-{
- NBSP, "!", "¢", "£", "CUR","¥", "|", "§", /* 32- 39 */
- "¨", "(C)","-a", "≪", "¬", "-", "(R)"," ̄", /* 40- 47 */
- "°", "±", "^2", "^3", "'", "μ", "¶", "・", /* 48- 55 */
- ",", "^1", "-o", "≫", "1/4","1/2","3/4","?", /* 56- 63 */
- "A`", "A'", "A^", "A~", "A:", "Å", "AE","C,", /* 64- 71 */
- "E`", "E'", "E^", "E", "I`", "I'", "I^", "I:", /* 72- 79 */
+static char *latin1_eucjp_map[96] = {
+ NBSP, "!", "¢", "£", "CUR", "¥", "|", "§", /* 32- 39 */
+ "¨", "(C)", "-a", "≪", "¬", "-", "(R)", " ̄", /* 40- 47 */
+ "°", "±", "^2", "^3", "'", "μ", "¶", "・", /* 48- 55 */
+ ",", "^1", "-o", "≫", "1/4", "1/2", "3/4", "?", /* 56- 63 */
+ "A`", "A'", "A^", "A~", "A:", "Å", "AE", "C,", /* 64- 71 */
+ "E`", "E'", "E^", "E", "I`", "I'", "I^", "I:", /* 72- 79 */
"D-", "N~", "O`", "O'", "O^", "O~", "Oe", "×", /* 80- 87 */
"φ", "U`", "U'", "U^", "U:", "Y'", "th", "ss", /* 88- 95 */
- "a`", "a'", "a^", "a~", "a:", "a", "ae", "c", /* 96-103 */
+ "a`", "a'", "a^", "a~", "a:", "a", "ae", "c", /* 96-103 */
"e`", "e'", "e^", "e:", "i`", "i'", "i^", "i:", /* 104-111 */
"d-", "n~", "o`", "o'", "o^", "o~", "oe", "÷", /* 112-119 */
"φ", "u`", "u'", "u^", "u:", "y'", "th", "y:" /* 120-127 */
@@ -37,35 +36,34 @@ static char *latin1_eucjp_map[ 96 ] =
*
* Following character constants are in code page 850.
*/
-static char *latin1_cp850_map[ 96 ] = {
- NBSP, "\255", "\275", "\234", "\317", "\276", "\335", "\365",
- "\371", "\270", "\246", "\256", "\252", "\360", "\251", "\356",
- "\370", "\361", "\375", "\374", "\357", "\346", "\364", "\372",
- "\367", "\373", "\247", "\257", "\254", "\253", "\363", "\250",
- "\267", "\265", "\266", "\307", "\216", "\217", "\222", "\200",
- "\324", "\220", "\322", "\323", "\336", "\326", "\327", "\330",
- "\321", "\245", "\343", "\340", "\342", "\345", "\231", "\236",
- "\235", "\353", "\351", "\352", "\232", "\355", "\350", "\341",
- "\205", "\240", "\203", "\306", "\204", "\206", "\221", "\207",
- "\212", "\202", "\210", "\211", "\215", "\241", "\214", "\213",
- "\320", "\244", "\225", "\242", "\223", "\344", "\224", "\366",
- "\233", "\227", "\243", "\226", "\201", "\354", "\347", "\230"
+static char *latin1_cp850_map[96] = {
+ NBSP, "\255", "\275", "\234", "\317", "\276", "\335", "\365",
+ "\371", "\270", "\246", "\256", "\252", "\360", "\251", "\356",
+ "\370", "\361", "\375", "\374", "\357", "\346", "\364", "\372",
+ "\367", "\373", "\247", "\257", "\254", "\253", "\363", "\250",
+ "\267", "\265", "\266", "\307", "\216", "\217", "\222", "\200",
+ "\324", "\220", "\322", "\323", "\336", "\326", "\327", "\330",
+ "\321", "\245", "\343", "\340", "\342", "\345", "\231", "\236",
+ "\235", "\353", "\351", "\352", "\232", "\355", "\350", "\341",
+ "\205", "\240", "\203", "\306", "\204", "\206", "\221", "\207",
+ "\212", "\202", "\210", "\211", "\215", "\241", "\214", "\213",
+ "\320", "\244", "\225", "\242", "\223", "\344", "\224", "\366",
+ "\233", "\227", "\243", "\226", "\201", "\354", "\347", "\230"
};
#endif
#endif
#include "ucs_latin1.h"
-static char *latin1_ascii_map[ 96 ] =
-{
- NBSP, "!", "-c-","-L-","CUR","=Y=","|", "S:", /* 32- 39 */
- "\"", "(C)","-a", "<<", "NOT","-", "(R)"," ̄", /* 40- 47 */
- "DEG","+-", "^2", "^3", "'", "u", "P:", ".", /* 48- 55 */
- ",", "^1", "-o", ">>", "1/4","1/2","3/4","?", /* 56- 63 */
+static char *latin1_ascii_map[96] = {
+ NBSP, "!", "-c-", "-L-", "CUR", "=Y=", "|", "S:", /* 32- 39 */
+ "\"", "(C)", "-a", "<<", "NOT", "-", "(R)", " ̄", /* 40- 47 */
+ "DEG", "+-", "^2", "^3", "'", "u", "P:", ".", /* 48- 55 */
+ ",", "^1", "-o", ">>", "1/4", "1/2", "3/4", "?", /* 56- 63 */
"A`", "A'", "A^", "A~", "A:", "AA", "AE", "C,", /* 64- 71 */
- "E`", "E'", "E^", "E", "I`", "I'", "I^", "I:", /* 72- 79 */
+ "E`", "E'", "E^", "E", "I`", "I'", "I^", "I:", /* 72- 79 */
"D-", "N~", "O`", "O'", "O^", "O~", "Oe", "x", /* 80- 87 */
"O/", "U`", "U'", "U^", "U:", "Y'", "th", "ss", /* 88- 95 */
- "a`", "a'", "a^", "a~", "a:", "a", "ae", "c", /* 96-103 */
+ "a`", "a'", "a^", "a~", "a:", "a", "ae", "c", /* 96-103 */
"e`", "e'", "e^", "e:", "i`", "i'", "i^", "i:", /* 104-111 */
"d-", "n~", "o`", "o'", "o^", "o~", "oe", "-:", /* 112-119 */
"o/", "u`", "u'", "u^", "u:", "y'", "th", "y:" /* 120-127 */
@@ -76,23 +74,23 @@ char UseAltEntity = FALSE;
static int
map_cmp(const void *a, const void *b)
{
- return *(int *)a - ((entity_map *)b)->ucs;
+ return *(int *)a - ((entity_map *) b)->ucs;
}
static char *
-map_search(int c, entity_map *map, size_t n)
+map_search(int c, entity_map * map, size_t n)
{
entity_map *m;
- m = (entity_map *)bsearch((void *)&c, (void *)map, n,
- sizeof(entity_map), map_cmp);
+ m = (entity_map *) bsearch((void *)&c, (void *)map, n,
+ sizeof(entity_map), map_cmp);
return m ? m->ptr : NULL;
}
char *
conv_entity(int c)
{
- static char buf[] = {0, 0};
+ static char buf[] = { 0, 0 };
char *p;
if (c < 0) /* error */
@@ -119,16 +117,16 @@ conv_entity(int c)
return buf;
#endif
}
- /* Unicode */
+ /* Unicode */
#ifdef JP_CHARSET
- if (! UseAltEntity) {
+ if (!UseAltEntity) {
p = map_search(c, ucs_eucjp_map,
- sizeof(ucs_eucjp_map) / sizeof(entity_map));
+ sizeof(ucs_eucjp_map) / sizeof(entity_map));
return p ? p : "?";
}
#endif
p = map_search(c, ucs_latin1_map,
- sizeof(ucs_latin1_map) / sizeof(entity_map));
+ sizeof(ucs_latin1_map) / sizeof(entity_map));
if (p && *p & 0x80) /* ISO-8859-1 */
return conv_entity((int)(*p & 0xff));
return p ? p : "?";
diff --git a/entity.h b/entity.h
index 95d7af3..2c15b3a 100644
--- a/entity.h
+++ b/entity.h
@@ -1,366 +1,366 @@
-/* $Id: entity.h,v 1.2 2001/11/20 17:49:23 ukai Exp $ */
+/* $Id: entity.h,v 1.3 2001/11/24 02:01:26 ukai Exp $ */
#include "hash.h"
static HashItem_si MyHashItem[] = {
- /* 0 */ {"otimes",0x2297,&MyHashItem[1]},
- /* 1 */ {"laquo",0xAB,NULL},
- /* 2 */ {"cap",0x2229,&MyHashItem[3]},
- /* 3 */ {"dArr",0x21D3,&MyHashItem[4]},
- /* 4 */ {"euml",0xEB,NULL},
- /* 5 */ {"sum",0x2211,&MyHashItem[6]},
- /* 6 */ {"Ocirc",0xD4,NULL},
- /* 7 */ {"dagger",0x2020,&MyHashItem[8]},
- /* 8 */ {"Scaron",0x0160,&MyHashItem[9]},
- /* 9 */ {"Omicron",0x039F,&MyHashItem[10]},
- /* 10 */ {"brvbar",0xA6,NULL},
- /* 11 */ {"Eta",0x0397,&MyHashItem[12]},
- /* 12 */ {"iacute",0xED,&MyHashItem[13]},
- /* 13 */ {"aelig",0xE6,&MyHashItem[14]},
- /* 14 */ {"Ugrave",0xD9,&MyHashItem[15]},
- /* 15 */ {"deg",0xB0,NULL},
- /* 16 */ {"Yuml",0x0178,&MyHashItem[17]},
- /* 17 */ {"sup",0x2283,&MyHashItem[18]},
- /* 18 */ {"middot",0xB7,NULL},
- /* 19 */ {"ge",0x2265,&MyHashItem[20]},
- /* 20 */ {"alefsym",0x2135,&MyHashItem[21]},
- /* 21 */ {"sigma",0x03C3,&MyHashItem[22]},
- /* 22 */ {"aring",0xE5,&MyHashItem[23]},
- /* 23 */ {"Icirc",0xCE,NULL},
- /* 24 */ {"and",0x2227,&MyHashItem[25]},
- /* 25 */ {"weierp",0x2118,&MyHashItem[26]},
- /* 26 */ {"frac12",0xBD,NULL},
- /* 27 */ {"radic",0x221A,&MyHashItem[28]},
- /* 28 */ {"chi",0x03C7,&MyHashItem[29]},
- /* 29 */ {"zeta",0x03B6,&MyHashItem[30]},
- /* 30 */ {"Theta",0x0398,&MyHashItem[31]},
- /* 31 */ {"Atilde",0xC3,&MyHashItem[32]},
- /* 32 */ {"para",0xB6,NULL},
- /* 33 */ {"frac14",0xBC,&MyHashItem[34]},
- /* 34 */ {"cedil",0xB8,&MyHashItem[35]},
- /* 35 */ {"quot",0x22,NULL},
- /* 36 */ {"ang",0x2220,&MyHashItem[37]},
- /* 37 */ {"ucirc",0xFB,NULL},
- /* 38 */ {"supe",0x2287,&MyHashItem[39]},
- /* 39 */ {"iota",0x03B9,&MyHashItem[40]},
- /* 40 */ {"Ograve",0xD2,NULL},
- /* 41 */ {"rArr",0x21D2,&MyHashItem[42]},
- /* 42 */ {"Auml",0xC4,&MyHashItem[43]},
- /* 43 */ {"frac34",0xBE,&MyHashItem[44]},
- /* 44 */ {"nbsp",0xA0,NULL},
- /* 45 */ {"euro",0x20AC,&MyHashItem[46]},
- /* 46 */ {"ocirc",0xF4,NULL},
- /* 47 */ {"equiv",0x2261,&MyHashItem[48]},
- /* 48 */ {"upsilon",0x03C5,&MyHashItem[49]},
- /* 49 */ {"sigmaf",0x03C2,&MyHashItem[50]},
- /* 50 */ {"ETH",0xD0,NULL},
- /* 51 */ {"le",0x2264,&MyHashItem[52]},
- /* 52 */ {"beta",0x03B2,&MyHashItem[53]},
- /* 53 */ {"yacute",0xFD,&MyHashItem[54]},
- /* 54 */ {"egrave",0xE8,NULL},
- /* 55 */ {"lowast",0x2217,&MyHashItem[56]},
- /* 56 */ {"real",0x211C,&MyHashItem[57]},
- /* 57 */ {"amp",0x26,NULL},
- /* 58 */ {"icirc",0xEE,&MyHashItem[59]},
- /* 59 */ {"micro",0xB5,NULL},
- /* 60 */ {"isin",0x2208,&MyHashItem[61]},
- /* 61 */ {"curren",0xA4,NULL},
- /* 62 */ {"rdquo",0x201D,&MyHashItem[63]},
- /* 63 */ {"sbquo",0x201A,&MyHashItem[64]},
- /* 64 */ {"ne",0x2260,&MyHashItem[65]},
- /* 65 */ {"theta",0x03B8,&MyHashItem[66]},
- /* 66 */ {"Igrave",0xCC,NULL},
- /* 67 */ {"gt",0x3E,NULL},
- /* 68 */ {"hearts",0x2665,&MyHashItem[69]},
- /* 69 */ {"rang",0x232A,NULL},
- /* 70 */ {"rfloor",0x230B,NULL},
- /* 71 */ {"ldquo",0x201C,&MyHashItem[72]},
- /* 72 */ {"ni",0x220B,&MyHashItem[73]},
- /* 73 */ {"Ntilde",0xD1,&MyHashItem[74]},
- /* 74 */ {"Aacute",0xC1,NULL},
- /* 75 */ {"crarr",0x21B5,&MyHashItem[76]},
- /* 76 */ {"Ouml",0xD6,&MyHashItem[77]},
- /* 77 */ {"GT",0x3E,NULL},
- /* 78 */ {"clubs",0x2663,NULL},
- /* 79 */ {"scaron",0x0161,&MyHashItem[80]},
- /* 80 */ {"part",0x2202,NULL},
- /* 81 */ {"tilde",0x02DC,&MyHashItem[82]},
- /* 82 */ {"oelig",0x0153,&MyHashItem[83]},
- /* 83 */ {"pi",0x03C0,&MyHashItem[84]},
- /* 84 */ {"ugrave",0xF9,NULL},
- /* 85 */ {"darr",0x2193,&MyHashItem[86]},
- /* 86 */ {"uuml",0xFC,&MyHashItem[87]},
- /* 87 */ {"QUOT",0x22,NULL},
- /* 88 */ {"Prime",0x2033,NULL},
- /* 89 */ {"zwj",0x200D,&MyHashItem[90]},
- /* 90 */ {"lfloor",0x230A,&MyHashItem[91]},
- /* 91 */ {"notin",0x2209,&MyHashItem[92]},
- /* 92 */ {"cent",0xA2,&MyHashItem[93]},
- /* 93 */ {"lt",0x3C,NULL},
- /* 94 */ {"eta",0x03B7,&MyHashItem[95]},
- /* 95 */ {"Phi",0x03A6,&MyHashItem[96]},
- /* 96 */ {"atilde",0xE3,NULL},
- /* 97 */ {"hArr",0x21D4,&MyHashItem[98]},
- /* 98 */ {"iuml",0xEF,&MyHashItem[99]},
- /* 99 */ {"NBSP",0xA0,NULL},
- /* 100 */ {"mu",0x03BC,NULL},
- /* 101 */ {"or",0x2228,&MyHashItem[102]},
- /* 102 */ {"plusmn",0xB1,&MyHashItem[103]},
- /* 103 */ {"LT",0x3C,NULL},
- /* 104 */ {"nu",0x03BD,&MyHashItem[105]},
- /* 105 */ {"ograve",0xF2,&MyHashItem[106]},
- /* 106 */ {"AElig",0xC6,NULL},
- /* 107 */ {"rceil",0x2309,&MyHashItem[108]},
- /* 108 */ {"uArr",0x21D1,&MyHashItem[109]},
- /* 109 */ {"sect",0xA7,NULL},
- /* 110 */ {"circ",0x02C6,NULL},
- /* 111 */ {"perp",0x22A5,&MyHashItem[112]},
- /* 112 */ {"eth",0xF0,NULL},
- /* 113 */ {"rsquo",0x2019,&MyHashItem[114]},
- /* 114 */ {"nabla",0x2207,NULL},
- /* 115 */ {"lceil",0x2308,&MyHashItem[116]},
- /* 116 */ {"cup",0x222A,&MyHashItem[117]},
- /* 117 */ {"exist",0x2203,&MyHashItem[118]},
- /* 118 */ {"rarr",0x2192,&MyHashItem[119]},
- /* 119 */ {"upsih",0x03D2,NULL},
- /* 120 */ {"prime",0x2032,&MyHashItem[121]},
- /* 121 */ {"Omega",0x03A9,&MyHashItem[122]},
- /* 122 */ {"Ecirc",0xCA,NULL},
- /* 123 */ {"Epsilon",0x0395,NULL},
- /* 124 */ {"lsquo",0x2018,&MyHashItem[125]},
- /* 125 */ {"xi",0x03BE,&MyHashItem[126]},
- /* 126 */ {"Lambda",0x039B,&MyHashItem[127]},
- /* 127 */ {"Kappa",0x039A,&MyHashItem[128]},
- /* 128 */ {"divide",0xF7,&MyHashItem[129]},
- /* 129 */ {"igrave",0xEC,&MyHashItem[130]},
- /* 130 */ {"acute",0xB4,NULL},
- /* 131 */ {"Euml",0xCB,&MyHashItem[132]},
- /* 132 */ {"ordf",0xAA,NULL},
- /* 133 */ {"image",0x2111,&MyHashItem[134]},
- /* 134 */ {"Tau",0x03A4,&MyHashItem[135]},
- /* 135 */ {"Rho",0x03A1,NULL},
- /* 136 */ {"ntilde",0xF1,&MyHashItem[137]},
- /* 137 */ {"aacute",0xE1,&MyHashItem[138]},
- /* 138 */ {"times",0xD7,NULL},
- /* 139 */ {"omicron",0x03BF,NULL},
- /* 140 */ {"oplus",0x2295,&MyHashItem[141]},
- /* 141 */ {"Zeta",0x0396,&MyHashItem[142]},
- /* 142 */ {"Eacute",0xC9,&MyHashItem[143]},
- /* 143 */ {"ordm",0xBA,NULL},
- /* 144 */ {"Oslash",0xD8,&MyHashItem[145]},
- /* 145 */ {"Ccedil",0xC7,&MyHashItem[146]},
- /* 146 */ {"iquest",0xBF,NULL},
- /* 147 */ {"omega",0x03C9,&MyHashItem[148]},
- /* 148 */ {"Psi",0x03A8,&MyHashItem[149]},
- /* 149 */ {"ecirc",0xEA,NULL},
- /* 150 */ {"int",0x222B,NULL},
- /* 151 */ {"trade",0x2122,&MyHashItem[152]},
- /* 152 */ {"kappa",0x03BA,&MyHashItem[153]},
- /* 153 */ {"Iota",0x0399,&MyHashItem[154]},
- /* 154 */ {"Delta",0x0394,&MyHashItem[155]},
- /* 155 */ {"Alpha",0x0391,&MyHashItem[156]},
- /* 156 */ {"Otilde",0xD5,NULL},
- /* 157 */ {"sdot",0x22C5,NULL},
- /* 158 */ {"cong",0x2245,NULL},
- /* 159 */ {"rsaquo",0x203A,&MyHashItem[160]},
- /* 160 */ {"OElig",0x0152,&MyHashItem[161]},
- /* 161 */ {"diams",0x2666,&MyHashItem[162]},
- /* 162 */ {"phi",0x03C6,&MyHashItem[163]},
- /* 163 */ {"Beta",0x0392,&MyHashItem[164]},
- /* 164 */ {"szlig",0xDF,&MyHashItem[165]},
- /* 165 */ {"sup1",0xB9,&MyHashItem[166]},
- /* 166 */ {"reg",0xAE,NULL},
- /* 167 */ {"harr",0x2194,&MyHashItem[168]},
- /* 168 */ {"hellip",0x2026,&MyHashItem[169]},
- /* 169 */ {"yuml",0xFF,&MyHashItem[170]},
- /* 170 */ {"sup2",0xB2,NULL},
- /* 171 */ {"Gamma",0x0393,&MyHashItem[172]},
- /* 172 */ {"sup3",0xB3,NULL},
- /* 173 */ {"forall",0x2200,NULL},
- /* 174 */ {"bdquo",0x201E,&MyHashItem[175]},
- /* 175 */ {"spades",0x2660,&MyHashItem[176]},
- /* 176 */ {"Pi",0x03A0,&MyHashItem[177]},
- /* 177 */ {"Uacute",0xDA,&MyHashItem[178]},
- /* 178 */ {"Agrave",0xC0,NULL},
- /* 179 */ {"permil",0x2030,&MyHashItem[180]},
- /* 180 */ {"mdash",0x2014,&MyHashItem[181]},
- /* 181 */ {"lArr",0x21D0,&MyHashItem[182]},
- /* 182 */ {"uarr",0x2191,NULL},
- /* 183 */ {"Upsilon",0x03A5,&MyHashItem[184]},
- /* 184 */ {"pound",0xA3,NULL},
- /* 185 */ {"lsaquo",0x2039,&MyHashItem[186]},
- /* 186 */ {"lrm",0x200E,&MyHashItem[187]},
- /* 187 */ {"lambda",0x03BB,&MyHashItem[188]},
- /* 188 */ {"delta",0x03B4,&MyHashItem[189]},
- /* 189 */ {"alpha",0x03B1,NULL},
- /* 190 */ {"frasl",0x2044,&MyHashItem[191]},
- /* 191 */ {"thorn",0xFE,&MyHashItem[192]},
- /* 192 */ {"auml",0xE4,NULL},
- /* 193 */ {"Mu",0x039C,NULL},
- /* 194 */ {"nsub",0x2284,&MyHashItem[195]},
- /* 195 */ {"macr",0xAF,NULL},
- /* 196 */ {"minus",0x2212,&MyHashItem[197]},
- /* 197 */ {"Nu",0x039D,&MyHashItem[198]},
- /* 198 */ {"Oacute",0xD3,NULL},
- /* 199 */ {"prod",0x220F,&MyHashItem[200]},
- /* 200 */ {"Uuml",0xDC,&MyHashItem[201]},
- /* 201 */ {"iexcl",0xA1,NULL},
- /* 202 */ {"lang",0x2329,&MyHashItem[203]},
- /* 203 */ {"tau",0x03C4,&MyHashItem[204]},
- /* 204 */ {"rho",0x03C1,&MyHashItem[205]},
- /* 205 */ {"gamma",0x03B3,NULL},
- /* 206 */ {"loz",0x25CA,&MyHashItem[207]},
- /* 207 */ {"bull",0x2022,&MyHashItem[208]},
- /* 208 */ {"piv",0x03D6,NULL},
- /* 209 */ {"eacute",0xE9,NULL},
- /* 210 */ {"zwnj",0x200C,&MyHashItem[211]},
- /* 211 */ {"oslash",0xF8,&MyHashItem[212]},
- /* 212 */ {"ccedil",0xE7,&MyHashItem[213]},
- /* 213 */ {"THORN",0xDE,&MyHashItem[214]},
- /* 214 */ {"Iuml",0xCF,&MyHashItem[215]},
- /* 215 */ {"not",0xAC,NULL},
- /* 216 */ {"sim",0x223C,&MyHashItem[217]},
- /* 217 */ {"thetasym",0x03D1,&MyHashItem[218]},
- /* 218 */ {"Acirc",0xC2,NULL},
- /* 219 */ {"Dagger",0x2021,&MyHashItem[220]},
- /* 220 */ {"fnof",0x0192,NULL},
- /* 221 */ {"rlm",0x200F,&MyHashItem[222]},
- /* 222 */ {"oline",0x203E,&MyHashItem[223]},
- /* 223 */ {"Chi",0x03A7,&MyHashItem[224]},
- /* 224 */ {"Xi",0x039E,&MyHashItem[225]},
- /* 225 */ {"otilde",0xF5,&MyHashItem[226]},
- /* 226 */ {"Iacute",0xCD,&MyHashItem[227]},
- /* 227 */ {"copy",0xA9,NULL},
- /* 228 */ {"ndash",0x2013,&MyHashItem[229]},
- /* 229 */ {"ouml",0xF6,NULL},
- /* 230 */ {"psi",0x03C8,NULL},
- /* 231 */ {"sube",0x2286,NULL},
- /* 232 */ {"emsp",0x2003,&MyHashItem[233]},
- /* 233 */ {"asymp",0x2248,&MyHashItem[234]},
- /* 234 */ {"prop",0x221D,NULL},
- /* 235 */ {"infin",0x221E,NULL},
- /* 236 */ {"empty",0x2205,&MyHashItem[237]},
- /* 237 */ {"uacute",0xFA,&MyHashItem[238]},
- /* 238 */ {"agrave",0xE0,&MyHashItem[239]},
- /* 239 */ {"shy",0xAD,NULL},
- /* 240 */ {"ensp",0x2002,NULL},
- /* 241 */ {"acirc",0xE2,NULL},
- /* 242 */ {"sub",0x2282,&MyHashItem[243]},
- /* 243 */ {"epsilon",0x03B5,NULL},
- /* 244 */ {"Yacute",0xDD,&MyHashItem[245]},
- /* 245 */ {"Egrave",0xC8,NULL},
- /* 246 */ {"there4",0x2234,&MyHashItem[247]},
- /* 247 */ {"larr",0x2190,&MyHashItem[248]},
- /* 248 */ {"uml",0xA8,&MyHashItem[249]},
- /* 249 */ {"AMP",0x26,NULL},
- /* 250 */ {"Sigma",0x03A3,&MyHashItem[251]},
- /* 251 */ {"Aring",0xC5,NULL},
- /* 252 */ {"yen",0xA5,NULL},
- /* 253 */ {"oacute",0xF3,&MyHashItem[254]},
- /* 254 */ {"raquo",0xBB,NULL},
- /* 255 */ {"thinsp",0x2009,NULL},
- /* 256 */ {"Ucirc",0xDB,NULL},
+ /* 0 */ {"otimes", 0x2297, &MyHashItem[1]},
+ /* 1 */ {"laquo", 0xAB, NULL},
+ /* 2 */ {"cap", 0x2229, &MyHashItem[3]},
+ /* 3 */ {"dArr", 0x21D3, &MyHashItem[4]},
+ /* 4 */ {"euml", 0xEB, NULL},
+ /* 5 */ {"sum", 0x2211, &MyHashItem[6]},
+ /* 6 */ {"Ocirc", 0xD4, NULL},
+ /* 7 */ {"dagger", 0x2020, &MyHashItem[8]},
+ /* 8 */ {"Scaron", 0x0160, &MyHashItem[9]},
+ /* 9 */ {"Omicron", 0x039F, &MyHashItem[10]},
+ /* 10 */ {"brvbar", 0xA6, NULL},
+ /* 11 */ {"Eta", 0x0397, &MyHashItem[12]},
+ /* 12 */ {"iacute", 0xED, &MyHashItem[13]},
+ /* 13 */ {"aelig", 0xE6, &MyHashItem[14]},
+ /* 14 */ {"Ugrave", 0xD9, &MyHashItem[15]},
+ /* 15 */ {"deg", 0xB0, NULL},
+ /* 16 */ {"Yuml", 0x0178, &MyHashItem[17]},
+ /* 17 */ {"sup", 0x2283, &MyHashItem[18]},
+ /* 18 */ {"middot", 0xB7, NULL},
+ /* 19 */ {"ge", 0x2265, &MyHashItem[20]},
+ /* 20 */ {"alefsym", 0x2135, &MyHashItem[21]},
+ /* 21 */ {"sigma", 0x03C3, &MyHashItem[22]},
+ /* 22 */ {"aring", 0xE5, &MyHashItem[23]},
+ /* 23 */ {"Icirc", 0xCE, NULL},
+ /* 24 */ {"and", 0x2227, &MyHashItem[25]},
+ /* 25 */ {"weierp", 0x2118, &MyHashItem[26]},
+ /* 26 */ {"frac12", 0xBD, NULL},
+ /* 27 */ {"radic", 0x221A, &MyHashItem[28]},
+ /* 28 */ {"chi", 0x03C7, &MyHashItem[29]},
+ /* 29 */ {"zeta", 0x03B6, &MyHashItem[30]},
+ /* 30 */ {"Theta", 0x0398, &MyHashItem[31]},
+ /* 31 */ {"Atilde", 0xC3, &MyHashItem[32]},
+ /* 32 */ {"para", 0xB6, NULL},
+ /* 33 */ {"frac14", 0xBC, &MyHashItem[34]},
+ /* 34 */ {"cedil", 0xB8, &MyHashItem[35]},
+ /* 35 */ {"quot", 0x22, NULL},
+ /* 36 */ {"ang", 0x2220, &MyHashItem[37]},
+ /* 37 */ {"ucirc", 0xFB, NULL},
+ /* 38 */ {"supe", 0x2287, &MyHashItem[39]},
+ /* 39 */ {"iota", 0x03B9, &MyHashItem[40]},
+ /* 40 */ {"Ograve", 0xD2, NULL},
+ /* 41 */ {"rArr", 0x21D2, &MyHashItem[42]},
+ /* 42 */ {"Auml", 0xC4, &MyHashItem[43]},
+ /* 43 */ {"frac34", 0xBE, &MyHashItem[44]},
+ /* 44 */ {"nbsp", 0xA0, NULL},
+ /* 45 */ {"euro", 0x20AC, &MyHashItem[46]},
+ /* 46 */ {"ocirc", 0xF4, NULL},
+ /* 47 */ {"equiv", 0x2261, &MyHashItem[48]},
+ /* 48 */ {"upsilon", 0x03C5, &MyHashItem[49]},
+ /* 49 */ {"sigmaf", 0x03C2, &MyHashItem[50]},
+ /* 50 */ {"ETH", 0xD0, NULL},
+ /* 51 */ {"le", 0x2264, &MyHashItem[52]},
+ /* 52 */ {"beta", 0x03B2, &MyHashItem[53]},
+ /* 53 */ {"yacute", 0xFD, &MyHashItem[54]},
+ /* 54 */ {"egrave", 0xE8, NULL},
+ /* 55 */ {"lowast", 0x2217, &MyHashItem[56]},
+ /* 56 */ {"real", 0x211C, &MyHashItem[57]},
+ /* 57 */ {"amp", 0x26, NULL},
+ /* 58 */ {"icirc", 0xEE, &MyHashItem[59]},
+ /* 59 */ {"micro", 0xB5, NULL},
+ /* 60 */ {"isin", 0x2208, &MyHashItem[61]},
+ /* 61 */ {"curren", 0xA4, NULL},
+ /* 62 */ {"rdquo", 0x201D, &MyHashItem[63]},
+ /* 63 */ {"sbquo", 0x201A, &MyHashItem[64]},
+ /* 64 */ {"ne", 0x2260, &MyHashItem[65]},
+ /* 65 */ {"theta", 0x03B8, &MyHashItem[66]},
+ /* 66 */ {"Igrave", 0xCC, NULL},
+ /* 67 */ {"gt", 0x3E, NULL},
+ /* 68 */ {"hearts", 0x2665, &MyHashItem[69]},
+ /* 69 */ {"rang", 0x232A, NULL},
+ /* 70 */ {"rfloor", 0x230B, NULL},
+ /* 71 */ {"ldquo", 0x201C, &MyHashItem[72]},
+ /* 72 */ {"ni", 0x220B, &MyHashItem[73]},
+ /* 73 */ {"Ntilde", 0xD1, &MyHashItem[74]},
+ /* 74 */ {"Aacute", 0xC1, NULL},
+ /* 75 */ {"crarr", 0x21B5, &MyHashItem[76]},
+ /* 76 */ {"Ouml", 0xD6, &MyHashItem[77]},
+ /* 77 */ {"GT", 0x3E, NULL},
+ /* 78 */ {"clubs", 0x2663, NULL},
+ /* 79 */ {"scaron", 0x0161, &MyHashItem[80]},
+ /* 80 */ {"part", 0x2202, NULL},
+ /* 81 */ {"tilde", 0x02DC, &MyHashItem[82]},
+ /* 82 */ {"oelig", 0x0153, &MyHashItem[83]},
+ /* 83 */ {"pi", 0x03C0, &MyHashItem[84]},
+ /* 84 */ {"ugrave", 0xF9, NULL},
+ /* 85 */ {"darr", 0x2193, &MyHashItem[86]},
+ /* 86 */ {"uuml", 0xFC, &MyHashItem[87]},
+ /* 87 */ {"QUOT", 0x22, NULL},
+ /* 88 */ {"Prime", 0x2033, NULL},
+ /* 89 */ {"zwj", 0x200D, &MyHashItem[90]},
+ /* 90 */ {"lfloor", 0x230A, &MyHashItem[91]},
+ /* 91 */ {"notin", 0x2209, &MyHashItem[92]},
+ /* 92 */ {"cent", 0xA2, &MyHashItem[93]},
+ /* 93 */ {"lt", 0x3C, NULL},
+ /* 94 */ {"eta", 0x03B7, &MyHashItem[95]},
+ /* 95 */ {"Phi", 0x03A6, &MyHashItem[96]},
+ /* 96 */ {"atilde", 0xE3, NULL},
+ /* 97 */ {"hArr", 0x21D4, &MyHashItem[98]},
+ /* 98 */ {"iuml", 0xEF, &MyHashItem[99]},
+ /* 99 */ {"NBSP", 0xA0, NULL},
+ /* 100 */ {"mu", 0x03BC, NULL},
+ /* 101 */ {"or", 0x2228, &MyHashItem[102]},
+ /* 102 */ {"plusmn", 0xB1, &MyHashItem[103]},
+ /* 103 */ {"LT", 0x3C, NULL},
+ /* 104 */ {"nu", 0x03BD, &MyHashItem[105]},
+ /* 105 */ {"ograve", 0xF2, &MyHashItem[106]},
+ /* 106 */ {"AElig", 0xC6, NULL},
+ /* 107 */ {"rceil", 0x2309, &MyHashItem[108]},
+ /* 108 */ {"uArr", 0x21D1, &MyHashItem[109]},
+ /* 109 */ {"sect", 0xA7, NULL},
+ /* 110 */ {"circ", 0x02C6, NULL},
+ /* 111 */ {"perp", 0x22A5, &MyHashItem[112]},
+ /* 112 */ {"eth", 0xF0, NULL},
+ /* 113 */ {"rsquo", 0x2019, &MyHashItem[114]},
+ /* 114 */ {"nabla", 0x2207, NULL},
+ /* 115 */ {"lceil", 0x2308, &MyHashItem[116]},
+ /* 116 */ {"cup", 0x222A, &MyHashItem[117]},
+ /* 117 */ {"exist", 0x2203, &MyHashItem[118]},
+ /* 118 */ {"rarr", 0x2192, &MyHashItem[119]},
+ /* 119 */ {"upsih", 0x03D2, NULL},
+ /* 120 */ {"prime", 0x2032, &MyHashItem[121]},
+ /* 121 */ {"Omega", 0x03A9, &MyHashItem[122]},
+ /* 122 */ {"Ecirc", 0xCA, NULL},
+ /* 123 */ {"Epsilon", 0x0395, NULL},
+ /* 124 */ {"lsquo", 0x2018, &MyHashItem[125]},
+ /* 125 */ {"xi", 0x03BE, &MyHashItem[126]},
+ /* 126 */ {"Lambda", 0x039B, &MyHashItem[127]},
+ /* 127 */ {"Kappa", 0x039A, &MyHashItem[128]},
+ /* 128 */ {"divide", 0xF7, &MyHashItem[129]},
+ /* 129 */ {"igrave", 0xEC, &MyHashItem[130]},
+ /* 130 */ {"acute", 0xB4, NULL},
+ /* 131 */ {"Euml", 0xCB, &MyHashItem[132]},
+ /* 132 */ {"ordf", 0xAA, NULL},
+ /* 133 */ {"image", 0x2111, &MyHashItem[134]},
+ /* 134 */ {"Tau", 0x03A4, &MyHashItem[135]},
+ /* 135 */ {"Rho", 0x03A1, NULL},
+ /* 136 */ {"ntilde", 0xF1, &MyHashItem[137]},
+ /* 137 */ {"aacute", 0xE1, &MyHashItem[138]},
+ /* 138 */ {"times", 0xD7, NULL},
+ /* 139 */ {"omicron", 0x03BF, NULL},
+ /* 140 */ {"oplus", 0x2295, &MyHashItem[141]},
+ /* 141 */ {"Zeta", 0x0396, &MyHashItem[142]},
+ /* 142 */ {"Eacute", 0xC9, &MyHashItem[143]},
+ /* 143 */ {"ordm", 0xBA, NULL},
+ /* 144 */ {"Oslash", 0xD8, &MyHashItem[145]},
+ /* 145 */ {"Ccedil", 0xC7, &MyHashItem[146]},
+ /* 146 */ {"iquest", 0xBF, NULL},
+ /* 147 */ {"omega", 0x03C9, &MyHashItem[148]},
+ /* 148 */ {"Psi", 0x03A8, &MyHashItem[149]},
+ /* 149 */ {"ecirc", 0xEA, NULL},
+ /* 150 */ {"int", 0x222B, NULL},
+ /* 151 */ {"trade", 0x2122, &MyHashItem[152]},
+ /* 152 */ {"kappa", 0x03BA, &MyHashItem[153]},
+ /* 153 */ {"Iota", 0x0399, &MyHashItem[154]},
+ /* 154 */ {"Delta", 0x0394, &MyHashItem[155]},
+ /* 155 */ {"Alpha", 0x0391, &MyHashItem[156]},
+ /* 156 */ {"Otilde", 0xD5, NULL},
+ /* 157 */ {"sdot", 0x22C5, NULL},
+ /* 158 */ {"cong", 0x2245, NULL},
+ /* 159 */ {"rsaquo", 0x203A, &MyHashItem[160]},
+ /* 160 */ {"OElig", 0x0152, &MyHashItem[161]},
+ /* 161 */ {"diams", 0x2666, &MyHashItem[162]},
+ /* 162 */ {"phi", 0x03C6, &MyHashItem[163]},
+ /* 163 */ {"Beta", 0x0392, &MyHashItem[164]},
+ /* 164 */ {"szlig", 0xDF, &MyHashItem[165]},
+ /* 165 */ {"sup1", 0xB9, &MyHashItem[166]},
+ /* 166 */ {"reg", 0xAE, NULL},
+ /* 167 */ {"harr", 0x2194, &MyHashItem[168]},
+ /* 168 */ {"hellip", 0x2026, &MyHashItem[169]},
+ /* 169 */ {"yuml", 0xFF, &MyHashItem[170]},
+ /* 170 */ {"sup2", 0xB2, NULL},
+ /* 171 */ {"Gamma", 0x0393, &MyHashItem[172]},
+ /* 172 */ {"sup3", 0xB3, NULL},
+ /* 173 */ {"forall", 0x2200, NULL},
+ /* 174 */ {"bdquo", 0x201E, &MyHashItem[175]},
+ /* 175 */ {"spades", 0x2660, &MyHashItem[176]},
+ /* 176 */ {"Pi", 0x03A0, &MyHashItem[177]},
+ /* 177 */ {"Uacute", 0xDA, &MyHashItem[178]},
+ /* 178 */ {"Agrave", 0xC0, NULL},
+ /* 179 */ {"permil", 0x2030, &MyHashItem[180]},
+ /* 180 */ {"mdash", 0x2014, &MyHashItem[181]},
+ /* 181 */ {"lArr", 0x21D0, &MyHashItem[182]},
+ /* 182 */ {"uarr", 0x2191, NULL},
+ /* 183 */ {"Upsilon", 0x03A5, &MyHashItem[184]},
+ /* 184 */ {"pound", 0xA3, NULL},
+ /* 185 */ {"lsaquo", 0x2039, &MyHashItem[186]},
+ /* 186 */ {"lrm", 0x200E, &MyHashItem[187]},
+ /* 187 */ {"lambda", 0x03BB, &MyHashItem[188]},
+ /* 188 */ {"delta", 0x03B4, &MyHashItem[189]},
+ /* 189 */ {"alpha", 0x03B1, NULL},
+ /* 190 */ {"frasl", 0x2044, &MyHashItem[191]},
+ /* 191 */ {"thorn", 0xFE, &MyHashItem[192]},
+ /* 192 */ {"auml", 0xE4, NULL},
+ /* 193 */ {"Mu", 0x039C, NULL},
+ /* 194 */ {"nsub", 0x2284, &MyHashItem[195]},
+ /* 195 */ {"macr", 0xAF, NULL},
+ /* 196 */ {"minus", 0x2212, &MyHashItem[197]},
+ /* 197 */ {"Nu", 0x039D, &MyHashItem[198]},
+ /* 198 */ {"Oacute", 0xD3, NULL},
+ /* 199 */ {"prod", 0x220F, &MyHashItem[200]},
+ /* 200 */ {"Uuml", 0xDC, &MyHashItem[201]},
+ /* 201 */ {"iexcl", 0xA1, NULL},
+ /* 202 */ {"lang", 0x2329, &MyHashItem[203]},
+ /* 203 */ {"tau", 0x03C4, &MyHashItem[204]},
+ /* 204 */ {"rho", 0x03C1, &MyHashItem[205]},
+ /* 205 */ {"gamma", 0x03B3, NULL},
+ /* 206 */ {"loz", 0x25CA, &MyHashItem[207]},
+ /* 207 */ {"bull", 0x2022, &MyHashItem[208]},
+ /* 208 */ {"piv", 0x03D6, NULL},
+ /* 209 */ {"eacute", 0xE9, NULL},
+ /* 210 */ {"zwnj", 0x200C, &MyHashItem[211]},
+ /* 211 */ {"oslash", 0xF8, &MyHashItem[212]},
+ /* 212 */ {"ccedil", 0xE7, &MyHashItem[213]},
+ /* 213 */ {"THORN", 0xDE, &MyHashItem[214]},
+ /* 214 */ {"Iuml", 0xCF, &MyHashItem[215]},
+ /* 215 */ {"not", 0xAC, NULL},
+ /* 216 */ {"sim", 0x223C, &MyHashItem[217]},
+ /* 217 */ {"thetasym", 0x03D1, &MyHashItem[218]},
+ /* 218 */ {"Acirc", 0xC2, NULL},
+ /* 219 */ {"Dagger", 0x2021, &MyHashItem[220]},
+ /* 220 */ {"fnof", 0x0192, NULL},
+ /* 221 */ {"rlm", 0x200F, &MyHashItem[222]},
+ /* 222 */ {"oline", 0x203E, &MyHashItem[223]},
+ /* 223 */ {"Chi", 0x03A7, &MyHashItem[224]},
+ /* 224 */ {"Xi", 0x039E, &MyHashItem[225]},
+ /* 225 */ {"otilde", 0xF5, &MyHashItem[226]},
+ /* 226 */ {"Iacute", 0xCD, &MyHashItem[227]},
+ /* 227 */ {"copy", 0xA9, NULL},
+ /* 228 */ {"ndash", 0x2013, &MyHashItem[229]},
+ /* 229 */ {"ouml", 0xF6, NULL},
+ /* 230 */ {"psi", 0x03C8, NULL},
+ /* 231 */ {"sube", 0x2286, NULL},
+ /* 232 */ {"emsp", 0x2003, &MyHashItem[233]},
+ /* 233 */ {"asymp", 0x2248, &MyHashItem[234]},
+ /* 234 */ {"prop", 0x221D, NULL},
+ /* 235 */ {"infin", 0x221E, NULL},
+ /* 236 */ {"empty", 0x2205, &MyHashItem[237]},
+ /* 237 */ {"uacute", 0xFA, &MyHashItem[238]},
+ /* 238 */ {"agrave", 0xE0, &MyHashItem[239]},
+ /* 239 */ {"shy", 0xAD, NULL},
+ /* 240 */ {"ensp", 0x2002, NULL},
+ /* 241 */ {"acirc", 0xE2, NULL},
+ /* 242 */ {"sub", 0x2282, &MyHashItem[243]},
+ /* 243 */ {"epsilon", 0x03B5, NULL},
+ /* 244 */ {"Yacute", 0xDD, &MyHashItem[245]},
+ /* 245 */ {"Egrave", 0xC8, NULL},
+ /* 246 */ {"there4", 0x2234, &MyHashItem[247]},
+ /* 247 */ {"larr", 0x2190, &MyHashItem[248]},
+ /* 248 */ {"uml", 0xA8, &MyHashItem[249]},
+ /* 249 */ {"AMP", 0x26, NULL},
+ /* 250 */ {"Sigma", 0x03A3, &MyHashItem[251]},
+ /* 251 */ {"Aring", 0xC5, NULL},
+ /* 252 */ {"yen", 0xA5, NULL},
+ /* 253 */ {"oacute", 0xF3, &MyHashItem[254]},
+ /* 254 */ {"raquo", 0xBB, NULL},
+ /* 255 */ {"thinsp", 0x2009, NULL},
+ /* 256 */ {"Ucirc", 0xDB, NULL},
};
static HashItem_si *MyHashItemTbl[] = {
- NULL,
- &MyHashItem[0],
- &MyHashItem[2],
- &MyHashItem[5],
- &MyHashItem[7],
- &MyHashItem[11],
- &MyHashItem[16],
- &MyHashItem[19],
- &MyHashItem[24],
- &MyHashItem[27],
- &MyHashItem[33],
- &MyHashItem[36],
- NULL,
- &MyHashItem[38],
- &MyHashItem[41],
- &MyHashItem[45],
- &MyHashItem[47],
- &MyHashItem[51],
- &MyHashItem[55],
- &MyHashItem[58],
- &MyHashItem[60],
- &MyHashItem[62],
- &MyHashItem[67],
- &MyHashItem[68],
- &MyHashItem[70],
- &MyHashItem[71],
- &MyHashItem[75],
- &MyHashItem[78],
- &MyHashItem[79],
- &MyHashItem[81],
- &MyHashItem[85],
- &MyHashItem[88],
- &MyHashItem[89],
- &MyHashItem[94],
- &MyHashItem[97],
- &MyHashItem[100],
- &MyHashItem[101],
- &MyHashItem[104],
- &MyHashItem[107],
- &MyHashItem[110],
- &MyHashItem[111],
- &MyHashItem[113],
- &MyHashItem[115],
- &MyHashItem[120],
- &MyHashItem[123],
- &MyHashItem[124],
- &MyHashItem[131],
- &MyHashItem[133],
- NULL,
- &MyHashItem[136],
- NULL,
- NULL,
- &MyHashItem[139],
- &MyHashItem[140],
- &MyHashItem[144],
- &MyHashItem[147],
- &MyHashItem[150],
- &MyHashItem[151],
- &MyHashItem[157],
- &MyHashItem[158],
- NULL,
- &MyHashItem[159],
- &MyHashItem[167],
- &MyHashItem[171],
- &MyHashItem[173],
- &MyHashItem[174],
- &MyHashItem[179],
- NULL,
- &MyHashItem[183],
- &MyHashItem[185],
- &MyHashItem[190],
- &MyHashItem[193],
- &MyHashItem[194],
- &MyHashItem[196],
- &MyHashItem[199],
- &MyHashItem[202],
- &MyHashItem[206],
- &MyHashItem[209],
- &MyHashItem[210],
- &MyHashItem[216],
- &MyHashItem[219],
- &MyHashItem[221],
- &MyHashItem[228],
- &MyHashItem[230],
- NULL,
- &MyHashItem[231],
- &MyHashItem[232],
- NULL,
- &MyHashItem[235],
- &MyHashItem[236],
- &MyHashItem[240],
- &MyHashItem[241],
- &MyHashItem[242],
- &MyHashItem[244],
- &MyHashItem[246],
- &MyHashItem[250],
- &MyHashItem[252],
- &MyHashItem[253],
- &MyHashItem[255],
- &MyHashItem[256],
+ NULL,
+ &MyHashItem[0],
+ &MyHashItem[2],
+ &MyHashItem[5],
+ &MyHashItem[7],
+ &MyHashItem[11],
+ &MyHashItem[16],
+ &MyHashItem[19],
+ &MyHashItem[24],
+ &MyHashItem[27],
+ &MyHashItem[33],
+ &MyHashItem[36],
+ NULL,
+ &MyHashItem[38],
+ &MyHashItem[41],
+ &MyHashItem[45],
+ &MyHashItem[47],
+ &MyHashItem[51],
+ &MyHashItem[55],
+ &MyHashItem[58],
+ &MyHashItem[60],
+ &MyHashItem[62],
+ &MyHashItem[67],
+ &MyHashItem[68],
+ &MyHashItem[70],
+ &MyHashItem[71],
+ &MyHashItem[75],
+ &MyHashItem[78],
+ &MyHashItem[79],
+ &MyHashItem[81],
+ &MyHashItem[85],
+ &MyHashItem[88],
+ &MyHashItem[89],
+ &MyHashItem[94],
+ &MyHashItem[97],
+ &MyHashItem[100],
+ &MyHashItem[101],
+ &MyHashItem[104],
+ &MyHashItem[107],
+ &MyHashItem[110],
+ &MyHashItem[111],
+ &MyHashItem[113],
+ &MyHashItem[115],
+ &MyHashItem[120],
+ &MyHashItem[123],
+ &MyHashItem[124],
+ &MyHashItem[131],
+ &MyHashItem[133],
+ NULL,
+ &MyHashItem[136],
+ NULL,
+ NULL,
+ &MyHashItem[139],
+ &MyHashItem[140],
+ &MyHashItem[144],
+ &MyHashItem[147],
+ &MyHashItem[150],
+ &MyHashItem[151],
+ &MyHashItem[157],
+ &MyHashItem[158],
+ NULL,
+ &MyHashItem[159],
+ &MyHashItem[167],
+ &MyHashItem[171],
+ &MyHashItem[173],
+ &MyHashItem[174],
+ &MyHashItem[179],
+ NULL,
+ &MyHashItem[183],
+ &MyHashItem[185],
+ &MyHashItem[190],
+ &MyHashItem[193],
+ &MyHashItem[194],
+ &MyHashItem[196],
+ &MyHashItem[199],
+ &MyHashItem[202],
+ &MyHashItem[206],
+ &MyHashItem[209],
+ &MyHashItem[210],
+ &MyHashItem[216],
+ &MyHashItem[219],
+ &MyHashItem[221],
+ &MyHashItem[228],
+ &MyHashItem[230],
+ NULL,
+ &MyHashItem[231],
+ &MyHashItem[232],
+ NULL,
+ &MyHashItem[235],
+ &MyHashItem[236],
+ &MyHashItem[240],
+ &MyHashItem[241],
+ &MyHashItem[242],
+ &MyHashItem[244],
+ &MyHashItem[246],
+ &MyHashItem[250],
+ &MyHashItem[252],
+ &MyHashItem[253],
+ &MyHashItem[255],
+ &MyHashItem[256],
};
-Hash_si entity = {100, MyHashItemTbl};
+Hash_si entity = { 100, MyHashItemTbl };
diff --git a/etc.c b/etc.c
index 66705b7..a828970 100644
--- a/etc.c
+++ b/etc.c
@@ -1,4 +1,4 @@
-/* $Id: etc.c,v 1.7 2001/11/23 21:40:19 ukai Exp $ */
+/* $Id: etc.c,v 1.8 2001/11/24 02:01:26 ukai Exp $ */
#include "fm.h"
#include <pwd.h>
#include "myctype.h"
@@ -7,7 +7,7 @@
#include "hash.h"
#include "terms.h"
-#ifdef HAVE_GETCWD /* ??? ukai */
+#ifdef HAVE_GETCWD /* ??? ukai */
#include <unistd.h>
#include <sys/param.h>
#endif /* HAVE_GETCWD */
@@ -86,7 +86,7 @@ arg_is(char *str, char *tag)
}
int
-columnSkip(Buffer * buf, int offset)
+columnSkip(Buffer *buf, int offset)
{
int i, maxColumn;
int column = buf->currentColumn + offset;
@@ -94,9 +94,7 @@ columnSkip(Buffer * buf, int offset)
Line *l;
maxColumn = 0;
- for (i = 0, l = buf->topLine;
- i < nlines && l != NULL;
- i++, l = l->next) {
+ for (i = 0, l = buf->topLine; i < nlines && l != NULL; i++, l = l->next) {
if (l->width < 0)
l->width = COLPOS(l, l->len);
if (l->width - 1 > maxColumn)
@@ -115,7 +113,7 @@ columnSkip(Buffer * buf, int offset)
}
int
-columnPos(Line * line, int column)
+columnPos(Line *line, int column)
{
int i;
@@ -132,23 +130,22 @@ columnPos(Line * line, int column)
}
Line *
-lineSkip(Buffer * buf, Line * line, int offset, int last)
+lineSkip(Buffer *buf, Line *line, int offset, int last)
{
int i;
Line *l;
l = currentLineSkip(buf, line, offset, last);
#ifdef NEXTPAGE_TOPLINE
- if (! nextpage_topline)
+ if (!nextpage_topline)
#endif
for (i = (LASTLINE - 1) - (buf->lastLine->linenumber - l->linenumber);
- i > 0 && l->prev != NULL;
- i--, l = l->prev);
+ i > 0 && l->prev != NULL; i--, l = l->prev) ;
return l;
}
Line *
-currentLineSkip(Buffer * buf, Line * line, int offset, int last)
+currentLineSkip(Buffer *buf, Line *line, int offset, int last)
{
int i, n;
Line *l = line;
@@ -158,7 +155,7 @@ currentLineSkip(Buffer * buf, Line * line, int offset, int last)
if (buf->lastLine->linenumber < n)
getNextPage(buf, n - buf->lastLine->linenumber);
while ((last || (buf->lastLine->linenumber < n)) &&
- (getNextPage(buf, 1) != NULL));
+ (getNextPage(buf, 1) != NULL)) ;
if (last)
l = buf->lastLine;
}
@@ -166,9 +163,9 @@ currentLineSkip(Buffer * buf, Line * line, int offset, int last)
if (offset == 0)
return l;
if (offset > 0)
- for (i = 0; i < offset && l->next != NULL; i++, l = l->next);
+ for (i = 0; i < offset && l->next != NULL; i++, l = l->next) ;
else
- for (i = 0; i < -offset && l->prev != NULL; i++, l = l->prev);
+ for (i = 0; i < -offset && l->prev != NULL; i++, l = l->prev) ;
return l;
}
@@ -178,10 +175,7 @@ static int
get_cmd(Hash_si * hash,
char **s,
char *args,
- char termchar,
- int defaultcmd,
- int allow_space,
- int *status)
+ char termchar, int defaultcmd, int allow_space, int *status)
{
char cmdstr[MAX_CMD_LEN];
char *p = cmdstr;
@@ -197,8 +191,7 @@ get_cmd(Hash_si * hash,
return defaultcmd;
if (p[-1] == '/')
SKIP_BLANKS(*s);
- while ((IS_ALNUM(**s) || **s == '_') &&
- p - cmdstr < MAX_CMD_LEN) {
+ while ((IS_ALNUM(**s) || **s == '_') && p - cmdstr < MAX_CMD_LEN) {
*(p++) = tolower(*((*s)++));
}
if (p - cmdstr == MAX_CMD_LEN) {
@@ -304,11 +297,10 @@ parse_ansi_color(char **str, Lineprop *effect, Linecolor *color)
Linecolor c = *color;
int i;
- if (*p != ESC_CODE || *(p+1) != '[')
+ if (*p != ESC_CODE || *(p + 1) != '[')
return 0;
p += 2;
- for (q = p; IS_DIGIT(*q) || *q == ';'; q++)
- ;
+ for (q = p; IS_DIGIT(*q) || *q == ';'; q++) ;
if (*q != 'm')
return 0;
*str = q + 1;
@@ -320,8 +312,7 @@ parse_ansi_color(char **str, Lineprop *effect, Linecolor *color)
}
if (IS_DIGIT(*p)) {
q = p;
- for (p++; IS_DIGIT(*p); p++)
- ;
+ for (p++; IS_DIGIT(*p); p++) ;
i = atoi(allocStr(q, p - q));
switch (i) {
case 0:
@@ -338,7 +329,7 @@ parse_ansi_color(char **str, Lineprop *effect, Linecolor *color)
case 7:
e = PE_STAND;
break;
- case 100: /* for EWS4800 kterm */
+ case 100: /* for EWS4800 kterm */
c = 0;
break;
case 39:
@@ -356,12 +347,13 @@ parse_ansi_color(char **str, Lineprop *effect, Linecolor *color)
}
if (*p == 'm')
break;
- } else {
+ }
+ else {
e = PE_NORMAL;
c = 0;
break;
}
- p++; /* *p == ';' */
+ p++; /* *p == ';' */
}
*effect = e;
*color = c;
@@ -374,9 +366,9 @@ parse_ansi_color(char **str, Lineprop *effect, Linecolor *color)
*/
Str
-checkType(Str s, Lineprop * oprop,
+checkType(Str s, Lineprop *oprop,
#ifdef USE_ANSI_COLOR
- Linecolor * ocolor, int * check_color,
+ Linecolor *ocolor, int *check_color,
#endif
int len)
{
@@ -472,8 +464,7 @@ checkType(Str s, Lineprop * oprop,
else if (*(str + 1) == '\b') {
#ifdef JP_CHARSET
if (s->length > 1 && CharType(*(prop - 2)) == PC_KANJI1) {
- if (str + 4 <= endp &&
- !strncmp(str - 2, str + 2, 2)) {
+ if (str + 4 <= endp && !strncmp(str - 2, str + 2, 2)) {
*(prop - 1) |= PE_BOLD;
*(prop - 2) |= PE_BOLD;
str += 4;
@@ -487,8 +478,7 @@ checkType(Str s, Lineprop * oprop,
else
#endif /* JP_CHARSET */
if (s->length > 0) {
- if (str + 3 <= endp &&
- *(str - 1) == *(str + 2)) {
+ if (str + 3 <= endp && *(str - 1) == *(str + 2)) {
*(prop - 1) |= PE_BOLD;
str += 3;
}
@@ -505,8 +495,7 @@ checkType(Str s, Lineprop * oprop,
else {
#ifdef JP_CHARSET
if (s->length > 1 && CharType(*(prop - 2)) == PC_KANJI1) {
- if (str + 3 <= endp &&
- !strncmp(str - 2, str + 1, 2)) {
+ if (str + 3 <= endp && !strncmp(str - 2, str + 1, 2)) {
*(prop - 1) |= PE_BOLD;
*(prop - 2) |= PE_BOLD;
str += 3;
@@ -520,8 +509,7 @@ checkType(Str s, Lineprop * oprop,
else
#endif /* JP_CHARSET */
if (s->length > 0) {
- if (str + 2 <= endp &&
- *(str - 1) == *(str + 1)) {
+ if (str + 2 <= endp && *(str - 1) == *(str + 1)) {
*(prop - 1) |= PE_BOLD;
str += 2;
}
@@ -613,15 +601,15 @@ calcPosition(char *l, Lineprop *pr, int len, int pos, int bpos, int mode)
if (l == NULL || len == 0)
return bpos;
if (l == prevl && mode == CP_AUTO) {
- if (pos <= len)
+ if (pos <= len)
return realColumn[pos];
}
prevl = l;
j = bpos;
for (i = 0;; i++) {
realColumn[i] = j;
- if (i == len)
- break;
+ if (i == len)
+ break;
if (l[i] == '\t' && pr[i] == PC_CTRL)
j = (j + Tabstop) / Tabstop * Tabstop;
#ifndef KANJI_SYMBOLS
@@ -944,8 +932,7 @@ read_token(Str buf, char **instr, int *status, int pre, int append)
*status = prev_status;
return 1;
}
- if (*status == R_ST_TAG0 &&
- !REALLY_THE_BEGINNING_OF_A_TAG(p)) {
+ if (*status == R_ST_TAG0 && !REALLY_THE_BEGINNING_OF_A_TAG(p)) {
/* it seems that this '<' is not a beginning of a tag */
Strcat_charp(buf, "&lt;");
*status = R_ST_NORMAL;
@@ -986,7 +973,7 @@ correct_irrtag(int status)
while (status != R_ST_NORMAL) {
switch (status) {
- case R_ST_CMNT: /* required "-->" */
+ case R_ST_CMNT: /* required "-->" */
case R_ST_NCMNT1: /* required "->" */
c = '-';
break;
@@ -1061,7 +1048,7 @@ add_auth_cookie(char *host, char *realm, Str cookie)
/* get last modified time */
char *
-last_modified(Buffer * buf)
+last_modified(Buffer *buf)
{
TextListItem *ti;
struct stat st;
@@ -1082,12 +1069,10 @@ last_modified(Buffer * buf)
return "unknown";
}
-static char roman_num1[] =
-{
+static char roman_num1[] = {
'i', 'x', 'c', 'm', '*',
};
-static char roman_num5[] =
-{
+static char roman_num5[] = {
'v', 'l', 'd', '*',
};
@@ -1167,29 +1152,29 @@ romanAlphabet(int n)
void
mySystem(char *command, int background)
{
- if (background){
+ if (background) {
#ifndef HAVE_SETPGRP
Str cmd = Strnew_charp("start /f ");
Strcat_charp(cmd, command);
system(cmd->ptr);
#else
- int pid;
- flush_tty();
- if ((pid = fork()) == 0) {
+ int pid;
+ flush_tty();
+ if ((pid = fork()) == 0) {
#ifdef SIGCHLD
- signal(SIGCHLD, SIG_IGN);
+ signal(SIGCHLD, SIG_IGN);
#endif
- setpgrp();
- close_tty();
- fclose(stdout);
- fclose(stderr);
- execl("/bin/sh", "sh", "-c", command, NULL);
- exit(127);
- }
+ setpgrp();
+ close_tty();
+ fclose(stdout);
+ fclose(stderr);
+ execl("/bin/sh", "sh", "-c", command, NULL);
+ exit(127);
+ }
#endif
}
else
- system(command);
+ system(command);
}
char *
@@ -1240,25 +1225,26 @@ file_to_url(char *file)
file = expandName(file);
#ifdef SUPPORT_NETBIOS_SHARE
if (file[0] == '/' && file[1] == '/') {
- char *p;
- file += 2;
- if (*file) {
- p = strchr(file, '/');
- if (p != NULL && p != file) {
- host = allocStr(file, (p - file));
- file = p;
- }
- }
+ char *p;
+ file += 2;
+ if (*file) {
+ p = strchr(file, '/');
+ if (p != NULL && p != file) {
+ host = allocStr(file, (p - file));
+ file = p;
+ }
+ }
}
#endif
#ifdef SUPPORT_DOS_DRIVE_PREFIX
if (IS_ALPHA(file[0]) && file[1] == ':') {
- drive = allocStr(file, 2);
- file += 2;
- } else
+ drive = allocStr(file, 2);
+ file += 2;
+ }
+ else
#endif
if (file[0] != '/') {
- tmp = Strnew_charp(CurrentDir);
+ tmp = Strnew_charp(CurrentDir);
if (Strlastchar(tmp) != '/')
Strcat_char(tmp, '/');
Strcat_charp(tmp, file);
@@ -1267,22 +1253,21 @@ file_to_url(char *file)
tmp = Strnew_charp("file://");
#ifdef SUPPORT_NETBIOS_SHARE
if (host)
- Strcat_charp(tmp, host);
+ Strcat_charp(tmp, host);
#endif
#ifdef SUPPORT_DOS_DRIVE_PREFIX
if (drive)
- Strcat_charp(tmp, drive);
+ Strcat_charp(tmp, drive);
#endif
Strcat_charp(tmp, file_quote(cleanupName(file)));
return tmp->ptr;
}
-static char *tmpf_base[MAX_TMPF_TYPE] =
-{
- "tmp", "src", "frame", "cache"
+static char *tmpf_base[MAX_TMPF_TYPE] = {
+ "tmp", "src", "frame", "cache"
};
static unsigned int tmpf_seq[MAX_TMPF_TYPE];
-
+
Str
tmpfname(int type, char *ext)
{
@@ -1290,16 +1275,12 @@ tmpfname(int type, char *ext)
tmpf = Sprintf("%s/w3m%s%d-%d%s",
rc_dir,
tmpf_base[type],
- (int) getpid(),
- tmpf_seq[type]++,
- (ext)? ext : ""
- );
+ (int)getpid(), tmpf_seq[type]++, (ext) ? ext : "");
return tmpf;
}
#ifdef USE_COOKIE
-static char *monthtbl[] =
-{
+static char *monthtbl[] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
@@ -1417,8 +1398,7 @@ get_time(char **s, int *hour, int *min, int *sec)
*sec = atoi(tmp->ptr);
if (*hour < 0 || *hour >= 24 ||
- *min < 0 || *min >= 60 ||
- *sec < 0 || *sec >= 60) {
+ *min < 0 || *min >= 60 || *sec < 0 || *sec >= 60) {
*s = ss;
return -1;
}
@@ -1506,9 +1486,7 @@ mymktime(char *timestr)
day += (year - 1968) * 1461 / 4;
day += ((((mon * 153) + 2) / 5) - 672);
return (time_t) ((day * 60 * 60 * 24) +
- (hour * 60 * 60) +
- (min * 60) +
- sec);
+ (hour * 60 * 60) + (min * 60) + sec);
}
#ifdef INET6
@@ -1531,7 +1509,7 @@ FQDN(char *host)
if (strcasecmp(host, "localhost") == 0)
return host;
- for (p = host; *p && *p != '.'; p++);
+ for (p = host; *p && *p != '.'; p++) ;
if (*p == '.')
return host;
diff --git a/file.c b/file.c
index 72b919b..ea7534d 100644
--- a/file.c
+++ b/file.c
@@ -1,4 +1,4 @@
-/* $Id: file.c,v 1.13 2001/11/23 22:41:42 ukai Exp $ */
+/* $Id: file.c,v 1.14 2001/11/24 02:01:26 ukai Exp $ */
#include "fm.h"
#include <sys/types.h>
#include "myctype.h"
@@ -23,15 +23,15 @@
#define min(a,b) ((a) > (b) ? (b) : (a))
#endif /* not min */
-static void gunzip_stream(URLFile * uf);
+static void gunzip_stream(URLFile *uf);
static FILE *lessopen_stream(char *path);
static Buffer *loadcmdout(char *cmd,
- Buffer * (*loadproc) (URLFile *, Buffer *),
+ Buffer *(*loadproc) (URLFile *, Buffer *),
Buffer *defaultbuf);
static void close_textarea(struct html_feed_environ *h_env);
-static void addnewline(Buffer * buf, char *line, Lineprop * prop,
+static void addnewline(Buffer *buf, char *line, Lineprop *prop,
#ifdef USE_ANSI_COLOR
- Linecolor * color,
+ Linecolor *color,
#endif
int pos, int nlines);
@@ -114,15 +114,13 @@ static int cur_hseq;
#define MAX_UL_LEVEL 9
#ifdef KANJI_SYMBOLS
-char *ullevel[MAX_UL_LEVEL] =
-{
+char *ullevel[MAX_UL_LEVEL] = {
"・", "□", "☆", "○", "■", "★", "◎", "●", "△"
};
#define HR_RULE "━"
#define HR_RULE_WIDTH 2
#else /* not KANJI_SYMBOLS */
-char *ullevel[MAX_UL_LEVEL] =
-{
+char *ullevel[MAX_UL_LEVEL] = {
NBSP "*", NBSP "+", NBSP "o", NBSP "#", NBSP "@", NBSP "-",
NBSP "=", "**", "--"
};
@@ -132,16 +130,16 @@ char *ullevel[MAX_UL_LEVEL] =
#ifdef USE_COOKIE
/* This array should be somewhere else */
-char *violations[COO_EMAX] = {
- "internal error",
- "tail match failed",
- "wrong number of dots",
- "RFC 2109 4.3.2 rule 1",
- "RFC 2109 4.3.2 rule 2.1",
- "RFC 2109 4.3.2 rule 2.2",
- "RFC 2109 4.3.2 rule 3",
- "RFC 2109 4.3.2 rule 4",
- "RFC XXXX 4.3.2 rule 5"
+char *violations[COO_EMAX] = {
+ "internal error",
+ "tail match failed",
+ "wrong number of dots",
+ "RFC 2109 4.3.2 rule 1",
+ "RFC 2109 4.3.2 rule 2.1",
+ "RFC 2109 4.3.2 rule 2.2",
+ "RFC 2109 4.3.2 rule 3",
+ "RFC 2109 4.3.2 rule 4",
+ "RFC XXXX 4.3.2 rule 5"
};
#endif
@@ -155,20 +153,19 @@ KeyAbort(SIGNAL_ARG)
}
int
-currentLn(Buffer * buf)
+currentLn(Buffer *buf)
{
if (buf->currentLine)
-/* return buf->currentLine->real_linenumber + 1; */
- return buf->currentLine->linenumber + 1;
+ /* return buf->currentLine->real_linenumber + 1; */
+ return buf->currentLine->linenumber + 1;
else
return 1;
}
static Buffer *
-loadSomething(URLFile * f,
+loadSomething(URLFile *f,
char *path,
- Buffer * (*loadproc) (URLFile *, Buffer *),
- Buffer * defaultbuf)
+ Buffer *(*loadproc) (URLFile *, Buffer *), Buffer *defaultbuf)
{
Buffer *buf;
@@ -204,7 +201,7 @@ is_dump_text_type(char *type)
{
struct mailcap *mcap;
return (type && (mcap = searchExtViewer(type)) &&
- (mcap->flags & (MAILCAP_HTMLOUTPUT|MAILCAP_COPIOUSOUTPUT)));
+ (mcap->flags & (MAILCAP_HTMLOUTPUT | MAILCAP_COPIOUSOUTPUT)));
}
static int
@@ -284,7 +281,7 @@ uncompressed_file_type(char *path, char **ext)
}
else
return NULL;
-
+
fn = Strnew_charp(path);
Strshrink(fn, slen);
if (ext)
@@ -317,7 +314,7 @@ examineFile(char *path, URLFile *uf)
return;
if ((fp = lessopen_stream(path))) {
UFclose(uf);
- uf->stream = newFileStream(fp, (void (*)()) pclose);
+ uf->stream = newFileStream(fp, (void (*)())pclose);
uf->guess_type = "text/plain";
return;
}
@@ -338,7 +335,7 @@ examineFile(char *path, URLFile *uf)
* convert line
*/
Str
-convertLine(URLFile * uf, Str line, char *code, int mode)
+convertLine(URLFile *uf, Str line, char *code, int mode)
{
#ifdef JP_CHARSET
char ic;
@@ -375,7 +372,7 @@ loadFile(char *path)
}
int
-matchattr(char *p, char *attr, int len, Str * value)
+matchattr(char *p, char *attr, int len, Str *value)
{
int quoted;
char *q = NULL;
@@ -413,10 +410,7 @@ matchattr(char *p, char *attr, int len, Str * value)
}
void
-readHeader(URLFile * uf,
- Buffer * newBuf,
- int thru,
- ParsedURL * pu)
+readHeader(URLFile *uf, Buffer *newBuf, int thru, ParsedURL *pu)
{
char *p, *q, *emsg;
char c;
@@ -447,14 +441,11 @@ readHeader(URLFile * uf,
}
#endif /* HTTP_DEBUG */
cleanup_line(tmp, HEADER_MODE);
- if ((tmp->ptr[0] == '\n' ||
- tmp->ptr[0] == '\r' ||
- tmp->ptr[0] == '\0')
+ if ((tmp->ptr[0] == '\n' || tmp->ptr[0] == '\r' || tmp->ptr[0] == '\0')
#ifdef USE_NNTP
||
(uf->scheme == SCM_NEWS &&
- Str_news_endline(tmp) &&
- (iseos(uf->stream) = TRUE))
+ Str_news_endline(tmp) && (iseos(uf->stream) = TRUE))
#endif /* USE_NNTP */
) {
if (!lineBuf2)
@@ -485,7 +476,7 @@ readHeader(URLFile * uf,
/* separated with line and stored */
tmp = Strnew_size(lineBuf2->length);
for (p = lineBuf2->ptr; *p; p = q) {
- for (q = p; *q && *q != '\r' && *q != '\n'; q++);
+ for (q = p; *q && *q != '\r' && *q != '\n'; q++) ;
lineBuf2 = checkType(Strnew_charp(p), propBuffer,
#ifdef USE_ANSI_COLOR
NULL, NULL,
@@ -498,7 +489,7 @@ readHeader(URLFile * uf,
NULL,
#endif
lineBuf2->length, -1);
- for (; *q && (*q == '\r' || *q == '\n'); q++);
+ for (; *q && (*q == '\r' || *q == '\n'); q++) ;
}
lineBuf2 = tmp;
}
@@ -540,7 +531,8 @@ readHeader(URLFile * uf,
while (IS_SPACE(*p))
p++;
if ((!strncasecmp(p, "x-gzip", 6) || !strncasecmp(p, "gzip", 4)) ||
- (!strncasecmp(p, "x-compress", 10) || !strncasecmp(p, "compress", 8))) {
+ (!strncasecmp(p, "x-compress", 10)
+ || !strncasecmp(p, "compress", 8))) {
uf->compression = CMP_GZIP;
}
else if (!strncasecmp(p, "x-bzip", 6) ||
@@ -559,7 +551,7 @@ readHeader(URLFile * uf,
(!strncasecmp(lineBuf2->ptr, "Set-Cookie:", 11) ||
!strncasecmp(lineBuf2->ptr, "Set-Cookie2:", 12))) {
Str name = Strnew(), value = Strnew(), domain = NULL, path = NULL,
- comment = NULL, commentURL = NULL, port = NULL, tmp;
+ comment = NULL, commentURL = NULL, port = NULL, tmp;
int version, quoted, flag = 0;
time_t expires = (time_t) - 1;
@@ -641,40 +633,51 @@ readHeader(URLFile * uf,
if (pu && name->length > 0) {
int err;
if (flag & COO_SECURE)
- disp_message_nsec("Received a secured cookie", FALSE, 1, TRUE, FALSE);
+ disp_message_nsec("Received a secured cookie", FALSE, 1,
+ TRUE, FALSE);
else
disp_message_nsec(Sprintf("Received cookie: %s=%s",
- name->ptr, value->ptr)->ptr, FALSE, 1, TRUE, FALSE);
- err = add_cookie(pu, name, value, expires, domain, path, flag,
- comment, version, port, commentURL);
+ name->ptr, value->ptr)->ptr,
+ FALSE, 1, TRUE, FALSE);
+ err =
+ add_cookie(pu, name, value, expires, domain, path, flag,
+ comment, version, port, commentURL);
if (err) {
- char *ans = (accept_bad_cookie == TRUE) ? "y" : NULL;
+ char *ans = (accept_bad_cookie == TRUE) ? "y" : NULL;
if (fmInitialized && (err & COO_OVERRIDE_OK) &&
accept_bad_cookie == PERHAPS) {
- Str msg = Sprintf("Accept bad cookie from %s for %s? (y or n) ",
- pu->host,
- domain && domain->ptr ? domain->ptr : "<localdomain>");
+ Str msg =
+ Sprintf
+ ("Accept bad cookie from %s for %s? (y or n) ",
+ pu->host,
+ domain
+ && domain->ptr ? domain->ptr : "<localdomain>");
if (msg->length > COLS - 4)
Strshrink(msg, msg->length - (COLS - 4));
term_raw();
ans = inputChar(msg->ptr);
}
if (ans == NULL || tolower(*ans) != 'y' ||
- (err = add_cookie(pu, name, value, expires, domain, path,
- flag | COO_OVERRIDE,
- comment, version, port, commentURL))) {
+ (err =
+ add_cookie(pu, name, value, expires, domain, path,
+ flag | COO_OVERRIDE, comment, version,
+ port, commentURL))) {
err = (err & ~COO_OVERRIDE_OK) - 1;
if (err >= 0 && err < COO_EMAX)
emsg = Sprintf("This cookie was rejected "
- "to prevent security violation. [%s]",
+ "to prevent security violation. [%s]",
violations[err])->ptr;
else
- emsg = "This cookie was rejected to prevent security violation.";
+ emsg =
+ "This cookie was rejected to prevent security violation.";
record_err_message(emsg);
disp_message_nsec(emsg, FALSE, 10, TRUE, FALSE);
- } else
- disp_message_nsec(Sprintf("Accepting invalid cookie: %s=%s",
- name->ptr,value->ptr)->ptr, FALSE, 1, TRUE, FALSE);
+ }
+ else
+ disp_message_nsec(Sprintf
+ ("Accepting invalid cookie: %s=%s",
+ name->ptr, value->ptr)->ptr, FALSE,
+ 1, TRUE, FALSE);
}
}
}
@@ -711,7 +714,7 @@ readHeader(URLFile * uf,
}
char *
-checkHeader(Buffer * buf, char *field)
+checkHeader(Buffer *buf, char *field)
{
int len = strlen(field);
TextListItem *i;
@@ -730,7 +733,7 @@ checkHeader(Buffer * buf, char *field)
}
char *
-checkContentType(Buffer * buf)
+checkContentType(Buffer *buf)
{
char *p;
Str r;
@@ -782,7 +785,8 @@ extractRealm(char *q)
}
static Str
-getAuthCookie(char *realm, char *auth_header, TextList * extra_header, ParsedURL * pu)
+getAuthCookie(char *realm, char *auth_header, TextList *extra_header,
+ ParsedURL *pu)
{
Str ss;
Str uname, pwd;
@@ -792,7 +796,8 @@ getAuthCookie(char *realm, char *auth_header, TextList * extra_header, ParsedURL
int auth_header_len = strlen(auth_header);
a_found = FALSE;
- for (i0 = &(extra_header->first), i = *i0; i != NULL; i0 = &(i->next), i = *i0) {
+ for (i0 = &(extra_header->first), i = *i0; i != NULL;
+ i0 = &(i->next), i = *i0) {
if (!strncasecmp(i->ptr, auth_header, auth_header_len)) {
a_found = TRUE;
break;
@@ -820,36 +825,46 @@ getAuthCookie(char *realm, char *auth_header, TextList * extra_header, ParsedURL
if (fmInitialized) {
char *pp;
term_raw();
- if ((pp = inputStr(Sprintf("Username for %s: ", realm)->ptr, NULL)) == NULL)
+ if ((pp =
+ inputStr(Sprintf("Username for %s: ", realm)->ptr,
+ NULL)) == NULL)
return NULL;
uname = Str_conv_to_system(Strnew_charp(pp));
- if ((pp = inputLine(Sprintf("Password for %s: ", realm)->ptr, NULL, IN_PASSWORD)) == NULL)
+ if ((pp =
+ inputLine(Sprintf("Password for %s: ", realm)->ptr, NULL,
+ IN_PASSWORD)) == NULL)
return NULL;
pwd = Str_conv_to_system(Strnew_charp(pp));
term_cbreak();
}
else {
- int proxy = !strncasecmp( "Proxy-Authorization:", auth_header, auth_header_len );
-
- /*
- * If post file is specified as '-', stdin is closed at this point.
- * In this case, w3m cannot read username from stdin.
- * So exit with error message.
- * (This is same behavior as lwp-request.)
- */
- if (feof(stdin) || ferror (stdin)) {
- fprintf(stderr, "w3m: Authorization required for %s\n", realm);
- exit(1);
- }
-
- printf(proxy ? "Proxy Username for %s: " : "Username for %s: ", realm);
+ int proxy = !strncasecmp("Proxy-Authorization:", auth_header,
+ auth_header_len);
+
+ /*
+ * If post file is specified as '-', stdin is closed at this point.
+ * In this case, w3m cannot read username from stdin.
+ * So exit with error message.
+ * (This is same behavior as lwp-request.)
+ */
+ if (feof(stdin) || ferror(stdin)) {
+ fprintf(stderr, "w3m: Authorization required for %s\n", realm);
+ exit(1);
+ }
+
+ printf(proxy ? "Proxy Username for %s: " : "Username for %s: ",
+ realm);
fflush(stdout);
uname = Strfgets(stdin);
Strchop(uname);
#ifdef HAVE_GETPASSPHRASE
- pwd = Strnew_charp((char *) getpassphrase(proxy ? "Proxy Password: " : "Password: "));
+ pwd = Strnew_charp((char *)
+ getpassphrase(proxy ? "Proxy Password: " :
+ "Password: "));
#else
- pwd = Strnew_charp((char *) getpass(proxy ? "Proxy Password: " : "Password: "));
+ pwd = Strnew_charp((char *)
+ getpass(proxy ? "Proxy Password: " :
+ "Password: "));
#endif
}
Strcat_char(uname, ':');
@@ -868,18 +883,20 @@ static int
same_url_p(ParsedURL *pu1, ParsedURL *pu2)
{
return (pu1->scheme == pu2->scheme && pu1->port == pu2->port &&
- (pu1->host ? pu2->host ? !strcasecmp(pu1->host, pu2->host) : 0 : 1) &&
- (pu1->file ? pu2->file ? !strcmp(pu1->file, pu2->file) : 0 : 1));
+ (pu1->host ? pu2->host ? !strcasecmp(pu1->host, pu2->host) : 0 : 1)
+ && (pu1->file ? pu2->
+ file ? !strcmp(pu1->file, pu2->file) : 0 : 1));
}
/*
* loadGeneralFile: load file to buffer
*/
Buffer *
-loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormList * request)
+loadGeneralFile(char *path, ParsedURL *current, char *referer, int flag,
+ FormList *request)
{
URLFile f, *of = NULL;
- ParsedURL pu, * volatile puv = NULL;
+ ParsedURL pu, *volatile puv = NULL;
int volatile nredir = 0;
int volatile nredir_size = 0;
Buffer *b = NULL, *(*proc) ();
@@ -908,15 +925,16 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
load_doc:
url_option.referer = referer;
url_option.flag = flag;
- f = openURL(tpath, &pu, current, &url_option, request, extra_header, of, &status);
+ f = openURL(tpath, &pu, current, &url_option, request, extra_header, of,
+ &status);
of = NULL;
#ifdef JP_CHARSET
content_charset = '\0';
#endif
if (f.stream == NULL) {
- /* openURL failure: it means either (1) the requested URL is a directory name
- * on an FTP server, or (2) is a local directory name.
- */
+ /* openURL failure: it means either (1) the requested URL is a directory name
+ * on an FTP server, or (2) is a local directory name.
+ */
extern Str FTPDIRtmp;
if (fmInitialized && prevtrap) {
term_raw();
@@ -927,7 +945,8 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
if (FTPDIRtmp->length > 0) {
b = loadHTMLString(FTPDIRtmp);
if (b) {
- if (b->currentURL.host == NULL && b->currentURL.file == NULL)
+ if (b->currentURL.host == NULL
+ && b->currentURL.file == NULL)
copyParsedURL(&b->currentURL, &pu);
b->real_scheme = pu.scheme;
}
@@ -943,10 +962,9 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
if (UseExternalDirBuffer) {
Str tmp = Strnew_charp(DirBufferCommand);
Strcat_m_charp(tmp, "?dir=",
- pu.real_file,
- "#current",
- NULL);
- b = loadGeneralFile(tmp->ptr, NULL, NO_REFERER, 0, NULL);
+ pu.real_file, "#current", NULL);
+ b = loadGeneralFile(tmp->ptr, NULL, NO_REFERER, 0,
+ NULL);
if (b != NULL && b != NO_BUFFER) {
copyParsedURL(&b->currentURL, &pu);
b->filename = b->currentURL.real_file;
@@ -969,7 +987,7 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
/* openURL() succeeded */
if (SETJMP(AbortLoading) != 0) {
- /* transfer interrupted */
+ /* transfer interrupted */
if (fmInitialized) {
term_raw();
signal(SIGINT, prevtrap);
@@ -986,7 +1004,8 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
searchHeader = TRUE;
searchHeader_through = FALSE;
}
- if (header_string) header_string = NULL;
+ if (header_string)
+ header_string = NULL;
if (fmInitialized) {
prevtrap = signal(SIGINT, KeyAbort);
term_cbreak();
@@ -997,13 +1016,14 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
#endif /* USE_SSL */
((
#ifdef USE_GOPHER
- (pu.scheme == SCM_GOPHER && non_null(GOPHER_proxy)) ||
+ (pu.scheme == SCM_GOPHER && non_null(GOPHER_proxy)) ||
#endif /* USE_GOPHER */
- (pu.scheme == SCM_FTP && non_null(FTP_proxy))
+ (pu.scheme == SCM_FTP && non_null(FTP_proxy))
) && !Do_not_use_proxy && !check_no_proxy(pu.host))) {
if (fmInitialized) {
- message(Sprintf("%s contacted. Waiting for reply...", pu.host)->ptr, 0, 0);
+ message(Sprintf("%s contacted. Waiting for reply...", pu.host)->
+ ptr, 0, 0);
refresh();
}
if (t_buf == NULL)
@@ -1019,46 +1039,53 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
t = checkContentType(t_buf);
if (t == NULL)
t = "text/plain";
- if (http_response_code >= 301 && http_response_code <= 303 && (p = checkHeader(t_buf, "Location:")) != NULL) {
+ if (http_response_code >= 301 && http_response_code <= 303
+ && (p = checkHeader(t_buf, "Location:")) != NULL) {
/* document moved */
- if (nredir >= FollowRedirection) {
- tmp = Sprintf("Number of redirections exceeded %d at %s", FollowRedirection, parsedURL2Str(&pu)->ptr);
- disp_err_message(tmp->ptr, FALSE);
- }
- else if (nredir_size > 0 &&
- (same_url_p(&pu, &puv[(nredir - 1) % nredir_size]) ||
- (!(nredir % 2) && same_url_p(&pu, &puv[(nredir / 2) % nredir_size])))) {
- tmp = Sprintf("Redirection loop detected (%s)", parsedURL2Str(&pu)->ptr);
- disp_err_message(tmp->ptr, FALSE);
- }
- else {
- if (!puv) {
- nredir_size = FollowRedirection / 2 + 1;
- puv = New_N(ParsedURL, nredir_size);
- memset(puv, 0, sizeof(ParsedURL) * nredir_size);
- }
-
- copyParsedURL(&puv[nredir % nredir_size], &pu);
- ++nredir;
- tmp = Strnew_charp(p);
- Strchop(tmp);
- tpath = tmp->ptr;
- request = NULL;
- UFclose(&f);
- add_auth_cookie_flag = 0;
- current = New(ParsedURL);
- copyParsedURL(current, &pu);
- t_buf->bufferprop |= BP_REDIRECTED;
- status = HTST_NORMAL;
- goto load_doc;
- }
+ if (nredir >= FollowRedirection) {
+ tmp =
+ Sprintf("Number of redirections exceeded %d at %s",
+ FollowRedirection, parsedURL2Str(&pu)->ptr);
+ disp_err_message(tmp->ptr, FALSE);
+ }
+ else if (nredir_size > 0 &&
+ (same_url_p(&pu, &puv[(nredir - 1) % nredir_size]) ||
+ (!(nredir % 2)
+ && same_url_p(&pu, &puv[(nredir / 2) % nredir_size])))) {
+ tmp =
+ Sprintf("Redirection loop detected (%s)",
+ parsedURL2Str(&pu)->ptr);
+ disp_err_message(tmp->ptr, FALSE);
+ }
+ else {
+ if (!puv) {
+ nredir_size = FollowRedirection / 2 + 1;
+ puv = New_N(ParsedURL, nredir_size);
+ memset(puv, 0, sizeof(ParsedURL) * nredir_size);
+ }
+
+ copyParsedURL(&puv[nredir % nredir_size], &pu);
+ ++nredir;
+ tmp = Strnew_charp(p);
+ Strchop(tmp);
+ tpath = tmp->ptr;
+ request = NULL;
+ UFclose(&f);
+ add_auth_cookie_flag = 0;
+ current = New(ParsedURL);
+ copyParsedURL(current, &pu);
+ t_buf->bufferprop |= BP_REDIRECTED;
+ status = HTST_NORMAL;
+ goto load_doc;
+ }
}
if ((p = checkHeader(t_buf, "WWW-Authenticate:")) != NULL &&
http_response_code == 401) {
/* Authentication needed */
realm = extractRealm(p);
if (realm != NULL) {
- ss = getAuthCookie(realm->ptr, "Authorization:", extra_header, &pu);
+ ss = getAuthCookie(realm->ptr, "Authorization:", extra_header,
+ &pu);
if (ss == NULL) {
/* abort */
UFclose(&f);
@@ -1078,8 +1105,7 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
if (realm != NULL) {
ss = getAuthCookie(realm->ptr,
"Proxy-Authorization:",
- extra_header,
- &HTTP_proxy_parsed);
+ extra_header, &HTTP_proxy_parsed);
proxy_auth_cookie = ss;
if (ss == NULL) {
/* abort */
@@ -1138,13 +1164,13 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
if (f.compression != CMP_NOCOMPRESS) {
char *t1 = uncompressed_file_type(pu.file, NULL);
real_type = f.guess_type;
-/*
+#if 0
if (t1 && strncasecmp(t1, "application/", 12) == 0) {
f.compression = CMP_NOCOMPRESS;
t = real_type;
}
else
-*/
+#endif
if (t1)
t = t1;
else
@@ -1156,7 +1182,7 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
real_type = "text/plain";
t = real_type;
}
-/*
+#if 0
if (!strncasecmp(t, "application/", 12)) {
char *tmpf = tmpfname(TMPF_DFL, NULL)->ptr;
current_content_length = 0;
@@ -1171,7 +1197,7 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
}
return NO_BUFFER;
}
-*/
+#endif
}
else if (searchHeader) {
t_buf = newBuffer(INIT_BUFFER_WIDTH);
@@ -1213,25 +1239,26 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
if (do_download) {
/* download only */
- char *file;
+ char *file;
if (fmInitialized) {
term_raw();
signal(SIGINT, prevtrap);
}
if (DecodeCTE && IStype(f.stream) != IST_ENCODED)
f.stream = newEncodedStream(f.stream, f.encoding);
- if (pu.scheme == SCM_LOCAL)
- file = conv_from_system(guess_save_name(NULL, pu.real_file));
- else
- file = guess_save_name(t_buf, pu.file);
- doFileSave(f, file);
+ if (pu.scheme == SCM_LOCAL)
+ file = conv_from_system(guess_save_name(NULL, pu.real_file));
+ else
+ file = guess_save_name(t_buf, pu.file);
+ doFileSave(f, file);
UFclose(&f);
return NO_BUFFER;
}
if (f.compression != CMP_NOCOMPRESS) {
if (!(w3m_dump & DUMP_SOURCE) &&
- (w3m_dump & ~DUMP_FRAME || is_text_type(t) || searchExtViewer(t))) {
+ (w3m_dump & ~DUMP_FRAME || is_text_type(t)
+ || searchExtViewer(t))) {
gunzip_stream(&f);
uncompressed_file_type(pu.file, &f.ext);
}
@@ -1253,7 +1280,8 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
else if (w3m_backend) ;
else if (!(w3m_dump & ~DUMP_FRAME) || is_dump_text_type(t)) {
if (!do_download && doExternal(f,
- pu.real_file ? pu.real_file : pu.file, t, &b, t_buf)) {
+ pu.real_file ? pu.real_file : pu.file,
+ t, &b, t_buf)) {
if (b && b != NO_BUFFER) {
b->real_scheme = f.scheme;
b->real_type = real_type;
@@ -1275,7 +1303,8 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
if (pu.scheme == SCM_LOCAL) {
UFclose(&f);
doFileCopy(pu.real_file,
- conv_from_system(guess_save_name(NULL, pu.real_file)));
+ conv_from_system(guess_save_name
+ (NULL, pu.real_file)));
}
else {
if (DecodeCTE && IStype(f.stream) != IST_ENCODED)
@@ -1318,11 +1347,13 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
}
else
b->type = "text/plain";
- if (pu.label) {
+ if (pu.label) {
if (proc == loadHTMLBuffer) {
Anchor *a;
#ifdef JP_CHARSET
- a = searchURLLabel(b, conv(pu.label, b->document_code, InnerCode)->ptr);
+ a = searchURLLabel(b,
+ conv(pu.label, b->document_code,
+ InnerCode)->ptr);
#else /* not JP_CHARSET */
a = searchURLLabel(b, pu.label);
#endif /* not JP_CHARSET */
@@ -1331,23 +1362,23 @@ loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormLi
#ifdef LABEL_TOPLINE
if (label_topline)
b->topLine = lineSkip(b, b->topLine,
- b->currentLine->linenumber
- - b->topLine->linenumber,
- FALSE);
+ b->currentLine->linenumber
+ - b->topLine->linenumber, FALSE);
#endif
b->pos = a->start.pos;
arrangeCursor(b);
}
}
- else { /* plain text */
- int l = atoi(pu.label);
- gotoLine(b,l);
- b->pos = 0;
- arrangeCursor(b);
+ else { /* plain text */
+ int l = atoi(pu.label);
+ gotoLine(b, l);
+ b->pos = 0;
+ arrangeCursor(b);
}
}
}
- if (header_string) header_string = NULL;
+ if (header_string)
+ header_string = NULL;
if (fmInitialized) {
term_raw();
signal(SIGINT, prevtrap);
@@ -1566,8 +1597,7 @@ push_tag(struct readbuffer *obuf, char *cmdname, int cmd)
obuf->tag_stack[obuf->tag_sp]->cmdname = allocStr(cmdname, 0);
obuf->tag_stack[obuf->tag_sp]->cmd = cmd;
obuf->tag_sp++;
- if (obuf->tag_sp >= TAG_STACK_SIZE ||
- obuf->flag & (RB_SPECIAL & ~RB_NOBR))
+ if (obuf->tag_sp >= TAG_STACK_SIZE || obuf->flag & (RB_SPECIAL & ~RB_NOBR))
append_tags(obuf);
}
@@ -1611,7 +1641,7 @@ push_char(struct readbuffer *obuf, int pre_mode, char ch)
check_breakpoint(obuf, pre_mode, (unsigned char)ch);
Strcat_char(obuf->line, ch);
obuf->pos++;
- obuf->prevchar = (unsigned char) ch;
+ obuf->prevchar = (unsigned char)ch;
if (ch != ' ')
obuf->prev_ctype = PC_ASCII;
obuf->flag |= RB_NFLUSHED;
@@ -1636,7 +1666,7 @@ push_spaces(struct readbuffer *obuf, int pre_mode, int width)
static void
proc_mchar(struct readbuffer *obuf, int pre_mode,
- int width, char **str, Lineprop mode)
+ int width, char **str, Lineprop mode)
{
int ch = mctowc(*str, mode);
@@ -1660,7 +1690,8 @@ proc_mchar(struct readbuffer *obuf, int pre_mode,
}
void
-push_render_image(Str str, int width, int limit, struct html_feed_environ *h_env)
+push_render_image(Str str, int width, int limit,
+ struct html_feed_environ *h_env)
{
struct readbuffer *obuf = h_env->obuf;
int indent = h_env->envs[h_env->envc].indent;
@@ -1669,7 +1700,7 @@ push_render_image(Str str, int width, int limit, struct html_feed_environ *h_env
push_str(obuf, width, str, PC_ASCII);
push_spaces(obuf, 1, (limit - width + 1) / 2);
if (width > 0)
- flushline(h_env, obuf, indent, 0, h_env->limit);
+ flushline(h_env, obuf, indent, 0, h_env->limit);
}
static int
@@ -1756,7 +1787,8 @@ fillline(struct readbuffer *obuf, int indent)
}
void
-flushline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent, int force, int width)
+flushline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent,
+ int force, int width)
{
TextLineList *buf = h_env->buf;
FILE *f = h_env->f;
@@ -1766,7 +1798,8 @@ flushline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent,
if (w3m_debug) {
FILE *f = fopen("zzzproc1", "a");
- fprintf(f, "flushline(%s,%d,%d,%d)\n", obuf->line->ptr, indent, force, width);
+ fprintf(f, "flushline(%s,%d,%d,%d)\n", obuf->line->ptr, indent, force,
+ width);
if (buf) {
TextLineListItem *p;
for (p = buf->first; p; p = p->next) {
@@ -1830,23 +1863,23 @@ flushline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent,
Strcat_charp(line, "</u>");
if (obuf->top_margin > 0) {
- int i;
- struct html_feed_environ h;
- struct readbuffer o;
- struct environment e[1];
-
- init_henv(&h, &o, e, 1, NULL, width, indent);
- o.line = Strnew_size(width + 20);
- o.pos = obuf->pos;
- o.flag = obuf->flag;
- o.top_margin = -1;
- o.bottom_margin = -1;
- Strcat_charp(o.line, "<pre_int>");
- for (i = 0; i < o.pos; i++)
- Strcat_char(o.line, ' ');
- Strcat_charp(o.line, "</pre_int>");
- for (i = 0; i < obuf->top_margin; i++)
- flushline(h_env, &o, indent, force, width);
+ int i;
+ struct html_feed_environ h;
+ struct readbuffer o;
+ struct environment e[1];
+
+ init_henv(&h, &o, e, 1, NULL, width, indent);
+ o.line = Strnew_size(width + 20);
+ o.pos = obuf->pos;
+ o.flag = obuf->flag;
+ o.top_margin = -1;
+ o.bottom_margin = -1;
+ Strcat_charp(o.line, "<pre_int>");
+ for (i = 0; i < o.pos; i++)
+ Strcat_char(o.line, ' ');
+ Strcat_charp(o.line, "</pre_int>");
+ for (i = 0; i < obuf->top_margin; i++)
+ flushline(h_env, &o, indent, force, width);
}
if (force == 1 || obuf->flag & RB_NFLUSHED) {
@@ -1902,7 +1935,8 @@ flushline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent,
if (w3m_debug) {
FILE *f = fopen("zzzproc1", "a");
fprintf(f, "pos=%d,%d, maxlimit=%d\n",
- visible_length(lbuf->line->ptr), lbuf->pos, h_env->maxlimit);
+ visible_length(lbuf->line->ptr), lbuf->pos,
+ h_env->maxlimit);
fclose(f);
}
#endif
@@ -1961,26 +1995,26 @@ flushline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent,
}
if (obuf->bottom_margin > 0) {
- int i;
- struct html_feed_environ h;
- struct readbuffer o;
- struct environment e[1];
-
- init_henv(&h, &o, e, 1, NULL, width, indent);
- o.line = Strnew_size(width + 20);
- o.pos = obuf->pos;
- o.flag = obuf->flag;
- o.top_margin = -1;
- o.bottom_margin = -1;
- Strcat_charp(o.line, "<pre_int>");
- for (i = 0; i < o.pos; i++)
- Strcat_char(o.line, ' ');
- Strcat_charp(o.line, "</pre_int>");
- for (i = 0; i < obuf->bottom_margin; i++)
- flushline(h_env, &o, indent, force, width);
+ int i;
+ struct html_feed_environ h;
+ struct readbuffer o;
+ struct environment e[1];
+
+ init_henv(&h, &o, e, 1, NULL, width, indent);
+ o.line = Strnew_size(width + 20);
+ o.pos = obuf->pos;
+ o.flag = obuf->flag;
+ o.top_margin = -1;
+ o.bottom_margin = -1;
+ Strcat_charp(o.line, "<pre_int>");
+ for (i = 0; i < o.pos; i++)
+ Strcat_char(o.line, ' ');
+ Strcat_charp(o.line, "</pre_int>");
+ for (i = 0; i < obuf->bottom_margin; i++)
+ flushline(h_env, &o, indent, force, width);
}
if (obuf->top_margin < 0 || obuf->bottom_margin < 0)
- return;
+ return;
obuf->line = Strnew_size(256);
obuf->pos = 0;
@@ -2034,7 +2068,8 @@ discardline(struct readbuffer *obuf, int indent)
}
void
-do_blankline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent, int indent_incr, int width)
+do_blankline(struct html_feed_environ *h_env, struct readbuffer *obuf,
+ int indent, int indent_incr, int width)
{
if (h_env->buf && h_env->blank_lines == 0)
flushline(h_env, obuf, indent, 1, width);
@@ -2059,7 +2094,7 @@ purgeline(struct html_feed_environ *h_env)
Strcat_charp_n(tmp, q, p - q);
}
}
- appendTextLine(h_env->buf ,tmp, 0);
+ appendTextLine(h_env->buf, tmp, 0);
h_env->blank_lines--;
}
@@ -2098,13 +2133,12 @@ close_anchor(struct html_feed_environ *h_env, struct readbuffer *obuf)
if (obuf->tag_stack[i]->cmd == HTML_A)
break;
}
- if (i < 0 && obuf->anchor_hseq > 0 &&
- Strlastchar(obuf->line) == ' ') {
+ if (i < 0 && obuf->anchor_hseq > 0 && Strlastchar(obuf->line) == ' ') {
Strshrink(obuf->line, 1);
obuf->pos--;
is_erased = 1;
}
-
+
if (i >= 0 || (p = has_hidden_link(obuf, HTML_A))) {
if (obuf->anchor_hseq > 0) {
HTMLlineproc1(ANSP, h_env);
@@ -2166,7 +2200,7 @@ restore_fonteffect(struct html_feed_environ *h_env, struct readbuffer *obuf)
Str
-process_img(struct parsed_tag * tag)
+process_img(struct parsed_tag *tag)
{
char *p, *q, *r, *r2, *s;
int w, i;
@@ -2189,8 +2223,7 @@ process_img(struct parsed_tag * tag)
s = "<form_int method=internal action=map>";
process_form(parse_tag(&s, TRUE));
Strcat(tmp, Sprintf("<pre_int><input_alt fid=\"%d\" "
- "type=hidden name=link value=\"",
- cur_form_id));
+ "type=hidden name=link value=\"", cur_form_id));
Strcat_charp(tmp, html_quote((r2) ? r2 + 1 : r));
Strcat(tmp, Sprintf("\"><input_alt hseq=\"%d\" fid=\"%d\" "
"type=submit no_effect=true>",
@@ -2231,7 +2264,7 @@ process_img(struct parsed_tag * tag)
if (w > 200 && i < 13) {
/* must be a horizontal line */
#ifndef KANJI_SYMBOLS
- Strcat_charp(tmp, "<_RULE TYPE=10>");
+ Strcat_charp(tmp, "<_RULE TYPE=10>");
#endif /* not KANJI_SYMBOLS */
w /= pixel_per_char;
for (i = 0; i < w - (HR_RULE_WIDTH - 1); i += HR_RULE_WIDTH)
@@ -2243,7 +2276,7 @@ process_img(struct parsed_tag * tag)
goto img_end1;
}
}
- for (q = p; *q; q++);
+ for (q = p; *q; q++) ;
while (q > p && *q != '/')
q--;
if (*q == '/')
@@ -2254,7 +2287,8 @@ process_img(struct parsed_tag * tag)
if (!IS_ALNUM(*q) && *q != '_' && *q != '-') {
break;
}
- else if (w > 0 && !IS_ALNUM(*q) && q - p + 2 > (int)(w / pixel_per_char)) {
+ else if (w > 0 && !IS_ALNUM(*q)
+ && q - p + 2 > (int)(w / pixel_per_char)) {
Strcat_charp(tmp, "..");
break;
}
@@ -2273,7 +2307,7 @@ process_img(struct parsed_tag * tag)
}
Str
-process_anchor(struct parsed_tag * tag, char *tagbuf)
+process_anchor(struct parsed_tag *tag, char *tagbuf)
{
if (parsedtag_need_reconstruct(tag)) {
parsedtag_set_value(tag, ATTR_HSEQ, Sprintf("%d", cur_hseq++)->ptr);
@@ -2287,10 +2321,10 @@ process_anchor(struct parsed_tag * tag, char *tagbuf)
}
Str
-process_input(struct parsed_tag * tag)
+process_input(struct parsed_tag *tag)
{
int i, w, v, x, y, z;
- char *q , *p, *r, *p2;
+ char *q, *p, *r, *p2;
Str tmp;
char *qq = "";
int qlen = 0;
@@ -2354,14 +2388,13 @@ process_input(struct parsed_tag * tag)
}
Strcat(tmp, Sprintf("<input_alt hseq=\"%d\" fid=\"%d\" type=%s "
"name=\"%s\" width=%d maxlength=%d value=\"%s\"",
- cur_hseq++, cur_form_id,
- p, html_quote(r), w, i, qq));
+ cur_hseq++, cur_form_id, p, html_quote(r), w, i, qq));
if (x)
Strcat_charp(tmp, " checked");
if (y)
Strcat_charp(tmp, " accept");
if (z)
- Strcat_charp(tmp, " readonly");
+ Strcat_charp(tmp, " readonly");
Strcat_char(tmp, '>');
if (v == FORM_INPUT_HIDDEN)
@@ -2452,7 +2485,7 @@ process_input(struct parsed_tag * tag)
}
void
-process_select(struct parsed_tag * tag)
+process_select(struct parsed_tag *tag)
{
char *p;
@@ -2460,21 +2493,23 @@ process_select(struct parsed_tag * tag)
parsedtag_get_value(tag, ATTR_NAME, &p);
cur_select = Strnew_charp(p);
select_is_multiple = parsedtag_exists(tag, ATTR_MULTIPLE);
-
+
#ifdef MENU_SELECT
if (!select_is_multiple) {
select_str = Sprintf("<pre_int>[<input_alt hseq=\"%d\" "
- "fid=\"%d\" type=select name=\"%s\" selectnumber=%d",
- cur_hseq++, cur_form_id, html_quote(p), n_select);
+ "fid=\"%d\" type=select name=\"%s\" selectnumber=%d",
+ cur_hseq++, cur_form_id, html_quote(p), n_select);
Strcat_charp(select_str, ">");
- if (n_select == max_select) {
- max_select *= 2;
- select_option = New_Reuse(FormSelectOption, select_option, max_select);
- }
+ if (n_select == max_select) {
+ max_select *= 2;
+ select_option =
+ New_Reuse(FormSelectOption, select_option, max_select);
+ }
select_option[n_select].first = NULL;
select_option[n_select].last = NULL;
cur_option_maxwidth = 0;
- } else
+ }
+ else
#endif /* MENU_SELECT */
select_str = Strnew();
cur_option = NULL;
@@ -2490,14 +2525,15 @@ process_n_select(void)
process_option();
#ifdef MENU_SELECT
if (!select_is_multiple) {
- if (select_option[n_select].first) {
- FormItemList sitem;
- chooseSelectOption(&sitem, select_option[n_select].first);
- Strcat(select_str, textfieldrep(sitem.label, cur_option_maxwidth));
- }
+ if (select_option[n_select].first) {
+ FormItemList sitem;
+ chooseSelectOption(&sitem, select_option[n_select].first);
+ Strcat(select_str, textfieldrep(sitem.label, cur_option_maxwidth));
+ }
Strcat_charp(select_str, "</input_alt>]</pre_int>");
n_select++;
- } else
+ }
+ else
#endif /* MENU_SELECT */
Strcat_charp(select_str, "<br>");
cur_select = NULL;
@@ -2516,8 +2552,7 @@ feed_select(char *str)
if (cur_select == NULL)
return;
while (read_token(tmp, &str, &cur_status, 0, 0)) {
- if (cur_status != R_ST_NORMAL ||
- prev_status != R_ST_NORMAL)
+ if (cur_status != R_ST_NORMAL || prev_status != R_ST_NORMAL)
continue;
p = tmp->ptr;
if (tmp->ptr[0] == '<' && Strlastchar(tmp) == '>') {
@@ -2589,8 +2624,7 @@ process_option(void)
cur_option_maxwidth = cur_option_label->length;
addSelectOption(&select_option[n_select],
cur_option_value,
- cur_option_label,
- cur_option_selected);
+ cur_option_label, cur_option_selected);
return;
}
#endif /* MENU_SELECT */
@@ -2599,11 +2633,11 @@ process_option(void)
end_char = ')';
}
Strcat(select_str, Sprintf("<br><pre_int>%c<input_alt hseq=\"%d\" "
- "fid=\"%d\" type=%s name=\"%s\" value=\"%s\"",
- begin_char, cur_hseq++, cur_form_id,
- select_is_multiple ? "checkbox" : "radio",
- html_quote(cur_select->ptr),
- html_quote(cur_option_value->ptr)));
+ "fid=\"%d\" type=%s name=\"%s\" value=\"%s\"",
+ begin_char, cur_hseq++, cur_form_id,
+ select_is_multiple ? "checkbox" : "radio",
+ html_quote(cur_select->ptr),
+ html_quote(cur_option_value->ptr)));
if (cur_option_selected)
Strcat_charp(select_str, " checked>*</input_alt>");
else
@@ -2615,7 +2649,7 @@ process_option(void)
}
Str
-process_textarea(struct parsed_tag * tag, int width)
+process_textarea(struct parsed_tag *tag, int width)
{
char *p;
@@ -2624,22 +2658,22 @@ process_textarea(struct parsed_tag * tag, int width)
cur_textarea = Strnew_charp(p);
cur_textarea_size = 20;
if (parsedtag_get_value(tag, ATTR_COLS, &p)) {
- cur_textarea_size = atoi(p);
- if (p[strlen(p) - 1] == '%')
- cur_textarea_size = width * cur_textarea_size / 100 - 2;
- if (cur_textarea_size <= 0)
- cur_textarea_size = 20;
+ cur_textarea_size = atoi(p);
+ if (p[strlen(p) - 1] == '%')
+ cur_textarea_size = width * cur_textarea_size / 100 - 2;
+ if (cur_textarea_size <= 0)
+ cur_textarea_size = 20;
}
cur_textarea_rows = 1;
if (parsedtag_get_value(tag, ATTR_ROWS, &p)) {
- cur_textarea_rows = atoi(p);
- if (cur_textarea_rows <= 0)
- cur_textarea_rows = 1;
+ cur_textarea_rows = atoi(p);
+ if (cur_textarea_rows <= 0)
+ cur_textarea_rows = 1;
}
cur_textarea_readonly = parsedtag_exists(tag, ATTR_READONLY);
if (n_textarea >= max_textarea) {
- max_textarea *= 2;
- textarea_str = New_Reuse(Str, textarea_str, max_textarea);
+ max_textarea *= 2;
+ textarea_str = New_Reuse(Str, textarea_str, max_textarea);
}
textarea_str[n_textarea] = Strnew();
ignore_nl_textarea = TRUE;
@@ -2658,17 +2692,17 @@ process_n_textarea(void)
tmp = Strnew();
Strcat(tmp, Sprintf("<pre_int>[<input_alt hseq=\"%d\" fid=\"%d\" "
- "type=textarea name=\"%s\" size=%d rows=%d "
- "top_margin=%d textareanumber=%d",
- cur_hseq, cur_form_id,
- html_quote(cur_textarea->ptr),
- cur_textarea_size, cur_textarea_rows,
- cur_textarea_rows - 1, n_textarea));
+ "type=textarea name=\"%s\" size=%d rows=%d "
+ "top_margin=%d textareanumber=%d",
+ cur_hseq, cur_form_id,
+ html_quote(cur_textarea->ptr),
+ cur_textarea_size, cur_textarea_rows,
+ cur_textarea_rows - 1, n_textarea));
if (cur_textarea_readonly)
- Strcat_charp(tmp, " readonly");
+ Strcat_charp(tmp, " readonly");
Strcat_charp(tmp, "><u>");
for (i = 0; i < cur_textarea_size; i++)
- Strcat_char(tmp, ' ');
+ Strcat_char(tmp, ' ');
Strcat_charp(tmp, "</u></input_alt>]</pre_int>\n");
cur_hseq++;
n_textarea++;
@@ -2681,22 +2715,23 @@ void
feed_textarea(char *str)
{
if (cur_textarea == NULL)
- return;
+ return;
if (ignore_nl_textarea) {
- if (*str == '\r')
- str++;
- if (*str == '\n')
- str++;
+ if (*str == '\r')
+ str++;
+ if (*str == '\n')
+ str++;
}
ignore_nl_textarea = FALSE;
while (*str) {
- if (*str == '&')
- Strcat_charp(textarea_str[n_textarea], getescapecmd(&str));
- else if (*str == '\n') {
- Strcat_charp(textarea_str[n_textarea], "\r\n");
- str++;
- } else if (*str != '\r')
- Strcat_char(textarea_str[n_textarea], *(str++));
+ if (*str == '&')
+ Strcat_charp(textarea_str[n_textarea], getescapecmd(&str));
+ else if (*str == '\n') {
+ Strcat_charp(textarea_str[n_textarea], "\r\n");
+ str++;
+ }
+ else if (*str != '\r')
+ Strcat_char(textarea_str[n_textarea], *(str++));
}
}
@@ -2704,26 +2739,26 @@ Str
process_hr(struct parsed_tag *tag, int width, int indent_width)
{
Str tmp = Strnew_charp("<nobr>");
- int i,w = 0;
+ int i, w = 0;
int x = ALIGN_CENTER;
if (width > indent_width)
- width -= indent_width;
+ width -= indent_width;
if (parsedtag_get_value(tag, ATTR_WIDTH, &w))
- w = REAL_WIDTH(w, width);
+ w = REAL_WIDTH(w, width);
else
- w = width;
+ w = width;
parsedtag_get_value(tag, ATTR_ALIGN, &x);
switch (x) {
case ALIGN_CENTER:
- Strcat_charp(tmp,"<div align=center>");
+ Strcat_charp(tmp, "<div align=center>");
break;
case ALIGN_RIGHT:
- Strcat_charp(tmp,"<div align=right>");
+ Strcat_charp(tmp, "<div align=right>");
break;
case ALIGN_LEFT:
- Strcat_charp(tmp,"<div align=left>");
+ Strcat_charp(tmp, "<div align=left>");
break;
}
#ifndef KANJI_SYMBOLS
@@ -2731,14 +2766,14 @@ process_hr(struct parsed_tag *tag, int width, int indent_width)
#endif /* not KANJI_SYMBOLS */
w -= HR_RULE_WIDTH - 1;
if (w <= 0)
- w = 1;
+ w = 1;
for (i = 0; i < w; i += HR_RULE_WIDTH) {
Strcat_charp(tmp, HR_RULE);
}
#ifndef KANJI_SYMBOLS
Strcat_charp(tmp, "</_RULE>");
#endif /* not KANJI_SYMBOLS */
- Strcat_charp(tmp,"</div></nobr>");
+ Strcat_charp(tmp, "</div></nobr>");
return tmp;
}
@@ -2781,7 +2816,7 @@ check_accept_charset(char *s)
}
return 0;
}
-#endif /* JP_CHARSET */
+#endif /* JP_CHARSET */
Str
process_form(struct parsed_tag *tag)
@@ -2797,9 +2832,9 @@ process_form(struct parsed_tag *tag)
#ifdef JP_CHARSET
if (parsedtag_get_value(tag, ATTR_ACCEPT_CHARSET, &r))
cs = check_accept_charset(r);
- if (! cs && parsedtag_get_value(tag, ATTR_CHARSET, &r))
+ if (!cs && parsedtag_get_value(tag, ATTR_CHARSET, &r))
cs = check_charset(r);
-#endif /*JP_CHARSET */
+#endif /*JP_CHARSET */
s = NULL;
parsedtag_get_value(tag, ATTR_ENCTYPE, &s);
tg = NULL;
@@ -2819,7 +2854,8 @@ process_form(struct parsed_tag *tag)
form_stack = New_Reuse(int, form_stack, forms_size);
}
forms[form_max] =
- newFormList(q, p, &cs, s, tg, n, (form_max > 0) ? forms[form_max - 1] : NULL);
+ newFormList(q, p, &cs, s, tg, n,
+ (form_max > 0) ? forms[form_max - 1] : NULL);
form_stack[form_sp] = form_max;
return NULL;
@@ -2836,8 +2872,7 @@ process_n_form(void)
static void
clear_ignore_p_flag(int cmd, struct readbuffer *obuf)
{
- static int clear_flag_cmd[] =
- {
+ static int clear_flag_cmd[] = {
HTML_HR, HTML_UNKNOWN
};
int i;
@@ -2934,11 +2969,11 @@ ul_type(struct parsed_tag *tag, int default_type)
char *p;
if (parsedtag_get_value(tag, ATTR_TYPE, &p)) {
if (!strcasecmp(p, "disc"))
- return (int) 'd';
+ return (int)'d';
else if (!strcasecmp(p, "circle"))
- return (int) 'c';
+ return (int)'c';
else if (!strcasecmp(p, "square"))
- return (int) 's';
+ return (int)'s';
}
return default_type;
}
@@ -3009,7 +3044,8 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
CLOSE_P;
if (!(obuf->flag & RB_IGNORE_P)) {
flushline(h_env, obuf, envs[h_env->envc].indent, 1, h_env->limit);
- do_blankline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
+ do_blankline(h_env, obuf, envs[h_env->envc].indent, 0,
+ h_env->limit);
}
obuf->flag |= RB_IGNORE_P;
if (cmd == HTML_P) {
@@ -3028,7 +3064,8 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
case HTML_H:
if (!(obuf->flag & (RB_PREMODE | RB_IGNORE_P))) {
flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
- do_blankline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
+ do_blankline(h_env, obuf, envs[h_env->envc].indent, 0,
+ h_env->limit);
}
HTMLlineproc1("<b>", h_env);
set_alignment(obuf, tag);
@@ -3051,24 +3088,24 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
if (!(obuf->flag & RB_PREMODE) &&
(h_env->envc == 0 || cmd == HTML_BLQ))
- do_blankline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
+ do_blankline(h_env, obuf, envs[h_env->envc].indent, 0,
+ h_env->limit);
}
PUSH_ENV(cmd);
if (cmd == HTML_UL || cmd == HTML_OL) {
- if (parsedtag_get_value(tag, ATTR_START, &count) &&
- count > 0) {
+ if (parsedtag_get_value(tag, ATTR_START, &count) && count > 0) {
envs[h_env->envc].count = count - 1;
}
}
if (cmd == HTML_OL) {
envs[h_env->envc].type = '1';
if (parsedtag_get_value(tag, ATTR_TYPE, &p)) {
- envs[h_env->envc].type = (int) *p;
+ envs[h_env->envc].type = (int)*p;
}
}
if (cmd == HTML_UL)
envs[h_env->envc].type = ul_type(tag, 0);
- flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
+ flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
return 1;
case HTML_N_UL:
case HTML_N_OL:
@@ -3077,14 +3114,14 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
CLOSE_DT;
CLOSE_P;
if (h_env->envc > 0) {
- flushline(h_env, obuf, envs[h_env->envc - 1].indent, 0, h_env->limit);
+ flushline(h_env, obuf, envs[h_env->envc - 1].indent, 0,
+ h_env->limit);
POP_ENV;
if (!(obuf->flag & RB_PREMODE) &&
(h_env->envc == 0 || cmd == HTML_N_DL || cmd == HTML_N_BLQ)) {
do_blankline(h_env, obuf,
envs[h_env->envc].indent,
- INDENT_INCR,
- h_env->limit);
+ INDENT_INCR, h_env->limit);
obuf->flag |= RB_IGNORE_P;
}
}
@@ -3095,7 +3132,8 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
if (!(obuf->flag & RB_IGNORE_P)) {
flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
if (!(obuf->flag & RB_PREMODE))
- do_blankline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
+ do_blankline(h_env, obuf, envs[h_env->envc].indent, 0,
+ h_env->limit);
}
PUSH_ENV(cmd);
if (parsedtag_exists(tag, ATTR_COMPACT))
@@ -3133,7 +3171,9 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
break;
#endif /* KANJI_SYMBOLS */
default:
- push_charp(obuf, 2, ullevel[(h_env->envc_real - 1) % MAX_UL_LEVEL], PC_ASCII);
+ push_charp(obuf, 2,
+ ullevel[(h_env->envc_real - 1) % MAX_UL_LEVEL],
+ PC_ASCII);
break;
}
push_charp(obuf, 1, NBSP, PC_ASCII);
@@ -3141,7 +3181,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
break;
case HTML_OL:
if (parsedtag_get_value(tag, ATTR_TYPE, &p))
- envs[h_env->envc].type = (int) *p;
+ envs[h_env->envc].type = (int)*p;
switch (envs[h_env->envc].type) {
case 'i':
num = romanNumeral(envs[h_env->envc].count);
@@ -3202,7 +3242,8 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
CLOSE_DT;
if (envs[h_env->envc].env == HTML_DL_COMPACT) {
if (obuf->pos > envs[h_env->envc].indent)
- flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
+ flushline(h_env, obuf, envs[h_env->envc].indent, 0,
+ h_env->limit);
else
push_spaces(obuf, 1, envs[h_env->envc].indent - obuf->pos);
}
@@ -3230,11 +3271,8 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
obuf->line = save_line;
obuf->prevchar = save_prevchar;
back_to_breakpoint(obuf);
- tmp = Strnew_m_charp(
- "<title_alt title=\"",
- html_quote(h_env->title),
- "\">",
- NULL);
+ tmp = Strnew_m_charp("<title_alt title=\"",
+ html_quote(h_env->title), "\">", NULL);
push_tag(obuf, tmp->ptr, HTML_TITLE_ALT);
return 1;
case HTML_FRAMESET:
@@ -3264,8 +3302,8 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
return 0;
case HTML_HR:
- tmp = process_hr(tag,h_env->limit,envs[h_env->envc].indent);
- HTMLlineproc1(tmp->ptr,h_env);
+ tmp = process_hr(tag, h_env->limit, envs[h_env->envc].indent);
+ HTMLlineproc1(tmp->ptr, h_env);
obuf->prevchar = ' ';
close_anchor(h_env, obuf);
return 1;
@@ -3390,17 +3428,17 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
}
return 1;
case HTML_INPUT_ALT:
- i = 0;
- if (parsedtag_get_value(tag, ATTR_TOP_MARGIN, &i)) {
- if (i > obuf->top_margin)
- obuf->top_margin = i;
- }
- i = 0;
- if (parsedtag_get_value(tag, ATTR_BOTTOM_MARGIN, &i)) {
- if (i > obuf->bottom_margin)
- obuf->bottom_margin = i;
- }
- return 0;
+ i = 0;
+ if (parsedtag_get_value(tag, ATTR_TOP_MARGIN, &i)) {
+ if (i > obuf->top_margin)
+ obuf->top_margin = i;
+ }
+ i = 0;
+ if (parsedtag_get_value(tag, ATTR_BOTTOM_MARGIN, &i)) {
+ if (i > obuf->bottom_margin)
+ obuf->bottom_margin = i;
+ }
+ return 0;
case HTML_TABLE:
obuf->table_level++;
if (obuf->table_level >= MAX_TABLE)
@@ -3572,27 +3610,32 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
}
if (s_tmp) {
q = html_quote(s_tmp->ptr);
- tmp = Sprintf("Refresh (%d sec) <a hseq=\"%d\" href=\"%s\">%s</a>",
- refresh, cur_hseq++, q, q);
+ tmp =
+ Sprintf
+ ("Refresh (%d sec) <a hseq=\"%d\" href=\"%s\">%s</a>",
+ refresh, cur_hseq++, q, q);
push_str(obuf, s_tmp->length, tmp, PC_ASCII);
- flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
+ flushline(h_env, obuf, envs[h_env->envc].indent, 0,
+ h_env->limit);
if (!is_redisplay && refresh == 0 && MetaRefresh) {
pushEvent(FUNCNAME_goURL, s_tmp->ptr);
/* pushEvent(deletePrevBuf,NULL); */
}
#ifdef USE_ALARM
else if (!is_redisplay && refresh > 0 && MetaRefresh) {
- setAlarmEvent(refresh, AL_IMPLICIT, FUNCNAME_goURL, s_tmp->ptr);
+ setAlarmEvent(refresh, AL_IMPLICIT, FUNCNAME_goURL,
+ s_tmp->ptr);
}
#endif
}
#ifdef USE_ALARM
- else if (!is_redisplay && refresh > 0 && MetaRefresh) {
+ else if (!is_redisplay && refresh > 0 && MetaRefresh) {
tmp = Sprintf("Refresh (%d sec)", refresh);
push_str(obuf, 0, tmp, PC_ASCII);
- flushline(h_env, obuf, envs[h_env->envc].indent, 0, h_env->limit);
+ flushline(h_env, obuf, envs[h_env->envc].indent, 0,
+ h_env->limit);
setAlarmEvent(refresh, AL_IMPLICIT, FUNCNAME_reload, NULL);
- }
+ }
#endif
}
return 1;
@@ -3652,8 +3695,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
if (parsedtag_get_value(tag, ATTR_BACKGROUND, &p)) {
Str s;
q = html_quote(p);
- s = Sprintf("<IMG SRC=\"%s\" ALT=\"bg image(%s)\"><BR>",
- q, q);
+ s = Sprintf("<IMG SRC=\"%s\" ALT=\"bg image(%s)\"><BR>", q, q);
HTMLlineproc1(s->ptr, h_env);
}
}
@@ -3661,7 +3703,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
obuf->flag |= RB_IGNORE_P;
return 1;
default:
-/* obuf->prevchar = '\0'; */
+ /* obuf->prevchar = '\0'; */
return 0;
}
/* not reached */
@@ -3685,7 +3727,7 @@ textlist_feed()
}
static void
-HTMLlineproc2body(Buffer * buf, Str (*feed) (), int llimit)
+HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit)
{
Anchor *a_href = NULL, *a_img = NULL, *a_form = NULL;
char outc[LINELEN];
@@ -3729,10 +3771,11 @@ HTMLlineproc2body(Buffer * buf, Str (*feed) (), int llimit)
while (str < endp && pos < LINELEN) {
mode = get_mctype(str);
#ifndef KANJI_SYMBOLS
- if (effect & PC_RULE && *str != '<') {
- PPUSH(PC_ASCII | effect, rule | 0x80);
+ if (effect & PC_RULE && *str != '<') {
+ PPUSH(PC_ASCII | effect, rule | 0x80);
str++;
- } else
+ }
+ else
#endif
if (mode == PC_CTRL || IS_INTSPACE(*str)) {
PPUSH(PC_ASCII | effect, ' ');
@@ -3823,10 +3866,8 @@ HTMLlineproc2body(Buffer * buf, Str (*feed) (), int llimit)
putAnchor(idFrame->body->nameList,
id,
NULL,
- (Anchor **) NULL,
- NULL,
- currentLn(buf),
- pos);
+ (Anchor **)NULL,
+ NULL, currentLn(buf), pos);
if (p) {
effect |= PE_ANCHOR;
a_href = registerHref(buf, remove_space(p), q,
@@ -3849,8 +3890,7 @@ HTMLlineproc2body(Buffer * buf, Str (*feed) (), int llimit)
if (parsedtag_get_value(tag, ATTR_SRC, &p)) {
p = remove_space(p);
p = url_quote_conv(p, buf->document_code);
- a_img = registerImg(buf, p,
- currentLn(buf), pos);
+ a_img = registerImg(buf, p, currentLn(buf), pos);
}
effect |= PE_IMAGE;
break;
@@ -3865,14 +3905,14 @@ HTMLlineproc2body(Buffer * buf, Str (*feed) (), int llimit)
case HTML_INPUT_ALT:
{
FormList *form;
- int top = 0, bottom = 0;
+ int top = 0, bottom = 0;
int form_id = -1;
hseq = 0;
parsedtag_get_value(tag, ATTR_HSEQ, &hseq);
parsedtag_get_value(tag, ATTR_FID, &form_id);
- parsedtag_get_value(tag, ATTR_TOP_MARGIN, &top);
- parsedtag_get_value(tag, ATTR_BOTTOM_MARGIN, &bottom);
+ parsedtag_get_value(tag, ATTR_TOP_MARGIN, &top);
+ parsedtag_get_value(tag, ATTR_BOTTOM_MARGIN, &bottom);
if (form_id < 0 || form_id > form_max || forms == NULL)
break; /* outside of <form>..</form> */
form = forms[form_id];
@@ -3881,15 +3921,17 @@ HTMLlineproc2body(Buffer * buf, Str (*feed) (), int llimit)
if (*str == '[')
hpos++;
buf->hmarklist =
- putHmarker(buf->hmarklist, currentLn(buf), hpos, hseq - 1);
+ putHmarker(buf->hmarklist, currentLn(buf),
+ hpos, hseq - 1);
}
if (!form->target)
form->target = buf->baseTarget;
- a_form = registerForm(buf, form, tag, currentLn(buf), pos);
+ a_form =
+ registerForm(buf, form, tag, currentLn(buf), pos);
if (a_form) {
- a_form->hseq = hseq - 1;
- a_form->y = currentLn(buf) - top;
- a_form->rows = 1 + top + bottom;
+ a_form->hseq = hseq - 1;
+ a_form->y = currentLn(buf) - top;
+ a_form->rows = 1 + top + bottom;
if (!parsedtag_exists(tag, ATTR_NO_EFFECT))
effect |= PE_FORM;
break;
@@ -3921,13 +3963,13 @@ HTMLlineproc2body(Buffer * buf, Str (*feed) (), int llimit)
break;
case HTML_AREA:
if (buf->maplist == NULL) /* outside of *
- * <map>..</map> */
+ * * * * * <map>..</map> */
break;
if (parsedtag_get_value(tag, ATTR_HREF, &p)) {
p = remove_space(p);
p = url_quote_conv(p, buf->document_code);
pushText(buf->maplist->urls, p);
- if (parsedtag_get_value(tag, ATTR_ALT, &q))
+ if (parsedtag_get_value(tag, ATTR_ALT, &q))
pushText(buf->maplist->alts, q);
else
pushText(buf->maplist->alts, "");
@@ -3945,11 +3987,13 @@ HTMLlineproc2body(Buffer * buf, Str (*feed) (), int llimit)
buf->frameset = frameset_s[frameset_sp];
}
else
- pushFrameTree(&(buf->frameQ), frameset_s[frameset_sp], NULL);
+ pushFrameTree(&(buf->frameQ),
+ frameset_s[frameset_sp], NULL);
}
else
addFrameSetElement(frameset_s[frameset_sp - 1],
- *(union frameset_element *) &frameset_s[frameset_sp]);
+ *(union frameset_element *)
+ &frameset_s[frameset_sp]);
break;
case HTML_N_FRAMESET:
if (frameset_sp >= 0)
@@ -3972,7 +4016,8 @@ HTMLlineproc2body(Buffer * buf, Str (*feed) (), int llimit)
parseURL(p, buf->baseURL, NULL);
}
if (parsedtag_get_value(tag, ATTR_TARGET, &p))
- buf->baseTarget = url_quote_conv(p, buf->document_code);
+ buf->baseTarget =
+ url_quote_conv(p, buf->document_code);
break;
case HTML_TITLE_ALT:
if (parsedtag_get_value(tag, ATTR_TITLE, &p))
@@ -3981,8 +4026,8 @@ HTMLlineproc2body(Buffer * buf, Str (*feed) (), int llimit)
#ifndef KANJI_SYMBOLS
case HTML_RULE:
effect |= PC_RULE;
- if (parsedtag_get_value(tag, ATTR_TYPE, &p))
- rule = (char)atoi(p);
+ if (parsedtag_get_value(tag, ATTR_TYPE, &p))
+ rule = (char)atoi(p);
break;
case HTML_N_RULE:
effect &= ~PC_RULE;
@@ -4009,9 +4054,7 @@ HTMLlineproc2body(Buffer * buf, Str (*feed) (), int llimit)
putAnchor(idFrame->body->nameList,
id,
NULL,
- (Anchor **) NULL,
- NULL,
- currentLn(buf), pos);
+ (Anchor **)NULL, NULL, currentLn(buf), pos);
#endif /* ID_EXT */
}
}
@@ -4029,11 +4072,11 @@ HTMLlineproc2body(Buffer * buf, Str (*feed) (), int llimit)
if (w3m_debug)
fclose(debug);
if (n_textarea)
- addMultirowsForm(buf, buf->formitem);
+ addMultirowsForm(buf, buf->formitem);
}
void
-HTMLlineproc2(Buffer * buf, TextLineList * tl)
+HTMLlineproc2(Buffer *buf, TextLineList *tl)
{
_tl_lp2 = tl->first;
HTMLlineproc2body(buf, textlist_feed, -1);
@@ -4054,7 +4097,7 @@ file_feed()
}
void
-HTMLlineproc3(Buffer * buf, InputStream stream)
+HTMLlineproc3(Buffer *buf, InputStream stream)
{
_file_lp2 = stream;
HTMLlineproc2body(buf, file_feed, -1);
@@ -4078,7 +4121,7 @@ proc_escape(struct readbuffer *obuf, char **str_return)
check_breakpoint(obuf, obuf->flag & RB_SPECIAL, ech);
estr = conv_entity(ech);
width = strlen(estr);
- if (width == 1 && ech == (unsigned char) *estr &&
+ if (width == 1 && ech == (unsigned char)*estr &&
ech != '&' && ech != '<' && ech != '>')
push_charp(obuf, width, estr, mode);
else
@@ -4146,7 +4189,8 @@ HTMLlineproc0(char *istr, struct html_feed_environ *h_env, int internal)
(obuf->table_level >= 0) ? 'T' : ' ',
(obuf->flag & RB_INTXTA) ? 'X' : ' ',
(obuf->flag & RB_IGNORE) ? 'I' : ' ');
- fprintf(f, "HTMLlineproc1(\"%s\",%d,%lx)\n", istr, h_env->limit, (unsigned long) h_env);
+ fprintf(f, "HTMLlineproc1(\"%s\",%d,%lx)\n", istr, h_env->limit,
+ (unsigned long)h_env);
fclose(f);
}
@@ -4163,7 +4207,7 @@ HTMLlineproc0(char *istr, struct html_feed_environ *h_env, int internal)
tokbuf = Strnew();
- table_start:
+ table_start:
if (obuf->table_level >= 0) {
int level = min(obuf->table_level, MAX_TABLE - 1);
tbl = tables[level];
@@ -4175,19 +4219,17 @@ HTMLlineproc0(char *istr, struct html_feed_environ *h_env, int internal)
int is_tag = FALSE;
if (obuf->flag & RB_PLAIN)
- goto read_as_plain; /* don't process tag */
+ goto read_as_plain; /* don't process tag */
if (*str == '<' || ST_IS_TAG(obuf->status)) {
int pre_mode = (obuf->table_level >= 0) ?
- tbl_mode->pre_mode & TBLM_PLAIN :
- obuf->flag & RB_PLAINMODE;
+ tbl_mode->pre_mode & TBLM_PLAIN : obuf->flag & RB_PLAINMODE;
/*
* Tag processing
*/
if (ST_IS_TAG(obuf->status)) {
/*** continuation of a tag ***/
- read_token(h_env->tagbuf, &str, &obuf->status,
- pre_mode, 1);
+ read_token(h_env->tagbuf, &str, &obuf->status, pre_mode, 1);
}
else {
if (!REALLY_THE_BEGINNING_OF_A_TAG(str)) {
@@ -4197,8 +4239,7 @@ HTMLlineproc0(char *istr, struct html_feed_environ *h_env, int internal)
str++;
continue;
}
- read_token(h_env->tagbuf, &str, &obuf->status,
- pre_mode, 0);
+ read_token(h_env->tagbuf, &str, &obuf->status, pre_mode, 0);
}
if (ST_IS_COMMENT(obuf->status)) {
if (obuf->flag & RB_IGNORE)
@@ -4216,25 +4257,23 @@ HTMLlineproc0(char *istr, struct html_feed_environ *h_env, int internal)
if (ST_IS_REAL_TAG(obuf->status))
Strcat_char(h_env->tagbuf, ' ');
}
- if ((obuf->flag & RB_IGNORE) &&
- ! TAG_IS(h_env->tagbuf->ptr, obuf->ignore_tag->ptr,
- obuf->ignore_tag->length - 1))
- /* within ignored tag, such as *
- * <script>..</script>, don't process tag. */
- obuf->status = R_ST_NORMAL;
+ if ((obuf->flag & RB_IGNORE) &&
+ !TAG_IS(h_env->tagbuf->ptr, obuf->ignore_tag->ptr,
+ obuf->ignore_tag->length - 1))
+ /* within ignored tag, such as *
+ * <script>..</script>, don't process tag. */
+ obuf->status = R_ST_NORMAL;
continue;
}
is_tag = TRUE;
q = h_env->tagbuf->ptr;
}
- if (obuf->flag & (RB_INTXTA
- | RB_INSELECT
- | RB_IGNORE)) {
+ if (obuf->flag & (RB_INTXTA | RB_INSELECT | RB_IGNORE)) {
cmd = HTML_UNKNOWN;
if (!is_tag) {
- read_token(tokbuf, &str, &obuf->status,
- (obuf->flag & RB_INTXTA) ? 1 : 0, 0);
+ read_token(tokbuf, &str, &obuf->status,
+ (obuf->flag & RB_INTXTA) ? 1 : 0, 0);
if (obuf->status != R_ST_NORMAL)
continue;
q = tokbuf->ptr;
@@ -4243,7 +4282,7 @@ HTMLlineproc0(char *istr, struct html_feed_environ *h_env, int internal)
char *p = q;
cmd = gethtmlcmd(&p, NULL);
}
-
+
/* textarea */
if (obuf->flag & RB_INTXTA) {
if (cmd == HTML_N_TEXTAREA)
@@ -4279,7 +4318,7 @@ HTMLlineproc0(char *istr, struct html_feed_environ *h_env, int internal)
continue;
q = tokbuf->ptr;
}
-
+
switch (feed_table(tbl, q, tbl_mode, tbl_width, internal)) {
case 0:
/* </table> tag */
@@ -4341,8 +4380,7 @@ HTMLlineproc0(char *istr, struct html_feed_environ *h_env, int internal)
if (cmd == HTML_UNKNOWN)
continue;
/* process tags */
- if (HTMLtagproc1(tag, h_env) == 0)
- {
+ if (HTMLtagproc1(tag, h_env) == 0) {
/* preserve the tag for second-stage processing */
if (parsedtag_need_reconstruct(tag))
h_env->tagbuf = parsedtag2str(tag);
@@ -4365,21 +4403,22 @@ HTMLlineproc0(char *istr, struct html_feed_environ *h_env, int internal)
mode = get_mctype(str);
delta = get_mclen(mode);
if (obuf->flag & (RB_SPECIAL & ~RB_NOBR)) {
- char ch = *str;
- if (! (obuf->flag & RB_PLAINMODE) && (*str == '&')) {
- char *p = str;
- int ech = getescapechar(&p);
- if (ech == '\n' || ech == '\r') {
- ch = '\n';
- str = p - 1;
- } else if (ech == '\t') {
- ch = '\t';
- str = p - 1;
- }
- }
- if (ch != '\n')
+ char ch = *str;
+ if (!(obuf->flag & RB_PLAINMODE) && (*str == '&')) {
+ char *p = str;
+ int ech = getescapechar(&p);
+ if (ech == '\n' || ech == '\r') {
+ ch = '\n';
+ str = p - 1;
+ }
+ else if (ech == '\t') {
+ ch = '\t';
+ str = p - 1;
+ }
+ }
+ if (ch != '\n')
obuf->flag &= ~RB_IGNORE_P;
- if (ch == '\n') {
+ if (ch == '\n') {
str++;
if (obuf->flag & RB_IGNORE_P) {
obuf->flag &= ~RB_IGNORE_P;
@@ -4388,9 +4427,10 @@ HTMLlineproc0(char *istr, struct html_feed_environ *h_env, int internal)
if (obuf->flag & RB_PRE_INT)
PUSH(' ');
else
- flushline(h_env, obuf, h_env->envs[h_env->envc].indent, 1, h_env->limit);
+ flushline(h_env, obuf, h_env->envs[h_env->envc].indent, 1,
+ h_env->limit);
}
- else if (ch == '\t') {
+ else if (ch == '\t') {
do {
PUSH(' ');
} while (obuf->pos % Tabstop != 0);
@@ -4430,8 +4470,9 @@ HTMLlineproc0(char *istr, struct html_feed_environ *h_env, int internal)
obuf->pos > h_env->envs[h_env->envc].indent &&
Strlastchar(obuf->line) == ' ') {
while (obuf->line->length >= 2 &&
- !strncmp(obuf->line->ptr + obuf->line->length - 2, " ", 2) &&
- obuf->pos >= h_env->envs[h_env->envc].indent) {
+ !strncmp(obuf->line->ptr + obuf->line->length - 2,
+ " ", 2)
+ && obuf->pos >= h_env->envs[h_env->envc].indent) {
Strshrink(obuf->line, 1);
obuf->pos--;
}
@@ -4447,7 +4488,8 @@ HTMLlineproc0(char *istr, struct html_feed_environ *h_env, int internal)
if (*str == '&')
proc_escape(obuf, &str);
else
- proc_mchar(obuf, obuf->flag & RB_SPECIAL, delta, &str, mode);
+ proc_mchar(obuf, obuf->flag & RB_SPECIAL, delta, &str,
+ mode);
}
}
if (need_flushline(h_env, obuf, mode)) {
@@ -4519,9 +4561,9 @@ extern char *NullLine;
extern Lineprop NullProp[];
static void
-addnewline(Buffer * buf, char *line, Lineprop * prop,
+addnewline(Buffer *buf, char *line, Lineprop *prop,
#ifdef USE_ANSI_COLOR
- Linecolor * color,
+ Linecolor *color,
#endif
int pos, int nlines)
{
@@ -4531,7 +4573,7 @@ addnewline(Buffer * buf, char *line, Lineprop * prop,
if (pos > 0) {
l->lineBuf = allocStr(line, pos);
l->propBuf = NewAtom_N(Lineprop, pos);
- bcopy((void *) prop, (void *) l->propBuf, pos * sizeof(Lineprop));
+ bcopy((void *)prop, (void *)l->propBuf, pos * sizeof(Lineprop));
}
else {
l->lineBuf = NullLine;
@@ -4540,8 +4582,9 @@ addnewline(Buffer * buf, char *line, Lineprop * prop,
#ifdef USE_ANSI_COLOR
if (pos > 0 && color) {
l->colorBuf = NewAtom_N(Linecolor, pos);
- bcopy((void *) color, (void *) l->colorBuf, pos * sizeof(Linecolor));
- } else {
+ bcopy((void *)color, (void *)l->colorBuf, pos * sizeof(Linecolor));
+ }
+ else {
l->colorBuf = NULL;
}
#endif
@@ -4561,8 +4604,8 @@ addnewline(Buffer * buf, char *line, Lineprop * prop,
buf->firstLine = l;
l->linenumber = ++buf->allLine;
if (nlines < 0) {
-/* l->real_linenumber = l->linenumber; */
- l->real_linenumber = 0;
+ /* l->real_linenumber = l->linenumber; */
+ l->real_linenumber = 0;
}
else {
l->real_linenumber = nlines;
@@ -4574,7 +4617,7 @@ addnewline(Buffer * buf, char *line, Lineprop * prop,
* loadHTMLBuffer: read file and make new buffer
*/
Buffer *
-loadHTMLBuffer(URLFile * f, Buffer * newBuf)
+loadHTMLBuffer(URLFile *f, Buffer *newBuf)
{
FILE *src = NULL;
Str tmp;
@@ -4596,16 +4639,16 @@ loadHTMLBuffer(URLFile * f, Buffer * newBuf)
newBuf->lastLine = newBuf->currentLine;
newBuf->currentLine = newBuf->firstLine;
if (n_textarea)
- formResetBuffer(newBuf, newBuf->formitem);
+ formResetBuffer(newBuf, newBuf->formitem);
if (src)
fclose(src);
return newBuf;
}
-static char *_size_unit[] =
-{"b", "kb", "Mb", "Gb", "Tb",
- "Pb", "Eb", "Zb", "Bb", "Yb", NULL};
+static char *_size_unit[] = { "b", "kb", "Mb", "Gb", "Tb",
+ "Pb", "Eb", "Zb", "Bb", "Yb", NULL
+};
char *
convert_size(int size, int usefloat)
@@ -4614,14 +4657,13 @@ convert_size(int size, int usefloat)
int sizepos = 0;
char **sizes = _size_unit;
- csize = (float) size;
+ csize = (float)size;
while (csize >= 999.495 && sizes[sizepos + 1]) {
csize = csize / 1024.0;
sizepos++;
}
return Sprintf(usefloat ? "%.3g%s" : "%.0f%s",
- floor(csize * 100.0 + 0.5) / 100.0,
- sizes[sizepos])->ptr;
+ floor(csize * 100.0 + 0.5) / 100.0, sizes[sizepos])->ptr;
}
char *
@@ -4679,7 +4721,7 @@ showProgress(int *linelen, int *trbyte)
"%7s/s "
"eta %02d:%02d:%02d ",
fmtrbyte, ratio,
- fmrate,
+ fmrate,
eta / (60 * 60), (eta / 60) % 60, eta % 60);
}
else {
@@ -4732,7 +4774,7 @@ showProgress(int *linelen, int *trbyte)
void
init_henv(struct html_feed_environ *h_env, struct readbuffer *obuf,
- struct environment *envs, int nenv, TextLineList * buf,
+ struct environment *envs, int nenv, TextLineList *buf,
int limit, int indent)
{
envs[0].indent = indent;
@@ -4774,7 +4816,7 @@ init_henv(struct html_feed_environ *h_env, struct readbuffer *obuf,
h_env->blank_lines = 0;
}
-void
+void
completeHTMLstream(struct html_feed_environ *h_env, struct readbuffer *obuf)
{
close_anchor(h_env, obuf);
@@ -4803,7 +4845,7 @@ completeHTMLstream(struct html_feed_environ *h_env, struct readbuffer *obuf)
}
void
-loadHTMLstream(URLFile * f, Buffer * newBuf, FILE * src, int internal)
+loadHTMLstream(URLFile *f, Buffer *newBuf, FILE * src, int internal)
{
struct environment envs[MAX_ENV_LEVEL];
int linelen = 0;
@@ -4817,11 +4859,11 @@ loadHTMLstream(URLFile * f, Buffer * newBuf, FILE * src, int internal)
n_textarea = 0;
cur_textarea = NULL;
max_textarea = MAX_TEXTAREA;
- textarea_str = New_N(Str,max_textarea);
+ textarea_str = New_N(Str, max_textarea);
#ifdef MENU_SELECT
n_select = 0;
max_select = MAX_SELECT;
- select_option = New_N(FormSelectOption,max_select);
+ select_option = New_N(FormSelectOption, max_select);
#endif /* MENU_SELECT */
cur_select = NULL;
form_sp = -1;
@@ -4950,11 +4992,11 @@ loadHTMLString(Str page)
term_cbreak();
}
if (w3m_dump & DUMP_FRAME) {
- tmp = tmpfname(TMPF_SRC, ".html");
- pushText(fileToDelete, tmp->ptr);
- src = fopen(tmp->ptr, "w");
- if (src)
- newBuf->sourcefile = tmp->ptr;
+ tmp = tmpfname(TMPF_SRC, ".html");
+ pushText(fileToDelete, tmp->ptr);
+ src = fopen(tmp->ptr, "w");
+ if (src)
+ newBuf->sourcefile = tmp->ptr;
}
loadHTMLstream(&f, newBuf, src, TRUE);
@@ -4970,9 +5012,9 @@ loadHTMLString(Str page)
newBuf->document_code = InnerCode;
#endif /* JP_CHARSET */
if (n_textarea)
- formResetBuffer(newBuf, newBuf->formitem);
+ formResetBuffer(newBuf, newBuf->formitem);
if (src)
- fclose(src);
+ fclose(src);
return newBuf;
}
@@ -4983,7 +5025,7 @@ loadHTMLString(Str page)
* loadGopherDir: get gopher directory
*/
Buffer *
-loadGopherDir(URLFile * uf, Buffer * newBuf)
+loadGopherDir(URLFile *uf, Buffer *newBuf)
{
#ifdef JP_CHARSET
char code, ic;
@@ -5032,8 +5074,7 @@ loadGopherDir(URLFile * uf, Buffer * newBuf)
Strcat_char(host, *p);
p++;
for (port = Strnew(); *p &&
- *p != '\t' && *p != '\r' && *p != '\n';
- p++)
+ *p != '\t' && *p != '\r' && *p != '\n'; p++)
Strcat_char(port, *p);
p++;
type = name->ptr[0];
@@ -5087,7 +5128,7 @@ loadGopherDir(URLFile * uf, Buffer * newBuf)
* loadBuffer: read file and make new buffer
*/
Buffer *
-loadBuffer(URLFile * uf, Buffer * newBuf)
+loadBuffer(URLFile *uf, Buffer *newBuf)
{
FILE *src = NULL;
char code;
@@ -5190,7 +5231,7 @@ loadBuffer(URLFile * uf, Buffer * newBuf)
*/
void
-saveBuffer(Buffer * buf, FILE * f)
+saveBuffer(Buffer *buf, FILE * f)
{
saveBufferDelNum(buf, f, FALSE);
}
@@ -5210,7 +5251,8 @@ conv_rule(Line *l)
Strcopy_charp_n(tmp, l->lineBuf, p - l->lineBuf);
}
Strcat_char(tmp, alt_rule[*p & 0xF]);
- } else if (tmp != NULL)
+ }
+ else if (tmp != NULL)
Strcat_char(tmp, *p);
}
if (tmp)
@@ -5221,7 +5263,7 @@ conv_rule(Line *l)
#endif
void
-saveBufferDelNum(Buffer * buf, FILE * f, int del)
+saveBufferDelNum(Buffer *buf, FILE * f, int del)
{
Line *l = buf->firstLine;
Str tmp;
@@ -5230,18 +5272,18 @@ saveBufferDelNum(Buffer * buf, FILE * f, int del)
#ifndef KANJI_SYMBOLS
int is_html = FALSE;
- if (buf->type && ! strcasecmp(buf->type, "text/html"))
- is_html = TRUE;
+ if (buf->type && !strcasecmp(buf->type, "text/html"))
+ is_html = TRUE;
#endif
-
+
pager_next:
for (; l != NULL; l = l->next) {
#ifndef KANJI_SYMBOLS
- if (is_html)
- tmp = conv_rule(l);
- else
+ if (is_html)
+ tmp = conv_rule(l);
+ else
#endif
- tmp = Strnew_charp_n(l->lineBuf, l->len);
+ tmp = Strnew_charp_n(l->lineBuf, l->len);
#ifdef JP_CHARSET
tmp = conv_str(tmp, InnerCode, DisplayCode);
#endif
@@ -5257,8 +5299,7 @@ saveBufferDelNum(Buffer * buf, FILE * f, int del)
static Buffer *
loadcmdout(char *cmd,
- Buffer * (*loadproc) (URLFile *, Buffer *),
- Buffer * defaultbuf)
+ Buffer *(*loadproc) (URLFile *, Buffer *), Buffer *defaultbuf)
{
FILE *f, *popen(const char *, const char *);
Buffer *buf;
@@ -5269,7 +5310,7 @@ loadcmdout(char *cmd,
f = popen(cmd, "r");
if (f == NULL)
return NULL;
- init_stream(&uf, SCM_UNKNOWN, newFileStream(f, (void (*)()) pclose));
+ init_stream(&uf, SCM_UNKNOWN, newFileStream(f, (void (*)())pclose));
buf = loadproc(&uf, defaultbuf);
UFclose(&uf);
if (buf == NULL)
@@ -5288,7 +5329,7 @@ getshell(char *cmd)
buf = loadcmdout(cmd, loadBuffer, NULL);
buf->filename = cmd;
buf->buffername = Sprintf("%s %s", SHELLBUFFERNAME,
- conv_from_system(cmd))->ptr;
+ conv_from_system(cmd))->ptr;
return buf;
}
@@ -5307,10 +5348,10 @@ getpipe(char *cmd)
if (f == NULL)
return NULL;
buf = newBuffer(INIT_BUFFER_WIDTH);
- buf->pagerSource = newFileStream(f, (void (*)()) pclose);
+ buf->pagerSource = newFileStream(f, (void (*)())pclose);
buf->filename = cmd;
buf->buffername = Sprintf("%s %s", PIPEBUFFERNAME,
- conv_from_system(cmd))->ptr;
+ conv_from_system(cmd))->ptr;
buf->bufferprop |= BP_PIPE;
return buf;
}
@@ -5319,7 +5360,7 @@ getpipe(char *cmd)
* Open pager buffer
*/
Buffer *
-openPagerBuffer(InputStream stream, Buffer * buf)
+openPagerBuffer(InputStream stream, Buffer *buf)
{
if (buf == NULL)
@@ -5373,8 +5414,8 @@ openGeneralPagerBuffer(InputStream stream)
buf->type = "text/html";
}
else if (is_plain_text_type(t)) {
- if (IStype(stream) != IST_ENCODED)
- stream = newEncodedStream(stream, uf.encoding);
+ if (IStype(stream) != IST_ENCODED)
+ stream = newEncodedStream(stream, uf.encoding);
buf = openPagerBuffer(stream, t_buf);
buf->type = "text/plain";
}
@@ -5384,8 +5425,8 @@ openGeneralPagerBuffer(InputStream stream)
return buf;
}
else { /* unknown type is regarded as text/plain */
- if (IStype(stream) != IST_ENCODED)
- stream = newEncodedStream(stream, uf.encoding);
+ if (IStype(stream) != IST_ENCODED)
+ stream = newEncodedStream(stream, uf.encoding);
buf = openPagerBuffer(stream, t_buf);
buf->type = "text/plain";
}
@@ -5397,7 +5438,7 @@ openGeneralPagerBuffer(InputStream stream)
}
Line *
-getNextPage(Buffer * buf, int plen)
+getNextPage(Buffer *buf, int plen)
{
Line *l, *fl, *pl = buf->lastLine;
Line *rl = NULL;
@@ -5434,7 +5475,9 @@ getNextPage(Buffer * buf, int plen)
/* Assume that `cmd == buf->filename' */
if (buf->filename)
buf->buffername = Sprintf("%s %s",
- CPIPEBUFFERNAME, conv_from_system(buf->filename))->ptr;
+ CPIPEBUFFERNAME,
+ conv_from_system(buf->filename))->
+ ptr;
else if (getenv("MAN_PN") == NULL)
buf->buffername = CPIPEBUFFERNAME;
buf->bufferprop |= BP_CLOSE;
@@ -5442,8 +5485,8 @@ getNextPage(Buffer * buf, int plen)
linelen = 0;
break;
}
- linelen += lineBuf2->length;
- showProgress(&linelen, &trbyte);
+ linelen += lineBuf2->length;
+ showProgress(&linelen, &trbyte);
lineBuf2 = convertLine(&uf, lineBuf2, &code, PAGER_MODE);
if (squeezeBlankLine) {
squeeze_flag = 0;
@@ -5466,29 +5509,31 @@ getNextPage(Buffer * buf, int plen)
l = New(Line);
l->lineBuf = lineBuf2->ptr;
l->propBuf = NewAtom_N(Lineprop, len);
- bcopy((void *) propBuffer, (void *) l->propBuf, len * sizeof(Lineprop));
+ bcopy((void *)propBuffer, (void *)l->propBuf, len * sizeof(Lineprop));
#ifdef USE_ANSI_COLOR
if (check_color) {
l->colorBuf = NewAtom_N(Linecolor, len);
- bcopy((void *) colorBuffer, (void *) l->colorBuf, len * sizeof(Linecolor));
- } else {
+ bcopy((void *)colorBuffer, (void *)l->colorBuf,
+ len * sizeof(Linecolor));
+ }
+ else {
l->colorBuf = NULL;
}
#endif
l->len = len;
l->width = -1;
l->prev = pl;
-/*
+#if 0
if (squeezeBlankLine) {
-*/
+#endif
l->real_linenumber = nlines;
l->linenumber = (pl == NULL ? nlines : pl->linenumber + 1);
-/*
+#if 0
}
else {
l->real_linenumber = l->linenumber = nlines;
}
-*/
+#endif
if (pl == NULL) {
pl = l;
buf->firstLine = buf->topLine = buf->currentLine = l;
@@ -5588,7 +5633,7 @@ save2tmp(URLFile uf, char *tmpf)
linelen += buf->length;
showProgress(&linelen, &trbyte);
}
- }
+ }
_end:
bcopy(env_bak, AbortLoading, sizeof(JMP_BUF));
if (fmInitialized) {
@@ -5602,7 +5647,8 @@ save2tmp(URLFile uf, char *tmpf)
}
int
-doExternal(URLFile uf, char *path, char *type, Buffer **bufp, Buffer *defaultbuf)
+doExternal(URLFile uf, char *path, char *type, Buffer **bufp,
+ Buffer *defaultbuf)
{
Str tmpf, command;
struct mailcap *mcap;
@@ -5616,7 +5662,8 @@ doExternal(URLFile uf, char *path, char *type, Buffer **bufp, Buffer *defaultbuf
tmpf = tmpfname(TMPF_DFL, NULL);
if (mcap->nametemplate) {
- Str tmp = unquote_mailcap(mcap->nametemplate, NULL, tmpf->ptr, NULL, NULL);
+ Str tmp =
+ unquote_mailcap(mcap->nametemplate, NULL, tmpf->ptr, NULL, NULL);
if (Strncmp(tmpf, tmp, tmpf->length) == 0) {
tmpf = tmp;
goto _save;
@@ -5625,9 +5672,9 @@ doExternal(URLFile uf, char *path, char *type, Buffer **bufp, Buffer *defaultbuf
if (uf.ext && *uf.ext) {
Strcat_charp(tmpf, uf.ext);
}
- _save:
+ _save:
if (IStype(uf.stream) != IST_ENCODED)
- uf.stream = newEncodedStream(uf.stream, uf.encoding);
+ uf.stream = newEncodedStream(uf.stream, uf.encoding);
if (save2tmp(uf, tmpf->ptr) < 0)
return 0;
header = checkHeader(defaultbuf, "Content-Type:");
@@ -5640,7 +5687,7 @@ doExternal(URLFile uf, char *path, char *type, Buffer **bufp, Buffer *defaultbuf
command = tmp;
}
#endif
- if (mcap->flags & (MAILCAP_HTMLOUTPUT|MAILCAP_COPIOUSOUTPUT)) {
+ if (mcap->flags & (MAILCAP_HTMLOUTPUT | MAILCAP_COPIOUSOUTPUT)) {
if (defaultbuf == NULL)
defaultbuf = newBuffer(INIT_BUFFER_WIDTH);
defaultbuf->mailcap = mcap;
@@ -5668,7 +5715,8 @@ doExternal(URLFile uf, char *path, char *type, Buffer **bufp, Buffer *defaultbuf
fmInit();
if (Currentbuf)
displayBuffer(Currentbuf, B_FORCE_REDRAW);
- } else {
+ }
+ else {
mySystem(command->ptr, 1);
}
buf = NO_BUFFER;
@@ -5735,7 +5783,7 @@ doFileCopy(char *tmpf, char *defstr)
p = searchKeyData();
if (p == NULL || *p == '\0') {
p = inputLineHist("(Download)Save file to: ",
- defstr, IN_COMMAND, SaveHist);
+ defstr, IN_COMMAND, SaveHist);
if (p == NULL || *p == '\0')
return;
p = conv_to_system(p);
@@ -5765,7 +5813,7 @@ doFileCopy(char *tmpf, char *defstr)
return;
q = filen;
}
- for (p = q + strlen(q) - 1; IS_SPACE(*p); p--);
+ for (p = q + strlen(q) - 1; IS_SPACE(*p); p--) ;
*(p + 1) = '\0';
if (*q == '\0')
return;
@@ -5803,7 +5851,7 @@ doFileSave(URLFile uf, char *defstr)
p = searchKeyData();
if (p == NULL || *p == '\0') {
p = inputLineHist("(Download)Save file to: ",
- defstr, IN_FILENAME, SaveHist);
+ defstr, IN_FILENAME, SaveHist);
if (p == NULL || *p == '\0')
return;
p = conv_to_system(p);
@@ -5830,7 +5878,7 @@ doFileSave(URLFile uf, char *defstr)
return;
q = filen;
}
- for (p = q + strlen(q) - 1; IS_SPACE(*p); p--);
+ for (p = q + strlen(q) - 1; IS_SPACE(*p); p--) ;
*(p + 1) = '\0';
if (*q == '\0')
return;
@@ -5952,14 +6000,14 @@ gunzip_stream(URLFile *uf)
UFclose(uf);
return;
}
-/*
+#if 0
if (uf->scheme != SCM_FTP)
-*/
+#endif
UFclose(uf);
uf->scheme = SCM_LOCAL;
pushText(fileToDelete, tmpf);
}
-
+
flush_tty();
/* fd1[0]: read, fd1[1]: write */
if ((pid1 = fork()) == 0) {
@@ -5967,7 +6015,7 @@ gunzip_stream(URLFile *uf)
close(fd1[0]);
if (tmpf) {
#ifdef __CYGWIN__
- int tmpfd = open(tmpf, O_RDONLY|O_BINARY);
+ int tmpfd = open(tmpf, O_RDONLY | O_BINARY);
#else
int tmpfd = open(tmpf, O_RDONLY);
#endif
@@ -6013,7 +6061,7 @@ gunzip_stream(URLFile *uf)
close(fd1[1]);
if (tmpf == NULL)
UFclose(uf);
- uf->stream = newFileStream(fdopen(fd1[0], "rb"), (void (*)()) pclose);
+ uf->stream = newFileStream(fdopen(fd1[0], "rb"), (void (*)())pclose);
}
static FILE *
@@ -6058,15 +6106,15 @@ lessopen_stream(char *path)
#if 0
void
-reloadBuffer(Buffer * buf)
+reloadBuffer(Buffer *buf)
{
URLFile uf;
- if (buf->sourcefile == NULL ||
- buf->pagerSource != NULL)
+ if (buf->sourcefile == NULL || buf->pagerSource != NULL)
return;
init_stream(&uf, SCM_UNKNOWN, NULL);
- examineFile(buf->mailcap_source ? buf->mailcap_source : buf->sourcefile, &uf);
+ examineFile(buf->mailcap_source ? buf->mailcap_source : buf->sourcefile,
+ &uf);
if (uf.stream == NULL)
return;
is_redisplay = TRUE;
@@ -6098,11 +6146,9 @@ guess_charset(char *p)
}
if (strncmp(c->ptr, "euc", 3) == 0)
return CODE_EUC;
- if (strncmp(c->ptr, "shiftjis", 8) == 0 ||
- strncmp(c->ptr, "sjis", 4) == 0)
+ if (strncmp(c->ptr, "shiftjis", 8) == 0 || strncmp(c->ptr, "sjis", 4) == 0)
return CODE_SJIS;
- if (strncmp(c->ptr, "iso2022jp", 9) == 0 ||
- strncmp(c->ptr, "jis", 3) == 0)
+ if (strncmp(c->ptr, "iso2022jp", 9) == 0 || strncmp(c->ptr, "jis", 3) == 0)
return CODE_JIS_n;
return CODE_ASCII;
}
@@ -6138,13 +6184,13 @@ guess_save_name(Buffer *buf, char *path)
char *p, *q;
if ((p = checkHeader(buf, "Content-Disposition:")) != NULL &&
(q = strcasestr(p, "filename")) != NULL &&
- (q == p || IS_SPACE(*(q-1)) || *(q-1) == ';')) {
+ (q == p || IS_SPACE(*(q - 1)) || *(q - 1) == ';')) {
if (matchattr(q, "filename", 8, &name))
return name->ptr;
}
if ((p = checkHeader(buf, "Content-Type:")) != NULL &&
(q = strcasestr(p, "name")) != NULL &&
- (q == p || IS_SPACE(*(q-1)) || *(q-1) == ';')) {
+ (q == p || IS_SPACE(*(q - 1)) || *(q - 1) == ';')) {
if (matchattr(q, "name", 4, &name))
return name->ptr;
}
diff --git a/fm.h b/fm.h
index 0db0262..445452e 100644
--- a/fm.h
+++ b/fm.h
@@ -1,4 +1,4 @@
-/* $Id: fm.h,v 1.19 2001/11/23 22:07:45 ukai Exp $ */
+/* $Id: fm.h,v 1.20 2001/11/24 02:01:26 ukai Exp $ */
/*
* w3m: WWW wo Miru utility
*
@@ -46,7 +46,7 @@ void bcopy(void *, void *, int);
void bzero(void *, int);
#endif /* HAVE_BCOPY */
#ifdef __EMX__
-#include <strings.h> /* for bzero() and bcopy() */
+#include <strings.h> /* for bzero() and bcopy() */
#endif
#ifdef MAINPROGRAM
@@ -180,8 +180,7 @@ void bzero(void *, int);
#define MAX_LB 5
#ifdef MAINPROGRAM
-int REV_LB[MAX_LB] =
-{
+int REV_LB[MAX_LB] = {
LB_N_FRAME, LB_FRAME, LB_N_INFO, LB_INFO, LB_N_SOURCE,
};
#else /* not MAINPROGRAM */
@@ -543,21 +542,21 @@ struct cookie {
#define COO_DOMAIN 4
#define COO_PATH 8
#define COO_DISCARD 16
-#define COO_OVERRIDE 32 /* user chose to override security checks */
+#define COO_OVERRIDE 32 /* user chose to override security checks */
-#define COO_OVERRIDE_OK 32 /* flag to specify that an error is overridable */
+#define COO_OVERRIDE_OK 32 /* flag to specify that an error is overridable */
/* version 0 refers to the original cookie_spec.html */
/* version 1 refers to RFC 2109 */
/* version 1' refers to the Internet draft to obsolete RFC 2109 */
-#define COO_EINTERNAL (1) /* unknown error; probably forgot to convert "return 1" in cookie.c */
+#define COO_EINTERNAL (1) /* unknown error; probably forgot to convert "return 1" in cookie.c */
#define COO_ETAIL (2 | COO_OVERRIDE_OK) /* tail match failed (version 0) */
-#define COO_ESPECIAL (3) /* special domain check failed (version 0) */
-#define COO_EPATH (4) /* Path attribute mismatch (version 1 case 1) */
+#define COO_ESPECIAL (3) /* special domain check failed (version 0) */
+#define COO_EPATH (4) /* Path attribute mismatch (version 1 case 1) */
#define COO_ENODOT (5 | COO_OVERRIDE_OK) /* no embedded dots in Domain (version 1 case 2.1) */
#define COO_ENOTV1DOM (6 | COO_OVERRIDE_OK) /* Domain does not start with a dot (version 1 case 2.2) */
#define COO_EDOM (7 | COO_OVERRIDE_OK) /* domain-match failed (version 1 case 3) */
#define COO_EBADHOST (8 | COO_OVERRIDE_OK) /* dot in matched host name in FQDN (version 1 case 4) */
-#define COO_EPORT (9) /* Port match failed (version 1' case 5) */
+#define COO_EPORT (9) /* Port match failed (version 1' case 5) */
#define COO_EMAX COO_EPORT
#endif /* USE_COOKIE */
@@ -632,7 +631,7 @@ extern char EscKeymap[];
extern char EscBKeymap[];
extern char EscDKeymap[];
#ifdef __EMX__
-extern char PcKeymap[];
+extern char PcKeymap[];
#endif
extern FuncList w3mFuncList[];
extern KeyList w3mKeyList;
@@ -651,7 +650,7 @@ global char *NO_proxy init(NULL);
global int NOproxy_netaddr init(TRUE);
#ifdef INET6
global int DNS_order init(0);
-extern int ai_family_order_table[3][3]; /* XXX */
+extern int ai_family_order_table[3][3]; /* XXX */
#endif /* INET6 */
global TextList *NO_proxy_domains;
global char NoCache init(FALSE);
@@ -862,9 +861,9 @@ global int FollowRedirection init(10);
global int w3m_backend init(FALSE);
global Str backend_halfdump_str;
global TextList *backend_batch_commands init(NULL);
-int backend( void );
+int backend(void);
extern void deleteFiles(void);
-void w3m_exit( int i );
+void w3m_exit(int i);
#ifdef USE_ALARM
#define AL_UNSET 0
diff --git a/form.c b/form.c
index d3f6918..d0717ae 100644
--- a/form.c
+++ b/form.c
@@ -1,4 +1,4 @@
-/* $Id: form.c,v 1.5 2001/11/20 17:49:23 ukai Exp $ */
+/* $Id: form.c,v 1.6 2001/11/24 02:01:26 ukai Exp $ */
/*
* HTML forms
*/
@@ -9,9 +9,9 @@
#include "local.h"
#ifdef __EMX__
-/* lstat is identical to stat, only the link itself is statted, not the
- * file that is obtained by tracing the links. But on OS/2 systems,
- * there is no differences. */
+/* lstat is identical to stat, only the link itself is statted, not the file
+ * that is obtained by tracing the links. But on OS/2 systems, there is no
+ * differences. */
#define lstat stat
#endif /* __EMX__ */
@@ -21,28 +21,23 @@ extern FormSelectOption *select_option;
#include "menu.h"
#endif /* MENU_SELECT */
+/* *INDENT-OFF* */
struct {
char *action;
- void (*rout) (struct parsed_tagarg *);
+ void (*rout)(struct parsed_tagarg *);
} internal_action[] = {
- {
- "map", follow_map
- },
- {
- "option", panel_set_option
- },
+ {"map", follow_map},
+ {"option", panel_set_option},
#ifdef USE_COOKIE
- {
- "cookie", set_cookie_flag
- },
+ {"cookie", set_cookie_flag},
#endif /* USE_COOKIE */
- {
- NULL, NULL
- },
+ {NULL, NULL},
};
+/* *INDENT-ON* */
struct form_list *
-newFormList(char *action, char *method, char *charset, char *enctype, char *target, char *name, struct form_list *_next)
+newFormList(char *action, char *method, char *charset, char *enctype,
+ char *target, char *name, struct form_list *_next)
{
struct form_list *l;
Str a = Strnew_charp(action);
@@ -116,14 +111,14 @@ formList_addInput(struct form_list *fl, struct parsed_tag *tag)
if (parsedtag_get_value(tag, ATTR_NAME, &p))
item->name = Strnew_charp(p);
if (parsedtag_get_value(tag, ATTR_VALUE, &p))
- item->value = item->init_value = Strnew_charp(p);
+ item->value = item->init_value = Strnew_charp(p);
item->checked = item->init_checked = parsedtag_exists(tag, ATTR_CHECKED);
item->accept = parsedtag_exists(tag, ATTR_ACCEPT);
parsedtag_get_value(tag, ATTR_SIZE, &item->size);
parsedtag_get_value(tag, ATTR_MAXLENGTH, &item->maxlength);
item->readonly = parsedtag_exists(tag, ATTR_READONLY);
if (parsedtag_get_value(tag, ATTR_TEXTAREANUMBER, &i))
- item->value = item->init_value = textarea_str[i];
+ item->value = item->init_value = textarea_str[i];
#ifdef MENU_SELECT
if (parsedtag_get_value(tag, ATTR_SELECTNUMBER, &i))
item->select_option = select_option[i].first;
@@ -136,10 +131,10 @@ formList_addInput(struct form_list *fl, struct parsed_tag *tag)
}
#ifdef MENU_SELECT
if (item->type == FORM_SELECT) {
- chooseSelectOption(item, item->select_option);
- item->init_selected = item->selected;
- item->init_value = item->value;
- item->init_label = item->label;
+ chooseSelectOption(item, item->select_option);
+ item->init_selected = item->selected;
+ item->init_value = item->value;
+ item->init_label = item->label;
}
#endif /* MENU_SELECT */
if (item->type == FORM_INPUT_FILE && item->value && item->value->length) {
@@ -161,24 +156,21 @@ formList_addInput(struct form_list *fl, struct parsed_tag *tag)
return item;
}
-static char *_formtypetbl[] =
-{
+static char *_formtypetbl[] = {
"text", "password", "checkbox", "radio", "submit",
"reset", "hidden", "image", "select", "textarea", "button", "file", 0,
};
-static char *_formmethodtbl[] =
-{
+static char *_formmethodtbl[] = {
"GET", "POST", "INTERNAL", "HEAD"
};
char *
-form2str(FormItemList * fi)
+form2str(FormItemList *fi)
{
Str tmp;
if (fi->type == FORM_INPUT_SUBMIT ||
- fi->type == FORM_INPUT_IMAGE ||
- fi->type == FORM_INPUT_BUTTON) {
+ fi->type == FORM_INPUT_IMAGE || fi->type == FORM_INPUT_BUTTON) {
tmp = Strnew_charp(_formmethodtbl[fi->parent->method]);
Strcat_char(tmp, ' ');
Strcat(tmp, fi->parent->action);
@@ -200,7 +192,7 @@ formtype(char *typestr)
}
void
-formRecheckRadio(Anchor *a, Buffer *buf, FormItemList * fi)
+formRecheckRadio(Anchor *a, Buffer *buf, FormItemList *fi)
{
int i;
Anchor *a2;
@@ -208,10 +200,9 @@ formRecheckRadio(Anchor *a, Buffer *buf, FormItemList * fi)
for (i = 0; i < buf->formitem->nanchor; i++) {
a2 = &buf->formitem->anchors[i];
- f2 = (FormItemList *) a2->url;
+ f2 = (FormItemList *)a2->url;
if (f2->parent == fi->parent && f2 != fi &&
- f2->type == FORM_INPUT_RADIO &&
- Strcmp(f2->name, fi->name) == 0) {
+ f2->type == FORM_INPUT_RADIO && Strcmp(f2->name, fi->name) == 0) {
f2->checked = 0;
formUpdateBuffer(a2, buf, f2);
}
@@ -221,7 +212,7 @@ formRecheckRadio(Anchor *a, Buffer *buf, FormItemList * fi)
}
void
-formResetBuffer(Buffer * buf, AnchorList * formitem)
+formResetBuffer(Buffer *buf, AnchorList *formitem)
{
int i;
Anchor *a;
@@ -231,8 +222,8 @@ formResetBuffer(Buffer * buf, AnchorList * formitem)
return;
for (i = 0; i < buf->formitem->nanchor && i < formitem->nanchor; i++) {
a = &buf->formitem->anchors[i];
- f1 = (FormItemList *) a->url;
- f2 = (FormItemList *) formitem->anchors[i].url;
+ f1 = (FormItemList *)a->url;
+ f2 = (FormItemList *)formitem->anchors[i].url;
if (f1->type != f2->type ||
strcmp(((f1->name == NULL) ? "" : f1->name->ptr),
((f2->name == NULL) ? "" : f2->name->ptr)))
@@ -262,7 +253,7 @@ formResetBuffer(Buffer * buf, AnchorList * formitem)
}
void
-formUpdateBuffer(Anchor * a, Buffer * buf, FormItemList * form)
+formUpdateBuffer(Anchor *a, Buffer *buf, FormItemList *form)
{
int i, j, k;
Buffer save;
@@ -304,78 +295,79 @@ formUpdateBuffer(Anchor * a, Buffer * buf, FormItemList * form)
case FORM_TEXTAREA:
#ifdef MENU_SELECT
case FORM_SELECT:
- if (form->type == FORM_SELECT) {
+ if (form->type == FORM_SELECT) {
p = form->label->ptr;
- updateSelectOption(form, form->select_option);
- } else
+ updateSelectOption(form, form->select_option);
+ }
+ else
#endif /* MENU_SELECT */
p = form->value->ptr;
- j = 0;
- l = buf->currentLine;
- if (form->type == FORM_TEXTAREA) {
- int n = a->y - buf->currentLine->linenumber;
- if (n > 0)
- for (; l && n; l = l->prev, n--);
- else if (n < 0)
- for (; l && n; l = l->prev, n++);
- if (! l)
- break;
- }
- rows = form->rows ? form->rows : 1;
- if (rows > 1)
- col = COLPOS(l, a->start.pos);
- for (c_rows = 0; c_rows < rows; c_rows++, l = l->next) {
- if (rows > 1) {
- pos = columnPos(l, col);
- a = retrieveAnchor(buf->formitem, l->linenumber, pos);
- if (a == NULL)
- break;
- spos = a->start.pos - 1;
- epos = a->end.pos;
- }
- i = spos + 1;
- while (p[j]) {
- if (rows > 1 && (p[j] == '\r' || p[j] == '\n'))
- break;
- if (p[j] == '\r') {
- j++;
- continue;
- }
- c_type = get_mctype(&p[j]);
- c_len = get_mclen(c_type);
- k = i + c_len;
- if (k > epos)
- break;
+ j = 0;
+ l = buf->currentLine;
+ if (form->type == FORM_TEXTAREA) {
+ int n = a->y - buf->currentLine->linenumber;
+ if (n > 0)
+ for (; l && n; l = l->prev, n--) ;
+ else if (n < 0)
+ for (; l && n; l = l->prev, n++) ;
+ if (!l)
+ break;
+ }
+ rows = form->rows ? form->rows : 1;
+ if (rows > 1)
+ col = COLPOS(l, a->start.pos);
+ for (c_rows = 0; c_rows < rows; c_rows++, l = l->next) {
+ if (rows > 1) {
+ pos = columnPos(l, col);
+ a = retrieveAnchor(buf->formitem, l->linenumber, pos);
+ if (a == NULL)
+ break;
+ spos = a->start.pos - 1;
+ epos = a->end.pos;
+ }
+ i = spos + 1;
+ while (p[j]) {
+ if (rows > 1 && (p[j] == '\r' || p[j] == '\n'))
+ break;
+ if (p[j] == '\r') {
+ j++;
+ continue;
+ }
+ c_type = get_mctype(&p[j]);
+ c_len = get_mclen(c_type);
+ k = i + c_len;
+ if (k > epos)
+ break;
#ifdef JP_CHARSET
- if (c_type == PC_KANJI && form->type != FORM_INPUT_PASSWORD) {
- SetCharType(l->propBuf[i], PC_KANJI1);
- SetCharType(l->propBuf[i+1], PC_KANJI2);
- }
- else
+ if (c_type == PC_KANJI && form->type != FORM_INPUT_PASSWORD) {
+ SetCharType(l->propBuf[i], PC_KANJI1);
+ SetCharType(l->propBuf[i + 1], PC_KANJI2);
+ }
+ else
#endif /* JP_CHARSET */
- SetCharType(l->propBuf[i], PC_ASCII);
-
- for (; i < k; i++, j++) {
- if (form->type == FORM_INPUT_PASSWORD)
- l->lineBuf[i] = '*';
- else if (c_type == PC_CTRL ||
- IS_UNPRINTABLE_ASCII(p[j], c_type))
- l->lineBuf[i] = ' ';
- else
- l->lineBuf[i] = p[j];
- }
- }
- if (rows > 1) {
- while (p[j] && p[j] != '\r' && p[j] != '\n')
- j++;
- if (p[j] == '\r')
- j++;
- if (p[j] == '\n')
- j++;
- }
- for (; i < epos; i++) {
- l->lineBuf[i] = ' ';
- SetCharType(l->propBuf[i], PC_ASCII);
+ SetCharType(l->propBuf[i], PC_ASCII);
+
+ for (; i < k; i++, j++) {
+ if (form->type == FORM_INPUT_PASSWORD)
+ l->lineBuf[i] = '*';
+ else if (c_type == PC_CTRL ||
+ IS_UNPRINTABLE_ASCII(p[j], c_type))
+ l->lineBuf[i] = ' ';
+ else
+ l->lineBuf[i] = p[j];
+ }
+ }
+ if (rows > 1) {
+ while (p[j] && p[j] != '\r' && p[j] != '\n')
+ j++;
+ if (p[j] == '\r')
+ j++;
+ if (p[j] == '\n')
+ j++;
+ }
+ for (; i < epos; i++) {
+ l->lineBuf[i] = ' ';
+ SetCharType(l->propBuf[i], PC_ASCII);
}
}
break;
@@ -442,7 +434,8 @@ form_fputs_decode(Str s, FILE * f)
if (*(p + 1) == '\n')
p++;
/* continue to the next label */
-#endif /* !defined( __CYGWIN__ ) && !defined( __EMX__ ) */
+#endif /* !defined( __CYGWIN__ ) && !defined( __EMX__
+ * ) */
default:
Strcat_char(z, *p);
p++;
@@ -458,7 +451,7 @@ form_fputs_decode(Str s, FILE * f)
void
-input_textarea(FormItemList * fi)
+input_textarea(FormItemList *fi)
{
Str tmpname = tmpfname(TMPF_DFL, NULL);
Str tmp;
@@ -476,23 +469,23 @@ input_textarea(FormItemList * fi)
form_fputs_decode(fi->value, f);
fclose(f);
if (strcasestr(Editor, "%s"))
- if (strcasestr(Editor, "%d"))
- tmp = Sprintf(Editor, 1, tmpname->ptr);
- else
- tmp = Sprintf(Editor, tmpname->ptr);
+ if (strcasestr(Editor, "%d"))
+ tmp = Sprintf(Editor, 1, tmpname->ptr);
+ else
+ tmp = Sprintf(Editor, tmpname->ptr);
else {
- if (strcasestr(Editor, "%d"))
- tmp = Sprintf(Editor, 1);
- else
- tmp = Strnew_charp(Editor);
- Strcat_m_charp(tmp, " ", tmpname->ptr, NULL);
+ if (strcasestr(Editor, "%d"))
+ tmp = Sprintf(Editor, 1);
+ else
+ tmp = Strnew_charp(Editor);
+ Strcat_m_charp(tmp, " ", tmpname->ptr, NULL);
}
fmTerm();
system(tmp->ptr);
fmInit();
if (fi->readonly)
- return;
+ return;
f = fopen(tmpname->ptr, "r");
if (f == NULL) {
disp_err_message("Can't open temporary file", FALSE);
@@ -510,10 +503,10 @@ input_textarea(FormItemList * fi)
Strcat_charp(tmp, "\r\n");
}
#ifdef JP_CHARSET
- if ((ic = checkShiftCode(tmp, code)) != '\0')
- tmp = conv_str(tmp, (code = ic), InnerCode);
+ if ((ic = checkShiftCode(tmp, code)) != '\0')
+ tmp = conv_str(tmp, (code = ic), InnerCode);
#endif /* not JP_CHARSET */
- Strcat(fi->value, tmp);
+ Strcat(fi->value, tmp);
}
fclose(f);
unlink(tmpname->ptr);
@@ -534,7 +527,7 @@ do_internal(char *action, char *data)
#ifdef MENU_SELECT
void
-addSelectOption(FormSelectOption * fso, Str value, Str label, int chk)
+addSelectOption(FormSelectOption *fso, Str value, Str label, int chk)
{
FormSelectOptionItem *o;
o = New(FormSelectOptionItem);
@@ -562,18 +555,18 @@ chooseSelectOption(FormItemList *fi, FormSelectOptionItem *item)
fi->selected = 0;
if (item == NULL) {
- fi->value = Strnew_size(0);
- fi->label = Strnew_size(0);
- return;
+ fi->value = Strnew_size(0);
+ fi->label = Strnew_size(0);
+ return;
}
fi->value = item->value;
fi->label = item->label;
for (i = 0, opt = item; opt != NULL; i++, opt = opt->next) {
- if (opt->checked) {
- fi->value = opt->value;
- fi->label = opt->label;
- fi->selected = i;
- break;
+ if (opt->checked) {
+ fi->value = opt->value;
+ fi->label = opt->label;
+ fi->selected = i;
+ break;
}
}
updateSelectOption(fi, item);
@@ -585,12 +578,12 @@ updateSelectOption(FormItemList *fi, FormSelectOptionItem *item)
int i;
if (fi == NULL || item == NULL)
- return;
+ return;
for (i = 0; item != NULL; i++, item = item->next) {
- if (i == fi->selected)
- item->checked = TRUE;
- else
- item->checked = FALSE;
+ if (i == fi->selected)
+ item->checked = TRUE;
+ else
+ item->checked = FALSE;
}
}
@@ -601,7 +594,7 @@ formChooseOptionByMenu(struct form_item_list *fi, int x, int y)
FormSelectOptionItem *opt;
char **label;
- for (n = 0, opt = fi->select_option; opt != NULL; n++, opt = opt->next);
+ for (n = 0, opt = fi->select_option; opt != NULL; n++, opt = opt->next) ;
label = New_N(char *, n + 1);
for (i = 0, opt = fi->select_option; opt != NULL; i++, opt = opt->next)
label[i] = opt->label->ptr;
@@ -610,10 +603,10 @@ formChooseOptionByMenu(struct form_item_list *fi, int x, int y)
optionMenu(x, y, label, &selected, init_select, NULL);
if (selected < 0)
- return 0;
+ return 0;
for (i = 0, opt = fi->select_option; opt != NULL; i++, opt = opt->next) {
if (i == selected) {
- fi->selected = selected;
+ fi->selected = selected;
fi->value = opt->value;
fi->label = opt->label;
break;
@@ -633,7 +626,8 @@ form_write_data(FILE * f, char *boundary, char *name, char *value)
}
void
-form_write_from_file(FILE * f, char *boundary, char *name, char *filename, char *file)
+form_write_from_file(FILE * f, char *boundary, char *name, char *filename,
+ char *file)
{
FILE *fd;
struct stat st;
@@ -641,13 +635,14 @@ form_write_from_file(FILE * f, char *boundary, char *name, char *filename, char
char *type;
fprintf(f, "--%s\r\n", boundary);
- fprintf(f, "Content-Disposition: form-data; name=\"%s\"; filename=\"%s\"\r\n",
+ fprintf(f,
+ "Content-Disposition: form-data; name=\"%s\"; filename=\"%s\"\r\n",
name, mybasename(filename));
type = guessContentType(file);
fprintf(f, "Content-Type: %s\r\n\r\n",
- type ? type : "application/octet-stream");
+ type ? type : "application/octet-stream");
-#ifdef HAVE_READLINK /* readline == lstat ? (ukai) */
+#ifdef HAVE_READLINK /* readline == lstat ? (ukai) */
if (lstat(file, &st) < 0)
goto write_end;
#endif /* HAVE_READLINK */
diff --git a/form.h b/form.h
index 8987771..e6ca183 100644
--- a/form.h
+++ b/form.h
@@ -1,4 +1,4 @@
-/* $Id: form.h,v 1.3 2001/11/20 17:49:23 ukai Exp $ */
+/* $Id: form.h,v 1.4 2001/11/24 02:01:26 ukai Exp $ */
/*
* HTML forms
*/
@@ -33,11 +33,11 @@
#define FORM_ENCTYPE_URLENCODED 0
#define FORM_ENCTYPE_MULTIPART 1
-#define MAX_TEXTAREA 10 /* max number of * <textarea>..</textarea>
- * within one * document */
+#define MAX_TEXTAREA 10 /* max number of * <textarea>..</textarea>
+ * * within one * document */
#ifdef MENU_SELECT
-#define MAX_SELECT 10 /* max number of <select>..</select> *
- * within one document */
+#define MAX_SELECT 10 /* max number of <select>..</select> *
+ * * within one document */
#endif /* MENU_SELECT */
typedef struct form_list {
@@ -69,7 +69,7 @@ typedef struct form_select_option {
FormSelectOptionItem *last;
} FormSelectOption;
-void addSelectOption(FormSelectOption * fso, Str value, Str label, int chk);
+void addSelectOption(FormSelectOption *fso, Str value, Str label, int chk);
void chooseSelectOption(struct form_item_list *fi, FormSelectOptionItem *item);
void updateSelectOption(struct form_item_list *fi, FormSelectOptionItem *item);
int formChooseOptionByMenu(struct form_item_list *fi, int x, int y);
diff --git a/frame.c b/frame.c
index 5850f7f..cf84926 100644
--- a/frame.c
+++ b/frame.c
@@ -1,4 +1,4 @@
-/* $Id: frame.c,v 1.5 2001/11/20 13:17:13 ukai Exp $ */
+/* $Id: frame.c,v 1.6 2001/11/24 02:01:26 ukai Exp $ */
#include "fm.h"
#include "parsetagx.h"
#include "myctype.h"
@@ -40,7 +40,8 @@ newFrameSet(struct parsed_tag *tag)
while (*p != '\0')
if (*p++ == ',') {
length[++i] = p;
- if (i >= sizeof(length) / sizeof(length[0]) - 2) break;
+ if (i >= sizeof(length) / sizeof(length[0]) - 2)
+ break;
}
length[++i] = p + 1;
}
@@ -78,7 +79,8 @@ newFrameSet(struct parsed_tag *tag)
while (*p != '\0')
if (*p++ == ',') {
length[++i] = p;
- if (i >= sizeof(length) / sizeof(length[0]) - 2) break;
+ if (i >= sizeof(length) / sizeof(length[0]) - 2)
+ break;
}
length[++i] = p + 1;
}
@@ -115,7 +117,7 @@ newFrame(struct parsed_tag *tag, Buffer *buf)
char *p;
body = New(struct frame_body);
- bzero((void *) body, sizeof(*body));
+ bzero((void *)body, sizeof(*body));
body->attr = F_UNLOADED;
body->flags = 0;
body->baseURL = baseURL(buf);
@@ -142,7 +144,7 @@ deleteFrame(struct frame_body *b)
if (b == NULL)
return;
unloadFrame(b);
- bzero((void *) b, sizeof(*b));
+ bzero((void *)b, sizeof(*b));
}
void
@@ -200,7 +202,7 @@ copyFrame(struct frame_body *ob)
struct frame_body *rb;
rb = New(struct frame_body);
- bcopy((const void *) ob, (void *) rb, sizeof(struct frame_body));
+ bcopy((const void *)ob, (void *)rb, sizeof(struct frame_body));
rb->flags &= ~FB_TODELETE;
return rb;
}
@@ -213,15 +215,13 @@ copyFrameSet(struct frameset *of)
rf = New(struct frameset);
n = of->col * of->row;
- bcopy((const void *) of, (void *) rf, sizeof(struct frameset));
+ bcopy((const void *)of, (void *)rf, sizeof(struct frameset));
rf->width = New_N(char *, rf->col);
- bcopy((const void *) of->width,
- (void *) rf->width,
- sizeof(char *) * rf->col);
+ bcopy((const void *)of->width,
+ (void *)rf->width, sizeof(char *) * rf->col);
rf->height = New_N(char *, rf->row);
- bcopy((const void *) of->height,
- (void *) rf->height,
- sizeof(char *) * rf->row);
+ bcopy((const void *)of->height,
+ (void *)rf->height, sizeof(char *) * rf->row);
rf->frame = New_N(union frameset_element, n);
while (n) {
n--;
@@ -247,7 +247,7 @@ copyFrameSet(struct frameset *of)
void
flushFrameSet(struct frameset *fs)
{
- int n = fs->i;
+ int n = fs->i;
while (n) {
n--;
@@ -270,9 +270,7 @@ flushFrameSet(struct frameset *fs)
}
void
-pushFrameTree(struct frameset_queue **fqpp,
- struct frameset *fs,
- Buffer *buf)
+pushFrameTree(struct frameset_queue **fqpp, struct frameset *fs, Buffer *buf)
{
struct frameset_queue *rfq, *cfq = *fqpp;
@@ -280,7 +278,8 @@ pushFrameTree(struct frameset_queue **fqpp,
return;
rfq = New(struct frameset_queue);
- rfq->linenumber = (buf && buf->currentLine) ? buf->currentLine->linenumber : 1;
+ rfq->linenumber = (buf
+ && buf->currentLine) ? buf->currentLine->linenumber : 1;
rfq->top_linenumber = (buf && buf->topLine) ? buf->topLine->linenumber : 1;
rfq->pos = buf ? buf->pos : 0;
rfq->currentColumn = buf ? buf->currentColumn : 0;
@@ -317,15 +316,13 @@ popFrameTree(struct frameset_queue **fqpp)
(rfq = cfq->back)->next = cfq->next;
}
*fqpp = rfq;
- bzero((void *) cfq, sizeof(struct frameset_queue));
+ bzero((void *)cfq, sizeof(struct frameset_queue));
return rfs;
}
void
resetFrameElement(union frameset_element *f_element,
- Buffer * buf,
- char *referer,
- FormList * request)
+ Buffer *buf, char *referer, FormList *request)
{
char *f_name;
struct frame_body *f_body;
@@ -337,7 +334,7 @@ resetFrameElement(union frameset_element *f_element,
f_element->set = buf->frameset;
f_element->set->currentURL = New(ParsedURL);
copyParsedURL(f_element->set->currentURL, &buf->currentURL);
- buf->frameset = popFrameTree(&(buf->frameQ));
+ buf->frameset = popFrameTree(&(buf->frameQ));
f_element->set->name = f_name;
}
else {
@@ -355,7 +352,7 @@ resetFrameElement(union frameset_element *f_element,
f_body->flags |= FB_TODELETE;
buf->sourcefile = NULL;
}
- f_body->type = buf->type;
+ f_body->type = buf->type;
f_body->referer = referer;
f_body->request = request;
deleteFrameSetElement(*f_element);
@@ -364,8 +361,8 @@ resetFrameElement(union frameset_element *f_element,
}
static struct frameset *
-frame_download_source(struct frame_body *b, ParsedURL * currentURL,
- ParsedURL * baseURL, int flag)
+frame_download_source(struct frame_body *b, ParsedURL *currentURL,
+ ParsedURL *baseURL, int flag)
{
Buffer *buf;
struct frameset *ret_frameset = NULL;
@@ -379,19 +376,17 @@ frame_download_source(struct frame_body *b, ParsedURL * currentURL,
parseURL2(b->url, &url, currentURL);
switch (url.scheme) {
case SCM_LOCAL:
-/*
+#if 0
b->source = url.real_file;
-*/
+#endif
b->flags = 0;
default:
is_redisplay = TRUE;
- w3m_dump |= DUMP_FRAME;
+ w3m_dump |= DUMP_FRAME;
buf = loadGeneralFile(b->url,
baseURL ? baseURL : currentURL,
- b->referer,
- flag,
- b->request);
- w3m_dump &= ~DUMP_FRAME;
+ b->referer, flag, b->request);
+ w3m_dump &= ~DUMP_FRAME;
is_redisplay = FALSE;
break;
}
@@ -417,14 +412,15 @@ frame_download_source(struct frame_body *b, ParsedURL * currentURL,
ret_frameset->name = b->name;
ret_frameset->currentURL = New(ParsedURL);
copyParsedURL(ret_frameset->currentURL, &buf->currentURL);
- buf->frameset = popFrameTree(&(buf->frameQ));
+ buf->frameset = popFrameTree(&(buf->frameQ));
}
discardBuffer(buf);
return ret_frameset;
}
static int
-createFrameFile(struct frameset *f, FILE * f1, Buffer * current, int level, int force_reload)
+createFrameFile(struct frameset *f, FILE * f1, Buffer *current, int level,
+ int force_reload)
{
int r, c, t_stack;
URLFile f2;
@@ -512,8 +508,7 @@ createFrameFile(struct frameset *f, FILE * f1, Buffer * current, int level, int
fflush(f1);
f_frameset = frame_download_source(frame.body,
currentURL,
- current->baseURL,
- flag);
+ current->baseURL, flag);
if (f_frameset) {
deleteFrame(frame.body);
f->frame[i].set = frame.set = f_frameset;
@@ -529,12 +524,15 @@ createFrameFile(struct frameset *f, FILE * f1, Buffer * current, int level, int
if (f2.stream == NULL) {
frame.body->attr = F_UNLOADED;
if (frame.body->flags & FB_NO_BUFFER)
- fprintf(f1, "Open %s with other method", frame.body->url);
+ fprintf(f1, "Open %s with other method",
+ frame.body->url);
else if (frame.body->url)
fprintf(f1, "Can't open %s", frame.body->url);
else
- fprintf(f1, "This frame (%s) contains no src attribute",
- frame.body->name ? frame.body->name : "(no name)");
+ fprintf(f1,
+ "This frame (%s) contains no src attribute",
+ frame.body->name ? frame.body->
+ name : "(no name)");
break;
}
parseURL2(frame.body->url, &base, currentURL);
@@ -546,28 +544,28 @@ createFrameFile(struct frameset *f, FILE * f1, Buffer * current, int level, int
code = '\0';
#endif /* JP_CHARSET */
t_stack = 0;
- if (frame.body->type &&
- ! strcasecmp(frame.body->type, "text/plain")) {
- Str tmp;
- fprintf(f1, "<pre>\n");
- while ((tmp = StrmyUFgets(&f2))->length) {
+ if (frame.body->type &&
+ !strcasecmp(frame.body->type, "text/plain")) {
+ Str tmp;
+ fprintf(f1, "<pre>\n");
+ while ((tmp = StrmyUFgets(&f2))->length) {
#ifdef JP_CHARSET
- if ((ic = checkShiftCode(tmp, code)) != '\0')
- tmp = conv_str(tmp, (code = ic), InnerCode);
-
-#endif /* JP_CHARSET */
- cleanup_line(tmp, HTML_MODE);
- fprintf(f1, "%s", html_quote(tmp->ptr));
- }
- fprintf(f1, "</pre>\n");
- UFclose(&f2);
- break;
- }
+ if ((ic = checkShiftCode(tmp, code)) != '\0')
+ tmp = conv_str(tmp, (code = ic), InnerCode);
+
+#endif /* JP_CHARSET */
+ cleanup_line(tmp, HTML_MODE);
+ fprintf(f1, "%s", html_quote(tmp->ptr));
+ }
+ fprintf(f1, "</pre>\n");
+ UFclose(&f2);
+ break;
+ }
do {
status = R_ST_NORMAL;
do {
if (*p == '\0') {
- Str tmp = StrmyUFgets(&f2);
+ Str tmp = StrmyUFgets(&f2);
if (tmp->length == 0 && status != R_ST_NORMAL)
tmp = correct_irrtag(status);
if (tmp->length == 0)
@@ -640,7 +638,7 @@ createFrameFile(struct frameset *f, FILE * f1, Buffer * current, int level, int
Strshrinkfirst(tok, 1);
Strshrink(tok, 1);
fprintf(f1,
- "<!-- table stack underflow: %s -->",
+ "<!-- table stack underflow: %s -->",
tok->ptr);
goto token_end;
}
@@ -676,7 +674,8 @@ createFrameFile(struct frameset *f, FILE * f1, Buffer * current, int level, int
case ATTR_ACTION:
if (!tag->value[j])
break;
- tag->value[j] = url_quote_conv(tag->value[j], code);
+ tag->value[j] =
+ url_quote_conv(tag->value[j], code);
parseURL2(tag->value[j], &url, &base);
if (url.scheme == SCM_MAILTO ||
url.scheme == SCM_UNKNOWN ||
@@ -692,8 +691,7 @@ createFrameFile(struct frameset *f, FILE * f1, Buffer * current, int level, int
if (code != '\0') {
charset[0] = code;
parsedtag_set_value(tag,
- ATTR_CHARSET,
- charset);
+ ATTR_CHARSET, charset);
}
#endif
break;
@@ -703,14 +701,11 @@ createFrameFile(struct frameset *f, FILE * f1, Buffer * current, int level, int
a_target |= 2;
if (!strcasecmp(tag->value[j], "_self")) {
parsedtag_set_value(tag,
- ATTR_TARGET,
- s_target);
+ ATTR_TARGET, s_target);
}
- else if (!strcasecmp(tag->value[j],
- "_parent")) {
+ else if (!strcasecmp(tag->value[j], "_parent")) {
parsedtag_set_value(tag,
- ATTR_TARGET,
- p_target);
+ ATTR_TARGET, p_target);
}
break;
case ATTR_NAME:
@@ -718,17 +713,14 @@ createFrameFile(struct frameset *f, FILE * f1, Buffer * current, int level, int
if (!tag->value[j])
break;
parsedtag_set_value(tag,
- ATTR_FRAMENAME,
- s_target);
+ ATTR_FRAMENAME, s_target);
break;
}
}
if (a_target == 1) {
/* there is HREF attribute and no TARGET
* attribute */
- parsedtag_set_value(tag,
- ATTR_TARGET,
- d_target);
+ parsedtag_set_value(tag, ATTR_TARGET, d_target);
}
if (parsedtag_need_reconstruct(tag))
Strfputs(parsedtag2str(tag), f1);
@@ -750,7 +742,8 @@ createFrameFile(struct frameset *f, FILE * f1, Buffer * current, int level, int
if (!frame.set->name && f->name) {
frame.set->name = Sprintf("%s_%d", f->name, i)->ptr;
}
- createFrameFile(frame.set, f1, current, level + 1, force_reload);
+ createFrameFile(frame.set, f1, current, level + 1,
+ force_reload);
break;
}
fputs("</td>\n", f1);
@@ -769,7 +762,7 @@ createFrameFile(struct frameset *f, FILE * f1, Buffer * current, int level, int
}
Buffer *
-renderFrame(Buffer * Cbuf, int force_reload)
+renderFrame(Buffer *Cbuf, int force_reload)
{
Str tmp;
FILE *f;
diff --git a/ftp.c b/ftp.c
index 45e22fc..93c3382 100644
--- a/ftp.c
+++ b/ftp.c
@@ -1,4 +1,4 @@
-/* $Id: ftp.c,v 1.5 2001/11/23 20:23:41 ukai Exp $ */
+/* $Id: ftp.c,v 1.6 2001/11/24 02:01:26 ukai Exp $ */
#include <stdio.h>
#include <pwd.h>
#include <Str.h>
@@ -117,16 +117,17 @@ FtpLogin(FTP * ftp_return, char *host, char *user, char *pass)
struct sockaddr_in sockname;
int socknamelen = sizeof(sockname);
- if (!getsockname(fd, (struct sockaddr *) &sockname, &socknamelen)) {
+ if (!getsockname(fd, (struct sockaddr *)&sockname, &socknamelen)) {
struct hostent *sockent;
Str tmp2 = Strnew_charp(pass);
- if (sockent = gethostbyaddr((char *) &sockname.sin_addr,
+ if (sockent = gethostbyaddr((char *)&sockname.sin_addr,
sizeof(sockname.sin_addr),
sockname.sin_family))
Strcat_charp(tmp2, sockent->h_name);
else
- Strcat_m_charp(tmp2, "[", inet_ntoa(sockname.sin_addr), "]", NULL);
+ Strcat_m_charp(tmp2, "[", inet_ntoa(sockname.sin_addr),
+ "]", NULL);
pass = tmp2->ptr;
}
@@ -140,7 +141,8 @@ FtpLogin(FTP * ftp_return, char *host, char *user, char *pass)
if (atoi(tmp->ptr) != 220)
return -1;
if (fmInitialized) {
- message(Sprintf("Sending FTP username (%s) to remote server.", user)->ptr, 0, 0);
+ message(Sprintf("Sending FTP username (%s) to remote server.", user)->
+ ptr, 0, 0);
refresh();
}
tmp = Sprintf("USER %s\r\n", user);
@@ -212,15 +214,14 @@ ftp_pasv(FTP ftp)
tmp = read_response(ftp);
if (atoi(tmp->ptr) != 229)
return -1;
- for (p = tmp->ptr + 4; *p && *p != '('; p++);
+ for (p = tmp->ptr + 4; *p && *p != '('; p++) ;
if (*p == '\0')
return -1;
if (sscanf(++p, "%c%c%c%d%c", &d1, &d2, &d3, &port, &d4) != 5
|| d1 != d2 || d1 != d3 || d1 != d4)
return -1;
if (getnameinfo((struct sockaddr *)&sin, sinlen,
- abuf, sizeof(abuf),
- NULL, 0, NI_NUMERICHOST) != 0)
+ abuf, sizeof(abuf), NULL, 0, NI_NUMERICHOST) != 0)
return -1;
tmp = Sprintf("%s", abuf);
data_s = openSocket(tmp->ptr, "", port);
@@ -232,7 +233,7 @@ ftp_pasv(FTP ftp)
tmp = read_response(ftp);
if (atoi(tmp->ptr) != 227)
return -1;
- for (p = tmp->ptr + 4; *p && !IS_DIGIT(*p); p++);
+ for (p = tmp->ptr + 4; *p && !IS_DIGIT(*p); p++) ;
if (*p == '\0')
return -1;
sscanf(p, "%d,%d,%d,%d,%d,%d", &n1, &n2, &n3, &n4, &p1, &p2);
@@ -273,7 +274,7 @@ FtpOpenReadBody(FTP ftp, char *path)
fflush(ftp->wcontrol);
tmp = read_response(ftp);
if (tmp->ptr[0] == '5') {
- return -1;
+ return -1;
}
return 0;
}
@@ -282,7 +283,7 @@ int
FtpOpenRead(FTP ftp, char *path)
{
if (ftp_pasv(ftp) < 0)
- return -1;
+ return -1;
if (FtpOpenReadBody(ftp, path) < 0) {
fclose(ftp->data);
ftp->data = NULL;
@@ -323,7 +324,7 @@ int
FtpData(FTP ftp, char *cmd, char *arg, char *mode)
{
if (ftp_pasv(ftp) < 0)
- return -1;
+ return -1;
return FtpDataBody(ftp, cmd, arg, mode);
}
@@ -387,7 +388,7 @@ static int ftp_system(FTP);
#define FTPDIR_FILE 3
FILE *
-openFTP(ParsedURL * pu)
+openFTP(ParsedURL *pu)
{
Str tmp2 = Strnew();
Str tmp3 = Strnew();
@@ -428,7 +429,7 @@ openFTP(ParsedURL * pu)
term_cbreak();
}
else {
- pwd = Strnew_charp((char *) getpass("Password: "));
+ pwd = Strnew_charp((char *)getpass("Password: "));
}
add_auth_cookie_flag = 1;
}
@@ -455,14 +456,14 @@ openFTP(ParsedURL * pu)
else
realpath = file_unquote(pu->file);
- if (pu->file[strlen(pu->file)-1] == '/')
- goto ftp_dir;
+ if (pu->file[strlen(pu->file) - 1] == '/')
+ goto ftp_dir;
/* Get file */
FtpBinary(ftp);
if (ftp_pasv(ftp) < 0) {
- FtpBye(ftp);
- return NULL;
+ FtpBye(ftp);
+ return NULL;
}
s = FtpOpenReadBody(ftp, realpath);
if (!FtpError(s)) {
@@ -481,8 +482,8 @@ openFTP(ParsedURL * pu)
/* Get directory */
ftp_dir:
if (ftp_pasv(ftp) < 0) {
- FtpBye(ftp);
- return NULL;
+ FtpBye(ftp);
+ return NULL;
}
ftp_dir1:
pu->scheme = SCM_FTPDIR;
@@ -490,10 +491,10 @@ openFTP(ParsedURL * pu)
sv_type = ftp_system(ftp);
if (pu->file == NULL || *pu->file == '\0') {
if (sv_type == UNIXLIKE_SERVER) {
- s = FtpDataBody(ftp, "LIST", NULL, "r");
+ s = FtpDataBody(ftp, "LIST", NULL, "r");
}
else {
- s = FtpDataBody(ftp, "NLST", NULL, "r");
+ s = FtpDataBody(ftp, "NLST", NULL, "r");
}
curdir = Strnew_charp("/");
}
@@ -501,11 +502,11 @@ openFTP(ParsedURL * pu)
if (sv_type == UNIXLIKE_SERVER) {
s = FtpCwd(ftp, realpath);
if (!FtpError(s)) {
- s = FtpDataBody(ftp, "LIST", NULL, "r");
+ s = FtpDataBody(ftp, "LIST", NULL, "r");
}
}
else {
- s = FtpDataBody(ftp, "NLST %s", realpath, "r");
+ s = FtpDataBody(ftp, "NLST %s", realpath, "r");
}
if (realpath[0] == '/')
curdir = Strnew_charp(realpath);
@@ -526,8 +527,10 @@ openFTP(ParsedURL * pu)
if (Strlastchar(host) == '/')
Strshrink(host, 1);
qdir = html_quote(curdir->ptr);
- FTPDIRtmp = Sprintf("<html><head><title>%s%s</title></head><body><h1>Index of %s%s</h1>\n",
- host->ptr, qdir, host->ptr, qdir);
+ FTPDIRtmp =
+ Sprintf
+ ("<html><head><title>%s%s</title></head><body><h1>Index of %s%s</h1>\n",
+ host->ptr, qdir, host->ptr, qdir);
curdir = Strnew_charp(file_quote(curdir->ptr));
qdir = curdir->ptr;
tmp2 = Strdup(curdir);
@@ -543,8 +546,7 @@ openFTP(ParsedURL * pu)
Strcat_charp(FTPDIRtmp, "<ul><li><a href=\"");
}
Strcat_m_charp(FTPDIRtmp, host->ptr,
- html_quote(tmp2->ptr),
- "\">[Upper Directory]</a>\n", NULL);
+ html_quote(tmp2->ptr), "\">[Upper Directory]</a>\n", NULL);
flist = New_N(char *, nfile_max);
nfile = 0;
@@ -556,7 +558,8 @@ openFTP(ParsedURL * pu)
max_len = 0;
while (tmp2 = Strfgets(FTPDATA(ftp)), tmp2->length > 0) {
Strchop(tmp2);
- if ((ftype = ex_ftpdir_name_size_date(tmp2->ptr, &name, &date, &size))
+ if ((ftype =
+ ex_ftpdir_name_size_date(tmp2->ptr, &name, &date, &size))
== FTPDIR_NONE) {
continue;
}
@@ -579,7 +582,8 @@ openFTP(ParsedURL * pu)
}
if (max_len < len)
max_len = len;
- line_tmp = Sprintf("%s%s %-12.12s %6.6s", name, type_str, date, size);
+ line_tmp =
+ Sprintf("%s%s %-12.12s %6.6s", name, type_str, date, size);
flist[nfile++] = line_tmp->ptr;
if (nfile == nfile_max) {
nfile_max *= 2;
@@ -608,8 +612,7 @@ openFTP(ParsedURL * pu)
host->ptr,
qdir,
html_quote(file_quote(fn)),
- "\">",
- html_quote(fn), NULL);
+ "\">", html_quote(fn), NULL);
if (ftype == FTPDIR_DIR) {
Strcat_charp(FTPDIRtmp, "/");
len++;
@@ -646,9 +649,7 @@ openFTP(ParsedURL * pu)
Strcat_m_charp(FTPDIRtmp, "<li><a href=\"",
host->ptr, qdir,
html_quote(file_quote(fn)),
- "\">",
- html_quote(fn),
- "</a>\n", NULL);
+ "\">", html_quote(fn), "</a>\n", NULL);
}
Strcat_charp(FTPDIRtmp, "</ul></body></html>\n");
}
@@ -667,8 +668,7 @@ ftp_system(FTP ftp)
fwrite("SYST\r\n", 6, sizeof(char), ftp->wcontrol);
fflush(ftp->wcontrol);
tmp = read_response(ftp);
- if (strstr(tmp->ptr, "UNIX") != NULL
- || !strncmp(tmp->ptr + 4, "Windows_NT", 10)) { /* :-) */
+ if (strstr(tmp->ptr, "UNIX") != NULL || !strncmp(tmp->ptr + 4, "Windows_NT", 10)) { /* :-) */
sv_type = UNIXLIKE_SERVER;
}
@@ -801,7 +801,7 @@ size_int2str(unsigned long size)
double dtmp;
char *size_format, *unit_str;
- dtmp = (double) size;
+ dtmp = (double)size;
for (unit = 0; unit < 3; unit++) {
if (dtmp < 1024) {
break;
diff --git a/func.c b/func.c
index a961e6d..4150982 100644
--- a/func.c
+++ b/func.c
@@ -1,4 +1,4 @@
-/* $Id: func.c,v 1.3 2001/11/20 17:49:23 ukai Exp $ */
+/* $Id: func.c,v 1.4 2001/11/24 02:01:26 ukai Exp $ */
/*
* w3m func.c
*/
@@ -46,46 +46,46 @@ initKeymap(void)
s = getWord(&p);
if (*s == '#') /* comment */
continue;
- if (! strcmp(s, "keymap"))
- ;
- else if (! strcmp(s, "verbose")) {
- s = getWord(&p);
- if (*s)
- verbose = str_to_bool(s, verbose);
- continue;
- } else { /* error */
- emsg = Sprintf("line %d: syntax error '%s'", lineno, s)->ptr;
+ if (!strcmp(s, "keymap")) ;
+ else if (!strcmp(s, "verbose")) {
+ s = getWord(&p);
+ if (*s)
+ verbose = str_to_bool(s, verbose);
+ continue;
+ }
+ else { /* error */
+ emsg = Sprintf("line %d: syntax error '%s'", lineno, s)->ptr;
record_err_message(emsg);
- if (verbose)
- disp_message_nsec(emsg, FALSE, 1, TRUE, FALSE);
+ if (verbose)
+ disp_message_nsec(emsg, FALSE, 1, TRUE, FALSE);
continue;
}
s = getQWord(&p);
c = getKey(s);
if (c < 0) { /* error */
- emsg = Sprintf("line %d: unknown key '%s'", lineno, s)->ptr;
+ emsg = Sprintf("line %d: unknown key '%s'", lineno, s)->ptr;
record_err_message(emsg);
- if (verbose)
- disp_message_nsec(emsg, FALSE, 1, TRUE, FALSE);
+ if (verbose)
+ disp_message_nsec(emsg, FALSE, 1, TRUE, FALSE);
continue;
}
s = getWord(&p);
f = getFuncList(s, w3mFuncList, w3mNFuncList);
if (f < 0) {
- emsg = Sprintf("line %d: invalid command '%s'", lineno, s)->ptr;
+ emsg = Sprintf("line %d: invalid command '%s'", lineno, s)->ptr;
record_err_message(emsg);
- if (verbose)
- disp_message_nsec(emsg, FALSE, 1, TRUE, FALSE);
- continue;
+ if (verbose)
+ disp_message_nsec(emsg, FALSE, 1, TRUE, FALSE);
+ continue;
}
if (c & K_ESCD)
- EscDKeymap[c ^ K_ESCD] = f;
+ EscDKeymap[c ^ K_ESCD] = f;
else if (c & K_ESCB)
- EscBKeymap[c ^ K_ESCB] = f;
+ EscBKeymap[c ^ K_ESCB] = f;
else if (c & K_ESC)
- EscKeymap[c ^ K_ESC] = f;
+ EscKeymap[c ^ K_ESC] = f;
else
- GlobalKeymap[c] = f;
+ GlobalKeymap[c] = f;
s = getQWord(&p);
addKeyList(&w3mKeyList, c, s);
}
@@ -93,16 +93,16 @@ initKeymap(void)
}
int
-countFuncList(FuncList * list)
+countFuncList(FuncList *list)
{
int i;
- for (i = 0; list->id != NULL; i++, list++);
+ for (i = 0; list->id != NULL; i++, list++) ;
return i;
}
int
-getFuncList(char *id, FuncList * list, int nlist)
+getFuncList(char *id, FuncList *list, int nlist)
{
int i, is, ie, m;
@@ -141,21 +141,19 @@ getKey(char *s)
else if (strcasecmp(s, "LEFT") == 0) /* ^[[D */
return K_ESCB | 'D';
- if (strncasecmp(s, "ESC-", 4) == 0 ||
- strncasecmp(s, "ESC ", 4) == 0) { /* ^[ */
+ if (strncasecmp(s, "ESC-", 4) == 0 || strncasecmp(s, "ESC ", 4) == 0) { /* ^[ */
s += 4;
esc = K_ESC;
}
- else if (strncasecmp(s, "M-", 2) == 0 ||
- strncasecmp(s, "\\E", 2) == 0) { /* ^[ */
+ else if (strncasecmp(s, "M-", 2) == 0 || strncasecmp(s, "\\E", 2) == 0) { /* ^[ */
s += 2;
esc = K_ESC;
}
- else if (*s == ESC_CODE) { /* ^[ */
+ else if (*s == ESC_CODE) { /* ^[ */
s++;
esc = K_ESC;
}
- if (strncasecmp(s, "C-", 2) == 0) { /* ^, ^[^ */
+ if (strncasecmp(s, "C-", 2) == 0) { /* ^, ^[^ */
s += 2;
ctrl = 1;
}
@@ -184,11 +182,11 @@ getKey(char *s)
}
if (ctrl) {
- if (*s >= '@' && *s <= '_') /* ^@ .. ^_ */
+ if (*s >= '@' && *s <= '_') /* ^@ .. ^_ */
return esc | (*s - '@');
else if (*s >= 'a' && *s <= 'z') /* ^a .. ^z */
return esc | (*s - 'a' + 1);
- else if (*s == '?') /* ^? */
+ else if (*s == '?') /* ^? */
return esc | DEL_CODE;
else
return -1;
@@ -259,7 +257,7 @@ addKeyList(KeyList *list, int key, char *data)
if (list->nitem > list->size) {
list->size = (list->size >= 2) ? (list->size * 3 / 2) : 2;
list->item = New_Reuse(KeyListItem, list->item,
- list->size * sizeof(KeyListItem));
+ list->size * sizeof(KeyListItem));
}
item = &(list->item[list->nitem - 1]);
item->key = key;
@@ -324,10 +322,10 @@ getQWord(char **str)
*e++ = '\\';
}
else {
- if (*p != '\\' && *p != '\'' && /* ..\\.., *
- * ..\'.. */
- *p != '"' && !IS_SPACE(*p)) /* ..\".., * ..\..
- */
+ if (*p != '\\' && *p != '\'' && /* ..\\.., *
+ * ..\'.. */
+ *p != '"' && !IS_SPACE(*p)) /* ..\".., * ..\..
+ */
*e++ = '\\';
}
*e++ = *p;
diff --git a/hash.c b/hash.c
index cb340b5..a73b74f 100644
--- a/hash.c
+++ b/hash.c
@@ -1,4 +1,4 @@
-/* $Id: hash.c,v 1.2 2001/11/20 17:49:23 ukai Exp $ */
+/* $Id: hash.c,v 1.3 2001/11/24 02:01:26 ukai Exp $ */
#include <string.h>
#include "hash.h"
#include "gc.h"
@@ -22,6 +22,8 @@ hashfunc(char *s)
#define keycomp(x,y) !strcmp(x,y)
+/* *INDENT-OFF* */
defhashfunc(char *, int, si)
defhashfunc(char *, char *, ss)
defhashfunc(char *, void *, hist)
+/* *INDENT-ON* */
diff --git a/hash.h b/hash.h
index 7484328..56d9505 100644
--- a/hash.h
+++ b/hash.h
@@ -1,4 +1,4 @@
-/* $Id: hash.h,v 1.2 2001/11/20 17:49:23 ukai Exp $ */
+/* $Id: hash.h,v 1.3 2001/11/24 02:01:26 ukai Exp $ */
#ifndef HASH_H
#define HASH_H
@@ -79,5 +79,4 @@ getHash_##sym(Hash_##sym *t, keytype key, type failval)\
return failval;\
return hi->value;\
}
-
#endif /* not HASH_H */
diff --git a/history.c b/history.c
index 4ff1b8a..22bb42a 100644
--- a/history.c
+++ b/history.c
@@ -1,9 +1,9 @@
-/* $Id: history.c,v 1.3 2001/11/20 17:49:23 ukai Exp $ */
+/* $Id: history.c,v 1.4 2001/11/24 02:01:26 ukai Exp $ */
#include "fm.h"
#ifdef USE_HISTORY
Buffer *
-historyBuffer(Hist * hist)
+historyBuffer(Hist *hist)
{
Str src = Strnew();
HistItem *item;
@@ -27,7 +27,7 @@ historyBuffer(Hist * hist)
}
void
-loadHistory(Hist * hist)
+loadHistory(Hist *hist)
{
FILE *f;
Str line;
@@ -50,7 +50,7 @@ loadHistory(Hist * hist)
}
void
-saveHistory(Hist * hist, size_t size)
+saveHistory(Hist *hist, size_t size)
{
FILE *f;
HistItem *item;
@@ -62,7 +62,7 @@ saveHistory(Hist * hist, size_t size)
return;
}
for (item = hist->list->first; item && hist->list->nitem > size;
- item = item->next)
+ item = item->next)
size++;
for (; item; item = item->next)
fprintf(f, "%s\n", (char *)item->ptr);
@@ -86,11 +86,11 @@ HistItem *
unshiftHist(Hist *hist, char *ptr)
{
HistItem *item;
-
+
if (hist == NULL || hist->list == NULL)
return NULL;
item = (HistItem *)newListItem((void *)allocStr(ptr, 0),
- (ListItem *)hist->list->first, NULL);
+ (ListItem *)hist->list->first, NULL);
if (hist->list->first)
hist->list->first->prev = item;
else
@@ -99,16 +99,16 @@ unshiftHist(Hist *hist, char *ptr)
hist->list->nitem++;
return item;
}
-
+
HistItem *
pushHist(Hist *hist, char *ptr)
- {
+{
HistItem *item;
-
+
if (hist == NULL || hist->list == NULL)
return NULL;
item = (HistItem *)newListItem((void *)allocStr(ptr, 0),
- NULL, (ListItem *)hist->list->last);
+ NULL, (ListItem *)hist->list->last);
if (hist->list->last)
hist->list->last->next = item;
else
@@ -121,7 +121,7 @@ pushHist(Hist *hist, char *ptr)
/* Don't mix pushHashHist() and pushHist()/unshiftHist(). */
HistItem *
-pushHashHist(Hist * hist, char *ptr)
+pushHashHist(Hist *hist, char *ptr)
{
HistItem *item;
@@ -131,11 +131,11 @@ pushHashHist(Hist * hist, char *ptr)
if (item) {
if (item->next)
item->next->prev = item->prev;
- else /* item == hist->list->last */
+ else /* item == hist->list->last */
hist->list->last = item->prev;
if (item->prev)
item->prev->next = item->next;
- else /* item == hist->list->first */
+ else /* item == hist->list->first */
hist->list->first = item->next;
hist->list->nitem--;
}
@@ -145,7 +145,7 @@ pushHashHist(Hist * hist, char *ptr)
}
HistItem *
-getHashHist(Hist * hist, char *ptr)
+getHashHist(Hist *hist, char *ptr)
{
HistItem *item;
@@ -160,7 +160,7 @@ getHashHist(Hist * hist, char *ptr)
}
char *
-lastHist(Hist * hist)
+lastHist(Hist *hist)
{
if (hist == NULL || hist->list == NULL)
return NULL;
@@ -172,7 +172,7 @@ lastHist(Hist * hist)
}
char *
-nextHist(Hist * hist)
+nextHist(Hist *hist)
{
if (hist == NULL || hist->list == NULL)
return NULL;
@@ -184,7 +184,7 @@ nextHist(Hist * hist)
}
char *
-prevHist(Hist * hist)
+prevHist(Hist *hist)
{
if (hist == NULL || hist->list == NULL)
return NULL;
@@ -192,5 +192,5 @@ prevHist(Hist * hist)
hist->current = hist->current->prev;
return (char *)hist->current->ptr;
}
- return NULL;
+ return NULL;
}
diff --git a/history.h b/history.h
index b4e9453..22641d0 100644
--- a/history.h
+++ b/history.h
@@ -1,4 +1,4 @@
-/* $Id: history.h,v 1.2 2001/11/20 17:49:23 ukai Exp $ */
+/* $Id: history.h,v 1.3 2001/11/24 02:01:26 ukai Exp $ */
#ifndef HISTORY_H
#define HISTORY_H
@@ -13,8 +13,8 @@ typedef GeneralList HistList;
typedef struct {
HistList *list;
- HistItem *current;
- Hash_hist *hash;
+ HistItem *current;
+ Hash_hist *hash;
} Hist;
extern Hist *newHist();
@@ -26,4 +26,4 @@ extern char *lastHist(Hist *hist);
extern char *nextHist(Hist *hist);
extern char *prevHist(Hist *hist);
-#endif /* HISTORY_H */
+#endif /* HISTORY_H */
diff --git a/html.c b/html.c
index 3597796..4b7fad9 100644
--- a/html.c
+++ b/html.c
@@ -1,287 +1,301 @@
-/* $Id: html.c,v 1.4 2001/11/20 17:49:23 ukai Exp $ */
+/* $Id: html.c,v 1.5 2001/11/24 02:01:26 ukai Exp $ */
#include "html.h"
/* Define HTML Tag Infomation Table */
#define ATTR_CORE ATTR_ID
#define MAXA_CORE 1
-unsigned char ALST_A[] =
-{ATTR_NAME,ATTR_HREF,ATTR_TARGET,ATTR_HSEQ,ATTR_REFERER,ATTR_FRAMENAME,ATTR_CORE};
+unsigned char ALST_A[] = {
+ ATTR_NAME, ATTR_HREF, ATTR_TARGET, ATTR_HSEQ, ATTR_REFERER,
+ ATTR_FRAMENAME, ATTR_CORE
+};
#define MAXA_A MAXA_CORE + 6
-unsigned char ALST_P[] = {ATTR_ALIGN,ATTR_CORE};
+unsigned char ALST_P[] = { ATTR_ALIGN, ATTR_CORE };
#define MAXA_P MAXA_CORE + 1
-unsigned char ALST_UL[] = {ATTR_START,ATTR_TYPE,ATTR_CORE};
+unsigned char ALST_UL[] = { ATTR_START, ATTR_TYPE, ATTR_CORE };
#define MAXA_UL MAXA_CORE + 2
-unsigned char ALST_LI[] = {ATTR_TYPE,ATTR_VALUE,ATTR_CORE};
+unsigned char ALST_LI[] = { ATTR_TYPE, ATTR_VALUE, ATTR_CORE };
#define MAXA_LI MAXA_CORE + 2
-unsigned char ALST_HR[] = {ATTR_WIDTH,ATTR_ALIGN,ATTR_CORE};
+unsigned char ALST_HR[] = { ATTR_WIDTH, ATTR_ALIGN, ATTR_CORE };
#define MAXA_HR MAXA_CORE + 2
-unsigned char ALST_DL[] = {ATTR_COMPACT,ATTR_CORE};
+unsigned char ALST_DL[] = { ATTR_COMPACT, ATTR_CORE };
#define MAXA_DL MAXA_CORE + 1
-unsigned char ALST_PRE[] = {ATTR_FOR_TABLE,ATTR_CORE};
+unsigned char ALST_PRE[] = { ATTR_FOR_TABLE, ATTR_CORE };
#define MAXA_PRE MAXA_CORE + 1
unsigned char ALST_IMG[] =
-{ATTR_SRC,ATTR_ALT,ATTR_WIDTH,ATTR_HEIGHT,ATTR_USEMAP,ATTR_CORE};
+ { ATTR_SRC, ATTR_ALT, ATTR_WIDTH, ATTR_HEIGHT, ATTR_USEMAP, ATTR_CORE };
#define MAXA_IMG MAXA_CORE + 5
unsigned char ALST_TABLE[] =
-{ATTR_BORDER,ATTR_WIDTH,ATTR_HBORDER,ATTR_CELLSPACING,ATTR_CELLPADDING,ATTR_VSPACE,ATTR_CORE};
+ { ATTR_BORDER, ATTR_WIDTH, ATTR_HBORDER, ATTR_CELLSPACING,
+ ATTR_CELLPADDING, ATTR_VSPACE, ATTR_CORE
+};
#define MAXA_TABLE MAXA_CORE + 6
-unsigned char ALST_META[] = {ATTR_HTTP_EQUIV,ATTR_CONTENT,ATTR_CORE};
+unsigned char ALST_META[] = { ATTR_HTTP_EQUIV, ATTR_CONTENT, ATTR_CORE };
#define MAXA_META MAXA_CORE + 2
-unsigned char ALST_FRAME[] = {ATTR_SRC,ATTR_NAME,ATTR_CORE};
+unsigned char ALST_FRAME[] = { ATTR_SRC, ATTR_NAME, ATTR_CORE };
#define MAXA_FRAME MAXA_CORE + 2
-unsigned char ALST_FRAMESET[] = {ATTR_COLS,ATTR_ROWS,ATTR_CORE};
+unsigned char ALST_FRAMESET[] = { ATTR_COLS, ATTR_ROWS, ATTR_CORE };
#define MAXA_FRAMESET MAXA_CORE + 2
unsigned char ALST_FORM[] =
-{ATTR_METHOD,ATTR_ACTION,ATTR_CHARSET,ATTR_ACCEPT_CHARSET,ATTR_ENCTYPE,ATTR_TARGET,ATTR_NAME,ATTR_CORE};
+ { ATTR_METHOD, ATTR_ACTION, ATTR_CHARSET, ATTR_ACCEPT_CHARSET,
+ ATTR_ENCTYPE, ATTR_TARGET, ATTR_NAME, ATTR_CORE
+};
#define MAXA_FORM MAXA_CORE + 7
unsigned char ALST_INPUT[] =
-{ATTR_TYPE,ATTR_VALUE,ATTR_NAME,ATTR_CHECKED,ATTR_ACCEPT,ATTR_SIZE,ATTR_MAXLENGTH,ATTR_ALT,ATTR_READONLY,ATTR_CORE};
+ { ATTR_TYPE, ATTR_VALUE, ATTR_NAME, ATTR_CHECKED, ATTR_ACCEPT, ATTR_SIZE,
+ ATTR_MAXLENGTH, ATTR_ALT, ATTR_READONLY, ATTR_CORE
+};
#define MAXA_INPUT MAXA_CORE + 9
-unsigned char ALST_TEXTAREA[] = {ATTR_COLS,ATTR_ROWS,ATTR_NAME,ATTR_READONLY,ATTR_CORE};
+unsigned char ALST_TEXTAREA[] =
+ { ATTR_COLS, ATTR_ROWS, ATTR_NAME, ATTR_READONLY, ATTR_CORE };
#define MAXA_TEXTAREA MAXA_CORE + 4
-unsigned char ALST_SELECT[] = {ATTR_NAME,ATTR_MULTIPLE,ATTR_CORE};
+unsigned char ALST_SELECT[] = { ATTR_NAME, ATTR_MULTIPLE, ATTR_CORE };
#define MAXA_SELECT MAXA_CORE + 2
-unsigned char ALST_OPTION[] = {ATTR_VALUE,ATTR_LABEL,ATTR_SELECTED,ATTR_CORE};
+unsigned char ALST_OPTION[] =
+ { ATTR_VALUE, ATTR_LABEL, ATTR_SELECTED, ATTR_CORE };
#define MAXA_OPTION MAXA_CORE + 3
-unsigned char ALST_ISINDEX[] = {ATTR_ACTION,ATTR_PROMPT,ATTR_CORE};
+unsigned char ALST_ISINDEX[] = { ATTR_ACTION, ATTR_PROMPT, ATTR_CORE };
#define MAXA_ISINDEX MAXA_CORE + 2
-unsigned char ALST_MAP[] = {ATTR_NAME,ATTR_CORE};
+unsigned char ALST_MAP[] = { ATTR_NAME, ATTR_CORE };
#define MAXA_MAP MAXA_CORE + 1
-unsigned char ALST_AREA[] = {ATTR_HREF,ATTR_ALT,ATTR_CORE};
+unsigned char ALST_AREA[] = { ATTR_HREF, ATTR_ALT, ATTR_CORE };
#define MAXA_AREA MAXA_CORE + 2
-unsigned char ALST_BASE[] = {ATTR_HREF,ATTR_TARGET,ATTR_CORE};
+unsigned char ALST_BASE[] = { ATTR_HREF, ATTR_TARGET, ATTR_CORE };
#define MAXA_BASE MAXA_CORE + 2
-unsigned char ALST_BODY[] = {ATTR_BACKGROUND,ATTR_CORE};
+unsigned char ALST_BODY[] = { ATTR_BACKGROUND, ATTR_CORE };
#define MAXA_BODY MAXA_CORE + 1
-unsigned char ALST_TR[] = {ATTR_ALIGN,ATTR_VALIGN,ATTR_CORE};
+unsigned char ALST_TR[] = { ATTR_ALIGN, ATTR_VALIGN, ATTR_CORE };
#define MAXA_TR MAXA_CORE + 2
unsigned char ALST_TD[] =
-{ATTR_COLSPAN,ATTR_ROWSPAN,ATTR_ALIGN,ATTR_VALIGN,ATTR_WIDTH,ATTR_NOWRAP,ATTR_CORE};
+ { ATTR_COLSPAN, ATTR_ROWSPAN, ATTR_ALIGN, ATTR_VALIGN, ATTR_WIDTH,
+ ATTR_NOWRAP, ATTR_CORE
+};
#define MAXA_TD MAXA_CORE + 6
-unsigned char ALST_BGSOUND[] = {ATTR_SRC,ATTR_CORE};
+unsigned char ALST_BGSOUND[] = { ATTR_SRC, ATTR_CORE };
#define MAX_BGSOUND MAXA_CORE + 1
-unsigned char ALST_APPLET[] = {ATTR_ARCHIVE,ATTR_CORE};
+unsigned char ALST_APPLET[] = { ATTR_ARCHIVE, ATTR_CORE };
#define MAX_APPLET MAXA_CORE + 1
-unsigned char ALST_EMBED[] = {ATTR_SRC,ATTR_CORE};
+unsigned char ALST_EMBED[] = { ATTR_SRC, ATTR_CORE };
#define MAX_EMBED MAXA_CORE + 1
-unsigned char ALST_TABLE_ALT[] = {ATTR_TID};
+unsigned char ALST_TABLE_ALT[] = { ATTR_TID };
#define MAXA_TABLE_ALT 1
-unsigned char ALST_RULE[] = {ATTR_TYPE};
+unsigned char ALST_RULE[] = { ATTR_TYPE };
#define MAXA_RULE 1
-unsigned char ALST_TITLE_ALT[] = {ATTR_TITLE};
+unsigned char ALST_TITLE_ALT[] = { ATTR_TITLE };
#define MAXA_TITLE_ALT 1
unsigned char ALST_INPUT_ALT[] =
-{ATTR_HSEQ,ATTR_FID,ATTR_NO_EFFECT,ATTR_TYPE,ATTR_NAME,ATTR_VALUE,ATTR_CHECKED,ATTR_ACCEPT,ATTR_SIZE,ATTR_MAXLENGTH,ATTR_READONLY,ATTR_TEXTAREANUMBER,ATTR_SELECTNUMBER,ATTR_ROWS,ATTR_TOP_MARGIN,ATTR_BOTTOM_MARGIN};
+ { ATTR_HSEQ, ATTR_FID, ATTR_NO_EFFECT, ATTR_TYPE, ATTR_NAME, ATTR_VALUE,
+ ATTR_CHECKED, ATTR_ACCEPT, ATTR_SIZE, ATTR_MAXLENGTH, ATTR_READONLY,
+ ATTR_TEXTAREANUMBER,
+ ATTR_SELECTNUMBER, ATTR_ROWS, ATTR_TOP_MARGIN, ATTR_BOTTOM_MARGIN
+};
#define MAXA_INPUT_ALT 16
-unsigned char ALST_IMG_ALT[] = {ATTR_SRC};
+unsigned char ALST_IMG_ALT[] = { ATTR_SRC };
#define MAXA_IMG_ALT 1
-unsigned char ALST_NOP[] = {ATTR_CORE};
+unsigned char ALST_NOP[] = { ATTR_CORE };
#define MAXA_NOP MAXA_CORE
-TagInfo TagMAP[MAX_HTMLTAG] =
-{
- {NULL, NULL, 0, 0}, /* 0 HTML_UNKNOWN */
- {"a", ALST_A, MAXA_A, 0}, /* 1 HTML_A */
- {"/a", NULL, 0, TFLG_END}, /* 2 HTML_N_A */
- {"h", ALST_P, MAXA_P, 0}, /* 3 HTML_H */
- {"/h", NULL, 0, TFLG_END}, /* 4 HTML_N_H */
- {"p", ALST_P, MAXA_P, 0}, /* 5 HTML_P */
- {"br", NULL, 0, 0}, /* 6 HTML_BR */
- {"b", NULL, 0, 0}, /* 7 HTML_B */
- {"/b", NULL, 0, TFLG_END}, /* 8 HTML_N_B */
- {"ul", ALST_UL, MAXA_UL, 0}, /* 9 HTML_UL */
- {"/ul", NULL, 0, TFLG_END}, /* 10 HTML_N_UL */
- {"li", ALST_LI, MAXA_LI, 0}, /* 11 HTML_LI */
- {"ol", ALST_UL, MAXA_UL, 0}, /* 12 HTML_OL */
- {"/ol", NULL, 0, TFLG_END}, /* 13 HTML_N_OL */
- {"title", NULL, 0, 0}, /* 14 HTML_TITLE */
- {"/title", NULL, 0, TFLG_END}, /* 15 HTML_N_TITLE */
- {"hr", ALST_HR, MAXA_HR, 0}, /* 16 HTML_HR */
- {"dl", ALST_DL, MAXA_DL, 0}, /* 17 HTML_DL */
- {"/dl", NULL, 0, TFLG_END}, /* 18 HTML_N_DL */
- {"dt", NULL, 0, 0}, /* 19 HTML_DT */
- {"dd", NULL, 0, 0}, /* 20 HTML_DD */
- {"pre", ALST_PRE, MAXA_PRE, 0}, /* 21 HTML_PRE */
- {"/pre", NULL, 0, TFLG_END}, /* 22 HTML_N_PRE */
- {"blockquote", NULL, 0, 0}, /* 23 HTML_BLQ */
- {"/blockquote", NULL, 0, TFLG_END}, /* 24 HTML_N_BLQ */
- {"img", ALST_IMG, MAXA_IMG, 0}, /* 25 HTML_IMG */
- {"listing", NULL, 0, 0}, /* 26 HTML_LISTING */
- {"/listing", NULL, 0, TFLG_END}, /* 27 HTML_N_LISTING */
- {"xmp", NULL, 0, 0}, /* 28 HTML_XMP */
- {"/xmp", NULL, 0, TFLG_END}, /* 29 HTML_N_XMP */
- {"plaintext", NULL, 0, 0}, /* 30 HTML_PLAINTEXT */
- {"table", ALST_TABLE, MAXA_TABLE, 0}, /* 31 HTML_TABLE */
- {"/table", NULL, 0, TFLG_END}, /* 32 HTML_N_TABLE */
- {"meta", ALST_META, MAXA_META, 0}, /* 33 HTML_META */
- {"/p", NULL, 0, TFLG_END}, /* 34 HTML_N_P */
- {"frame", ALST_FRAME, MAXA_FRAME, 0}, /* 35 HTML_FRAME */
- {"frameset", ALST_FRAMESET, MAXA_FRAMESET, 0}, /* 36 HTML_FRAMESET */
- {"/frameset", NULL, 0, TFLG_END}, /* 37 HTML_N_FRAMESET */
- {"center", NULL, 0, 0}, /* 38 HTML_CENTER */
- {"/center", NULL, 0, TFLG_END}, /* 39 HTML_N_CENTER */
- {"font", NULL, 0, 0}, /* 40 HTML_FONT */
- {"/font", NULL, 0, TFLG_END}, /* 41 HTML_N_FONT */
- {"form", ALST_FORM, MAXA_FORM, 0}, /* 42 HTML_FORM */
- {"/form", NULL, 0, TFLG_END}, /* 43 HTML_N_FORM */
- {"input", ALST_INPUT, MAXA_INPUT, 0}, /* 44 HTML_INPUT */
- {"textarea", ALST_TEXTAREA, MAXA_TEXTAREA, 0}, /* 45 HTML_TEXTAREA */
- {"/textarea", NULL, 0, TFLG_END}, /* 46 HTML_N_TEXTAREA */
- {"select", ALST_SELECT, MAXA_SELECT, 0}, /* 47 HTML_SELECT */
- {"/select", NULL, 0, TFLG_END}, /* 48 HTML_N_SELECT */
- {"option", ALST_OPTION, MAXA_OPTION, 0}, /* 49 HTML_OPTION */
- {"nobr", NULL, 0, 0}, /* 50 HTML_NOBR */
- {"/nobr", NULL, 0, TFLG_END}, /* 51 HTML_N_NOBR */
- {"div", ALST_P, MAXA_P, 0}, /* 52 HTML_DIV */
- {"/div", NULL, 0, TFLG_END}, /* 53 HTML_N_DIV */
- {"isindex", ALST_ISINDEX, MAXA_ISINDEX, 0}, /* 54 HTML_ISINDEX */
- {"map", ALST_MAP, MAXA_MAP, 0}, /* 55 HTML_MAP */
- {"/map", NULL, 0, TFLG_END}, /* 56 HTML_N_MAP */
- {"area", ALST_AREA, MAXA_AREA, 0}, /* 57 HTML_AREA */
- {"script", NULL, 0, 0}, /* 58 HTML_SCRIPT */
- {"/script", NULL, 0, TFLG_END}, /* 59 HTML_N_SCRIPT */
- {"base", ALST_BASE, MAXA_BASE, 0}, /* 60 HTML_BASE */
- {"del", NULL, 0, 0}, /* 61 HTML_DEL */
- {"/del", NULL, 0, TFLG_END}, /* 62 HTML_N_DEL */
- {"ins", NULL, 0, 0}, /* 63 HTML_INS */
- {"/ins", NULL, 0, TFLG_END}, /* 64 HTML_N_INS */
- {"u", NULL, 0, 0}, /* 65 HTML_U */
- {"/u", NULL, 0, TFLG_END}, /* 66 HTML_N_U */
- {"style", NULL, 0, 0}, /* 67 HTML_STYLE */
- {"/style", NULL, 0, TFLG_END}, /* 68 HTML_N_STYLE */
- {"wbr", NULL, 0, 0}, /* 69 HTML_WBR */
- {"em", NULL, 0, 0}, /* 70 HTML_EM */
- {"/em", NULL, 0, TFLG_END}, /* 71 HTML_N_EM */
- {"body", ALST_BODY, MAXA_BODY, 0}, /* 72 HTML_BODY */
- {"/body", NULL, 0, TFLG_END}, /* 73 HTML_N_BODY */
- {"tr", ALST_TR, MAXA_TR, 0}, /* 74 HTML_TR */
- {"/tr", NULL, 0, TFLG_END}, /* 75 HTML_N_TR */
- {"td", ALST_TD, MAXA_TD, 0}, /* 76 HTML_TD */
- {"/td", NULL, 0, TFLG_END}, /* 77 HTML_N_TD */
- {"caption", NULL, 0, 0}, /* 78 HTML_CAPTION */
- {"/caption", NULL, 0, TFLG_END}, /* 79 HTML_N_CAPTION */
- {"th", ALST_TD, MAXA_TD, 0}, /* 80 HTML_TH */
- {"/th", NULL, 0, TFLG_END}, /* 81 HTML_N_TH */
- {"thead", NULL, 0, 0}, /* 82 HTML_THEAD */
- {"/thead", NULL, 0, TFLG_END}, /* 83 HTML_N_THEAD */
- {"tbody", NULL, 0, 0}, /* 84 HTML_TBODY */
- {"/tbody", NULL, 0, TFLG_END}, /* 85 HTML_N_TBODY */
- {"tfoot", NULL, 0, 0}, /* 86 HTML_TFOOT */
- {"/tfoot", NULL, 0, TFLG_END}, /* 87 HTML_N_TFOOT */
- {"colgroup", NULL, 0, 0}, /* 88 HTML_COLGROUP */
- {"/colgroup", NULL, 0, TFLG_END}, /* 89 HTML_N_COLGROUP */
- {"col", NULL, 0, 0}, /* 90 HTML_COL */
- {"bgsound", ALST_BGSOUND, MAX_BGSOUND, 0}, /* 91 HTML_BGSOUND */
- {"applet", ALST_APPLET, MAX_APPLET, 0}, /* 92 HTML_APPLET */
- {"embed", ALST_EMBED, MAX_EMBED, 0}, /* 93 HTML_EMBED */
- {"/option", NULL, 0, TFLG_END}, /* 94 HTML_N_OPTION */
- {"head", NULL, 0, 0}, /* 95 HTML_HEAD */
- {"/head", NULL, 0, TFLG_END}, /* 96 HTML_N_HEAD */
- {"doctype", NULL, 0, 0}, /* 97 HTML_DOCTYPE */
-
- {NULL, NULL, 0, 0}, /* 98 Undefined */
- {NULL, NULL, 0, 0}, /* 99 Undefined */
- {NULL, NULL, 0, 0}, /* 100 Undefined */
- {NULL, NULL, 0, 0}, /* 101 Undefined */
- {NULL, NULL, 0, 0}, /* 102 Undefined */
- {NULL, NULL, 0, 0}, /* 103 Undefined */
- {NULL, NULL, 0, 0}, /* 104 Undefined */
- {NULL, NULL, 0, 0}, /* 105 Undefined */
- {NULL, NULL, 0, 0}, /* 106 Undefined */
- {NULL, NULL, 0, 0}, /* 107 Undefined */
- {NULL, NULL, 0, 0}, /* 108 Undefined */
- {NULL, NULL, 0, 0}, /* 109 Undefined */
- {NULL, NULL, 0, 0}, /* 110 Undefined */
- {NULL, NULL, 0, 0}, /* 111 Undefined */
- {NULL, NULL, 0, 0}, /* 112 Undefined */
+TagInfo TagMAP[MAX_HTMLTAG] = {
+ {NULL, NULL, 0, 0}, /* 0 HTML_UNKNOWN */
+ {"a", ALST_A, MAXA_A, 0}, /* 1 HTML_A */
+ {"/a", NULL, 0, TFLG_END}, /* 2 HTML_N_A */
+ {"h", ALST_P, MAXA_P, 0}, /* 3 HTML_H */
+ {"/h", NULL, 0, TFLG_END}, /* 4 HTML_N_H */
+ {"p", ALST_P, MAXA_P, 0}, /* 5 HTML_P */
+ {"br", NULL, 0, 0}, /* 6 HTML_BR */
+ {"b", NULL, 0, 0}, /* 7 HTML_B */
+ {"/b", NULL, 0, TFLG_END}, /* 8 HTML_N_B */
+ {"ul", ALST_UL, MAXA_UL, 0}, /* 9 HTML_UL */
+ {"/ul", NULL, 0, TFLG_END}, /* 10 HTML_N_UL */
+ {"li", ALST_LI, MAXA_LI, 0}, /* 11 HTML_LI */
+ {"ol", ALST_UL, MAXA_UL, 0}, /* 12 HTML_OL */
+ {"/ol", NULL, 0, TFLG_END}, /* 13 HTML_N_OL */
+ {"title", NULL, 0, 0}, /* 14 HTML_TITLE */
+ {"/title", NULL, 0, TFLG_END}, /* 15 HTML_N_TITLE */
+ {"hr", ALST_HR, MAXA_HR, 0}, /* 16 HTML_HR */
+ {"dl", ALST_DL, MAXA_DL, 0}, /* 17 HTML_DL */
+ {"/dl", NULL, 0, TFLG_END}, /* 18 HTML_N_DL */
+ {"dt", NULL, 0, 0}, /* 19 HTML_DT */
+ {"dd", NULL, 0, 0}, /* 20 HTML_DD */
+ {"pre", ALST_PRE, MAXA_PRE, 0}, /* 21 HTML_PRE */
+ {"/pre", NULL, 0, TFLG_END}, /* 22 HTML_N_PRE */
+ {"blockquote", NULL, 0, 0}, /* 23 HTML_BLQ */
+ {"/blockquote", NULL, 0, TFLG_END}, /* 24 HTML_N_BLQ */
+ {"img", ALST_IMG, MAXA_IMG, 0}, /* 25 HTML_IMG */
+ {"listing", NULL, 0, 0}, /* 26 HTML_LISTING */
+ {"/listing", NULL, 0, TFLG_END}, /* 27 HTML_N_LISTING */
+ {"xmp", NULL, 0, 0}, /* 28 HTML_XMP */
+ {"/xmp", NULL, 0, TFLG_END}, /* 29 HTML_N_XMP */
+ {"plaintext", NULL, 0, 0}, /* 30 HTML_PLAINTEXT */
+ {"table", ALST_TABLE, MAXA_TABLE, 0}, /* 31 HTML_TABLE */
+ {"/table", NULL, 0, TFLG_END}, /* 32 HTML_N_TABLE */
+ {"meta", ALST_META, MAXA_META, 0}, /* 33 HTML_META */
+ {"/p", NULL, 0, TFLG_END}, /* 34 HTML_N_P */
+ {"frame", ALST_FRAME, MAXA_FRAME, 0}, /* 35 HTML_FRAME */
+ {"frameset", ALST_FRAMESET, MAXA_FRAMESET, 0}, /* 36 HTML_FRAMESET */
+ {"/frameset", NULL, 0, TFLG_END}, /* 37 HTML_N_FRAMESET */
+ {"center", NULL, 0, 0}, /* 38 HTML_CENTER */
+ {"/center", NULL, 0, TFLG_END}, /* 39 HTML_N_CENTER */
+ {"font", NULL, 0, 0}, /* 40 HTML_FONT */
+ {"/font", NULL, 0, TFLG_END}, /* 41 HTML_N_FONT */
+ {"form", ALST_FORM, MAXA_FORM, 0}, /* 42 HTML_FORM */
+ {"/form", NULL, 0, TFLG_END}, /* 43 HTML_N_FORM */
+ {"input", ALST_INPUT, MAXA_INPUT, 0}, /* 44 HTML_INPUT */
+ {"textarea", ALST_TEXTAREA, MAXA_TEXTAREA, 0}, /* 45 HTML_TEXTAREA */
+ {"/textarea", NULL, 0, TFLG_END}, /* 46 HTML_N_TEXTAREA */
+ {"select", ALST_SELECT, MAXA_SELECT, 0}, /* 47 HTML_SELECT */
+ {"/select", NULL, 0, TFLG_END}, /* 48 HTML_N_SELECT */
+ {"option", ALST_OPTION, MAXA_OPTION, 0}, /* 49 HTML_OPTION */
+ {"nobr", NULL, 0, 0}, /* 50 HTML_NOBR */
+ {"/nobr", NULL, 0, TFLG_END}, /* 51 HTML_N_NOBR */
+ {"div", ALST_P, MAXA_P, 0}, /* 52 HTML_DIV */
+ {"/div", NULL, 0, TFLG_END}, /* 53 HTML_N_DIV */
+ {"isindex", ALST_ISINDEX, MAXA_ISINDEX, 0}, /* 54 HTML_ISINDEX */
+ {"map", ALST_MAP, MAXA_MAP, 0}, /* 55 HTML_MAP */
+ {"/map", NULL, 0, TFLG_END}, /* 56 HTML_N_MAP */
+ {"area", ALST_AREA, MAXA_AREA, 0}, /* 57 HTML_AREA */
+ {"script", NULL, 0, 0}, /* 58 HTML_SCRIPT */
+ {"/script", NULL, 0, TFLG_END}, /* 59 HTML_N_SCRIPT */
+ {"base", ALST_BASE, MAXA_BASE, 0}, /* 60 HTML_BASE */
+ {"del", NULL, 0, 0}, /* 61 HTML_DEL */
+ {"/del", NULL, 0, TFLG_END}, /* 62 HTML_N_DEL */
+ {"ins", NULL, 0, 0}, /* 63 HTML_INS */
+ {"/ins", NULL, 0, TFLG_END}, /* 64 HTML_N_INS */
+ {"u", NULL, 0, 0}, /* 65 HTML_U */
+ {"/u", NULL, 0, TFLG_END}, /* 66 HTML_N_U */
+ {"style", NULL, 0, 0}, /* 67 HTML_STYLE */
+ {"/style", NULL, 0, TFLG_END}, /* 68 HTML_N_STYLE */
+ {"wbr", NULL, 0, 0}, /* 69 HTML_WBR */
+ {"em", NULL, 0, 0}, /* 70 HTML_EM */
+ {"/em", NULL, 0, TFLG_END}, /* 71 HTML_N_EM */
+ {"body", ALST_BODY, MAXA_BODY, 0}, /* 72 HTML_BODY */
+ {"/body", NULL, 0, TFLG_END}, /* 73 HTML_N_BODY */
+ {"tr", ALST_TR, MAXA_TR, 0}, /* 74 HTML_TR */
+ {"/tr", NULL, 0, TFLG_END}, /* 75 HTML_N_TR */
+ {"td", ALST_TD, MAXA_TD, 0}, /* 76 HTML_TD */
+ {"/td", NULL, 0, TFLG_END}, /* 77 HTML_N_TD */
+ {"caption", NULL, 0, 0}, /* 78 HTML_CAPTION */
+ {"/caption", NULL, 0, TFLG_END}, /* 79 HTML_N_CAPTION */
+ {"th", ALST_TD, MAXA_TD, 0}, /* 80 HTML_TH */
+ {"/th", NULL, 0, TFLG_END}, /* 81 HTML_N_TH */
+ {"thead", NULL, 0, 0}, /* 82 HTML_THEAD */
+ {"/thead", NULL, 0, TFLG_END}, /* 83 HTML_N_THEAD */
+ {"tbody", NULL, 0, 0}, /* 84 HTML_TBODY */
+ {"/tbody", NULL, 0, TFLG_END}, /* 85 HTML_N_TBODY */
+ {"tfoot", NULL, 0, 0}, /* 86 HTML_TFOOT */
+ {"/tfoot", NULL, 0, TFLG_END}, /* 87 HTML_N_TFOOT */
+ {"colgroup", NULL, 0, 0}, /* 88 HTML_COLGROUP */
+ {"/colgroup", NULL, 0, TFLG_END}, /* 89 HTML_N_COLGROUP */
+ {"col", NULL, 0, 0}, /* 90 HTML_COL */
+ {"bgsound", ALST_BGSOUND, MAX_BGSOUND, 0}, /* 91 HTML_BGSOUND */
+ {"applet", ALST_APPLET, MAX_APPLET, 0}, /* 92 HTML_APPLET */
+ {"embed", ALST_EMBED, MAX_EMBED, 0}, /* 93 HTML_EMBED */
+ {"/option", NULL, 0, TFLG_END}, /* 94 HTML_N_OPTION */
+ {"head", NULL, 0, 0}, /* 95 HTML_HEAD */
+ {"/head", NULL, 0, TFLG_END}, /* 96 HTML_N_HEAD */
+ {"doctype", NULL, 0, 0}, /* 97 HTML_DOCTYPE */
+
+ {NULL, NULL, 0, 0}, /* 98 Undefined */
+ {NULL, NULL, 0, 0}, /* 99 Undefined */
+ {NULL, NULL, 0, 0}, /* 100 Undefined */
+ {NULL, NULL, 0, 0}, /* 101 Undefined */
+ {NULL, NULL, 0, 0}, /* 102 Undefined */
+ {NULL, NULL, 0, 0}, /* 103 Undefined */
+ {NULL, NULL, 0, 0}, /* 104 Undefined */
+ {NULL, NULL, 0, 0}, /* 105 Undefined */
+ {NULL, NULL, 0, 0}, /* 106 Undefined */
+ {NULL, NULL, 0, 0}, /* 107 Undefined */
+ {NULL, NULL, 0, 0}, /* 108 Undefined */
+ {NULL, NULL, 0, 0}, /* 109 Undefined */
+ {NULL, NULL, 0, 0}, /* 110 Undefined */
+ {NULL, NULL, 0, 0}, /* 111 Undefined */
+ {NULL, NULL, 0, 0}, /* 112 Undefined */
/* pseudo tag */
- {"table_alt", ALST_TABLE_ALT,MAXA_TABLE_ALT,TFLG_INT}, /* 113 HTML_TABLE_ALT */
- {"rule", ALST_RULE, MAXA_RULE, TFLG_INT}, /* 114 HTML_RULE */
- {"/rule", NULL, 0, TFLG_INT|TFLG_END}, /* 115 HTML_N_RULE */
- {"pre_int", NULL, 0, TFLG_INT}, /* 116 HTML_PRE_INT */
- {"/pre_int", NULL, 0, TFLG_INT|TFLG_END}, /* 117 HTML_N_PRE_INT */
- {"title_alt", ALST_TITLE_ALT,MAXA_TITLE_ALT,TFLG_INT}, /* 118 HTML_TITLE_ALT */
- {"form_int", ALST_FORM, MAXA_FORM, TFLG_INT}, /* 119 HTML_FORM_INT */
- {"/form_int", NULL, 0, TFLG_INT|TFLG_END}, /* 120 HTML_N_FORM_INT */
- {"dl_compact", NULL, 0, TFLG_INT}, /* 121 HTML_DL_COMPACT */
- {"input_alt", ALST_INPUT_ALT,MAXA_INPUT_ALT,TFLG_INT}, /* 122 HTML_INPUT_ALT */
- {"/input_alt", NULL, 0, TFLG_INT|TFLG_END}, /* 123 HTML_N_INPUT_ALT */
- {"img_alt", ALST_IMG_ALT, MAXA_IMG_ALT, TFLG_INT}, /* 124 HTML_IMG_ALT */
- {"/img_alt", NULL, 0, TFLG_INT|TFLG_END}, /* 125 HTML_N_IMG_ALT */
- {"eol", NULL, 0, TFLG_INT}, /* 126 HTML_EOL */
- {" ", ALST_NOP, MAXA_NOP, TFLG_INT}, /* 127 HTML_NOP */
+ {"table_alt", ALST_TABLE_ALT, MAXA_TABLE_ALT, TFLG_INT}, /* 113 HTML_TABLE_ALT */
+ {"rule", ALST_RULE, MAXA_RULE, TFLG_INT}, /* 114 HTML_RULE */
+ {"/rule", NULL, 0, TFLG_INT | TFLG_END}, /* 115 HTML_N_RULE */
+ {"pre_int", NULL, 0, TFLG_INT}, /* 116 HTML_PRE_INT */
+ {"/pre_int", NULL, 0, TFLG_INT | TFLG_END}, /* 117 HTML_N_PRE_INT */
+ {"title_alt", ALST_TITLE_ALT, MAXA_TITLE_ALT, TFLG_INT}, /* 118 HTML_TITLE_ALT */
+ {"form_int", ALST_FORM, MAXA_FORM, TFLG_INT}, /* 119 HTML_FORM_INT */
+ {"/form_int", NULL, 0, TFLG_INT | TFLG_END}, /* 120 HTML_N_FORM_INT */
+ {"dl_compact", NULL, 0, TFLG_INT}, /* 121 HTML_DL_COMPACT */
+ {"input_alt", ALST_INPUT_ALT, MAXA_INPUT_ALT, TFLG_INT}, /* 122 HTML_INPUT_ALT */
+ {"/input_alt", NULL, 0, TFLG_INT | TFLG_END}, /* 123 HTML_N_INPUT_ALT */
+ {"img_alt", ALST_IMG_ALT, MAXA_IMG_ALT, TFLG_INT}, /* 124 HTML_IMG_ALT */
+ {"/img_alt", NULL, 0, TFLG_INT | TFLG_END}, /* 125 HTML_N_IMG_ALT */
+ {"eol", NULL, 0, TFLG_INT}, /* 126 HTML_EOL */
+ {" ", ALST_NOP, MAXA_NOP, TFLG_INT}, /* 127 HTML_NOP */
};
-
-TagAttrInfo AttrMAP[MAX_TAGATTR] =
-{
- {NULL , VTYPE_NONE, 0}, /* 0 ATTR_UNKNOWN */
- {"accept" , VTYPE_NONE, 0}, /* 1 ATTR_ACCEPT */
- {"accept-charset", VTYPE_STR, 0}, /* 2 ATTR_ACCEPT_CHARSET */
- {"action" , VTYPE_ACTION, 0}, /* 3 ATTR_ACTION */
- {"align" , VTYPE_ALIGN, 0}, /* 4 ATTR_ALIGN */
- {"alt" , VTYPE_STR, 0}, /* 5 ATTR_ALT */
- {"archive" , VTYPE_STR, 0}, /* 6 ATTR_ARCHIVE */
- {"background" , VTYPE_STR, 0}, /* 7 ATTR_BACKGROUND */
- {"border" , VTYPE_NUMBER, 0}, /* 8 ATTR_BORDER */
- {"cellpadding" , VTYPE_NUMBER, 0}, /* 9 ATTR_CELLPADDING */
- {"cellspacing" , VTYPE_NUMBER, 0}, /* 10 ATTR_CELLSPACING */
- {"charset" , VTYPE_STR, 0}, /* 11 ATTR_CHARSET */
- {"checked" , VTYPE_NONE, 0}, /* 12 ATTR_CHECKED */
- {"cols" , VTYPE_MLENGTH, 0}, /* 13 ATTR_COLS */
- {"colspan" , VTYPE_NUMBER, 0}, /* 14 ATTR_COLSPAN */
- {"content" , VTYPE_STR, 0}, /* 15 ATTR_CONTENT */
- {"enctype" , VTYPE_ENCTYPE, 0}, /* 16 ATTR_ENCTYPE */
- {"height" , VTYPE_LENGTH, 0}, /* 17 ATTR_HEIGHT */
- {"href" , VTYPE_STR, 0}, /* 18 ATTR_HREF */
- {"http-equiv" , VTYPE_STR, 0}, /* 19 ATTR_HTTP_EQUIV */
- {"id" , VTYPE_STR, 0}, /* 20 ATTR_ID */
- {"link" , VTYPE_STR, 0}, /* 21 ATTR_LINK */
- {"maxlength" , VTYPE_NUMBER, 0}, /* 22 ATTR_MAXLENGTH */
- {"method" , VTYPE_METHOD, 0}, /* 23 ATTR_METHOD */
- {"multiple" , VTYPE_NONE, 0}, /* 24 ATTR_MULTIPLE */
- {"name" , VTYPE_STR, 0}, /* 25 ATTR_NAME */
- {"nowrap" , VTYPE_NONE, 0}, /* 26 ATTR_NOWRAP */
- {"prompt" , VTYPE_STR, 0}, /* 27 ATTR_PROMPT */
- {"rows" , VTYPE_MLENGTH, 0}, /* 28 ATTR_ROWS */
- {"rowspan" , VTYPE_NUMBER, 0}, /* 29 ATTR_ROWSPAN */
- {"size" , VTYPE_NUMBER, 0}, /* 30 ATTR_SIZE */
- {"src" , VTYPE_STR, 0}, /* 31 ATTR_SRC */
- {"target" , VTYPE_STR, 0}, /* 32 ATTR_TARGET */
- {"type" , VTYPE_TYPE, 0}, /* 33 ATTR_TYPE */
- {"usemap" , VTYPE_STR, 0}, /* 34 ATTR_USEMAP */
- {"valign" , VTYPE_VALIGN, 0}, /* 35 ATTR_VALIGN */
- {"value" , VTYPE_STR, 0}, /* 36 ATTR_VALUE */
- {"vspace" , VTYPE_NUMBER, 0}, /* 37 ATTR_VSPACE */
- {"width" , VTYPE_LENGTH, 0}, /* 38 ATTR_WIDTH */
- {"compact" , VTYPE_NONE, 0}, /* 39 ATTR_COMPACT */
- {"start" , VTYPE_NUMBER, 0}, /* 40 ATTR_START */
- {"selected" , VTYPE_NONE, 0}, /* 41 ATTR_SELECTED */
- {"label" , VTYPE_STR, 0}, /* 42 ATTR_LABEL */
- {"readonly" , VTYPE_NONE, 0}, /* 43 ATTR_READONLY */
-
- {NULL , VTYPE_NONE, 0}, /* 44 Undefined */
- {NULL , VTYPE_NONE, 0}, /* 45 Undefined */
- {NULL , VTYPE_NONE, 0}, /* 46 Undefined */
- {NULL , VTYPE_NONE, 0}, /* 47 Undefined */
- {NULL , VTYPE_NONE, 0}, /* 48 Undefined */
- {NULL , VTYPE_NONE, 0}, /* 49 Undefined */
- {NULL , VTYPE_NONE, 0}, /* 50 Undefined */
-
- /* Internal attribute */
- {"top_margin" , VTYPE_NUMBER, AFLG_INT}, /* 51 ATTR_TOP_MARGIN, */
- {"bottom_margin" , VTYPE_NUMBER, AFLG_INT}, /* 52 ATTR_BOTTOM_MARGIN, */
- {"tid" , VTYPE_NUMBER, AFLG_INT}, /* 53 ATTR_TID */
- {"fid" , VTYPE_NUMBER, AFLG_INT}, /* 54 ATTR_FID */
- {"for_table" , VTYPE_NONE, AFLG_INT}, /* 55 ATTR_FOR_TABLE */
- {"framename" , VTYPE_STR, AFLG_INT}, /* 56 ATTR_FRAMENAME */
- {"hborder" , VTYPE_NONE, 0}, /* 57 ATTR_HBORDER */
- {"hseq" , VTYPE_NUMBER, AFLG_INT}, /* 58 ATTR_HSEQ */
- {"no_effect" , VTYPE_NONE, AFLG_INT}, /* 59 ATTR_NO_EFFECT */
- {"referer" , VTYPE_STR, AFLG_INT}, /* 60 ATTR_REFERER */
- {"selectnumber" , VTYPE_NUMBER, AFLG_INT}, /* 61 ATTR_SELECTNUMBER */
- {"textareanumber", VTYPE_NUMBER, AFLG_INT}, /* 62 ATTR_TEXTAREANUMBER */
- {"title" , VTYPE_STR, AFLG_INT}, /* 63 ATTR_TITLE */
+
+TagAttrInfo AttrMAP[MAX_TAGATTR] = {
+ {NULL, VTYPE_NONE, 0}, /* 0 ATTR_UNKNOWN */
+ {"accept", VTYPE_NONE, 0}, /* 1 ATTR_ACCEPT */
+ {"accept-charset", VTYPE_STR, 0}, /* 2 ATTR_ACCEPT_CHARSET */
+ {"action", VTYPE_ACTION, 0}, /* 3 ATTR_ACTION */
+ {"align", VTYPE_ALIGN, 0}, /* 4 ATTR_ALIGN */
+ {"alt", VTYPE_STR, 0}, /* 5 ATTR_ALT */
+ {"archive", VTYPE_STR, 0}, /* 6 ATTR_ARCHIVE */
+ {"background", VTYPE_STR, 0}, /* 7 ATTR_BACKGROUND */
+ {"border", VTYPE_NUMBER, 0}, /* 8 ATTR_BORDER */
+ {"cellpadding", VTYPE_NUMBER, 0}, /* 9 ATTR_CELLPADDING */
+ {"cellspacing", VTYPE_NUMBER, 0}, /* 10 ATTR_CELLSPACING */
+ {"charset", VTYPE_STR, 0}, /* 11 ATTR_CHARSET */
+ {"checked", VTYPE_NONE, 0}, /* 12 ATTR_CHECKED */
+ {"cols", VTYPE_MLENGTH, 0}, /* 13 ATTR_COLS */
+ {"colspan", VTYPE_NUMBER, 0}, /* 14 ATTR_COLSPAN */
+ {"content", VTYPE_STR, 0}, /* 15 ATTR_CONTENT */
+ {"enctype", VTYPE_ENCTYPE, 0}, /* 16 ATTR_ENCTYPE */
+ {"height", VTYPE_LENGTH, 0}, /* 17 ATTR_HEIGHT */
+ {"href", VTYPE_STR, 0}, /* 18 ATTR_HREF */
+ {"http-equiv", VTYPE_STR, 0}, /* 19 ATTR_HTTP_EQUIV */
+ {"id", VTYPE_STR, 0}, /* 20 ATTR_ID */
+ {"link", VTYPE_STR, 0}, /* 21 ATTR_LINK */
+ {"maxlength", VTYPE_NUMBER, 0}, /* 22 ATTR_MAXLENGTH */
+ {"method", VTYPE_METHOD, 0}, /* 23 ATTR_METHOD */
+ {"multiple", VTYPE_NONE, 0}, /* 24 ATTR_MULTIPLE */
+ {"name", VTYPE_STR, 0}, /* 25 ATTR_NAME */
+ {"nowrap", VTYPE_NONE, 0}, /* 26 ATTR_NOWRAP */
+ {"prompt", VTYPE_STR, 0}, /* 27 ATTR_PROMPT */
+ {"rows", VTYPE_MLENGTH, 0}, /* 28 ATTR_ROWS */
+ {"rowspan", VTYPE_NUMBER, 0}, /* 29 ATTR_ROWSPAN */
+ {"size", VTYPE_NUMBER, 0}, /* 30 ATTR_SIZE */
+ {"src", VTYPE_STR, 0}, /* 31 ATTR_SRC */
+ {"target", VTYPE_STR, 0}, /* 32 ATTR_TARGET */
+ {"type", VTYPE_TYPE, 0}, /* 33 ATTR_TYPE */
+ {"usemap", VTYPE_STR, 0}, /* 34 ATTR_USEMAP */
+ {"valign", VTYPE_VALIGN, 0}, /* 35 ATTR_VALIGN */
+ {"value", VTYPE_STR, 0}, /* 36 ATTR_VALUE */
+ {"vspace", VTYPE_NUMBER, 0}, /* 37 ATTR_VSPACE */
+ {"width", VTYPE_LENGTH, 0}, /* 38 ATTR_WIDTH */
+ {"compact", VTYPE_NONE, 0}, /* 39 ATTR_COMPACT */
+ {"start", VTYPE_NUMBER, 0}, /* 40 ATTR_START */
+ {"selected", VTYPE_NONE, 0}, /* 41 ATTR_SELECTED */
+ {"label", VTYPE_STR, 0}, /* 42 ATTR_LABEL */
+ {"readonly", VTYPE_NONE, 0}, /* 43 ATTR_READONLY */
+
+ {NULL, VTYPE_NONE, 0}, /* 44 Undefined */
+ {NULL, VTYPE_NONE, 0}, /* 45 Undefined */
+ {NULL, VTYPE_NONE, 0}, /* 46 Undefined */
+ {NULL, VTYPE_NONE, 0}, /* 47 Undefined */
+ {NULL, VTYPE_NONE, 0}, /* 48 Undefined */
+ {NULL, VTYPE_NONE, 0}, /* 49 Undefined */
+ {NULL, VTYPE_NONE, 0}, /* 50 Undefined */
+
+ /* Internal attribute */
+ {"top_margin", VTYPE_NUMBER, AFLG_INT}, /* 51 ATTR_TOP_MARGIN, */
+ {"bottom_margin", VTYPE_NUMBER, AFLG_INT}, /* 52 ATTR_BOTTOM_MARGIN, */
+ {"tid", VTYPE_NUMBER, AFLG_INT}, /* 53 ATTR_TID */
+ {"fid", VTYPE_NUMBER, AFLG_INT}, /* 54 ATTR_FID */
+ {"for_table", VTYPE_NONE, AFLG_INT}, /* 55 ATTR_FOR_TABLE */
+ {"framename", VTYPE_STR, AFLG_INT}, /* 56 ATTR_FRAMENAME */
+ {"hborder", VTYPE_NONE, 0}, /* 57 ATTR_HBORDER */
+ {"hseq", VTYPE_NUMBER, AFLG_INT}, /* 58 ATTR_HSEQ */
+ {"no_effect", VTYPE_NONE, AFLG_INT}, /* 59 ATTR_NO_EFFECT */
+ {"referer", VTYPE_STR, AFLG_INT}, /* 60 ATTR_REFERER */
+ {"selectnumber", VTYPE_NUMBER, AFLG_INT}, /* 61 ATTR_SELECTNUMBER */
+ {"textareanumber", VTYPE_NUMBER, AFLG_INT}, /* 62 ATTR_TEXTAREANUMBER */
+ {"title", VTYPE_STR, AFLG_INT}, /* 63 ATTR_TITLE */
};
diff --git a/html.h b/html.h
index e828427..b83b769 100644
--- a/html.h
+++ b/html.h
@@ -1,4 +1,4 @@
-/* $Id: html.h,v 1.3 2001/11/15 00:32:13 a-ito Exp $ */
+/* $Id: html.h,v 1.4 2001/11/24 02:01:26 ukai Exp $ */
#ifndef _HTML_H
#define _HTML_H
#ifdef USE_SSL
@@ -268,10 +268,10 @@ typedef struct {
/* HTML Tag Information Table */
typedef struct html_tag_info {
- char *name;
- unsigned char *accept_attribute;
- unsigned char max_attribute;
- unsigned char flag;
+ char *name;
+ unsigned char *accept_attribute;
+ unsigned char max_attribute;
+ unsigned char flag;
} TagInfo;
#define TFLG_END 1
@@ -280,9 +280,9 @@ typedef struct html_tag_info {
/* HTML Tag Attribute Information Table */
typedef struct tag_attribute_info {
- char *name;
- unsigned char vtype;
- unsigned char flag;
+ char *name;
+ unsigned char vtype;
+ unsigned char flag;
} TagAttrInfo;
#define AFLG_INT 1
diff --git a/indep.c b/indep.c
index d359253..e08d7d0 100644
--- a/indep.c
+++ b/indep.c
@@ -1,4 +1,4 @@
-/* $Id: indep.c,v 1.8 2001/11/22 14:15:19 ukai Exp $ */
+/* $Id: indep.c,v 1.9 2001/11/24 02:01:26 ukai Exp $ */
#include "fm.h"
#include <stdio.h>
#include <pwd.h>
@@ -33,8 +33,8 @@ allocStr(const char *s, int len)
int
strCmp(const void *s1, const void *s2)
{
- unsigned char *p1 = *(unsigned char **) s1;
- unsigned char *p2 = *(unsigned char **) s2;
+ unsigned char *p1 = *(unsigned char **)s1;
+ unsigned char *p2 = *(unsigned char **)s2;
while ((*p1 != '\0') && (*p1 == *p2)) {
p1++;
@@ -92,7 +92,7 @@ cleanupName(char *name)
q += 3;
}
else {
- while (p != buf && *--p != '/'); /* ->foo/FOO */
+ while (p != buf && *--p != '/') ; /* ->foo/FOO */
*p = '\0';
q += 3;
strcat(buf, q);
@@ -106,7 +106,7 @@ cleanupName(char *name)
/* ../../.. */
}
else {
- while (p != buf && *--p != '/'); /* ->foo/ */
+ while (p != buf && *--p != '/') ; /* ->foo/ */
*++p = '\0';
}
break;
@@ -224,12 +224,9 @@ remove_space(char *str)
{
char *p, *q;
- for (p = str; *p && IS_SPACE(*p); p++)
- ;
- for (q = p; *q; q++)
- ;
- for (; q > p && IS_SPACE(*(q-1)); q--)
- ;
+ for (p = str; *p && IS_SPACE(*p); p++) ;
+ for (q = p; *q; q++) ;
+ for (; q > p && IS_SPACE(*(q - 1)); q--) ;
if (*q != '\0')
return Strnew_charp_n(p, q - p)->ptr;
return p;
@@ -252,8 +249,7 @@ void
cleanup_line(Str s, int mode)
{
if (s->length >= 2 &&
- s->ptr[s->length - 2] == '\r' &&
- s->ptr[s->length - 1] == '\n') {
+ s->ptr[s->length - 2] == '\r' && s->ptr[s->length - 1] == '\n') {
Strshrink(s, 2);
Strcat_char(s, '\n');
}
@@ -283,27 +279,26 @@ getescapechar(char **str)
p++;
if (*p == 'x' || *p == 'X') {
p++;
- if (! IS_XDIGIT(*p)) {
+ if (!IS_XDIGIT(*p)) {
*str = p;
return -1;
}
q = p;
- for (p++; IS_XDIGIT(*p); p++)
- ;
+ for (p++; IS_XDIGIT(*p); p++) ;
q = allocStr(q, p - q);
if (*p == ';')
p++;
*str = p;
sscanf(q, "%x", &dummy);
return dummy;
- } else {
- if (! IS_DIGIT(*p)) {
+ }
+ else {
+ if (!IS_DIGIT(*p)) {
*str = p;
return -1;
}
q = p;
- for (p++; IS_DIGIT(*p); p++)
- ;
+ for (p++; IS_DIGIT(*p); p++) ;
q = allocStr(q, p - q);
if (*p == ';')
p++;
@@ -312,24 +307,22 @@ getescapechar(char **str)
return dummy;
}
}
- if (! IS_ALPHA(*p)) {
+ if (!IS_ALPHA(*p)) {
*str = p;
return -1;
}
q = p;
- for (p++; IS_ALNUM(*p); p++)
- ;
+ for (p++; IS_ALNUM(*p); p++) ;
q = allocStr(q, p - q);
- if (strcasestr("lt gt amp quot nbsp",q) &&
- *p != '=') {
+ if (strcasestr("lt gt amp quot nbsp", q) && *p != '=') {
/* a character entity MUST be terminated with ";". However,
- there's MANY web pages which uses &lt , &gt or something
- like them as &lt;, &gt;, etc. Therefore, we treat the most
- popular character entities (including &#xxxx;) without
- the last ";" as character entities. If the trailing character
- is "=", it must be a part of query in an URL. So &lt=, &gt=, etc.
- are not regarded as character entities.
- */
+ * there's MANY web pages which uses &lt , &gt or something
+ * like them as &lt;, &gt;, etc. Therefore, we treat the most
+ * popular character entities (including &#xxxx;) without
+ * the last ";" as character entities. If the trailing character
+ * is "=", it must be a part of query in an URL. So &lt=, &gt=, etc.
+ * are not regarded as character entities.
+ */
strict_entity = FALSE;
}
if (*p == ';')
@@ -405,7 +398,7 @@ html_unquote(char *str)
Str tmp = NULL;
char *p, *q;
- for (p = str; *p; ) {
+ for (p = str; *p;) {
if (*p == '&') {
if (tmp == NULL)
tmp = Strnew_charp_n(str, (int)(p - str));
@@ -439,7 +432,8 @@ url_unquote_char(char **str)
if (IS_XDIGIT(*p)) {
buf[1] = *(p++);
buf[2] = '\0';
- } else
+ }
+ else
buf[1] = '\0';
if (sscanf(buf, "%x", &n)) {
*str = p;
@@ -457,12 +451,13 @@ url_quote(char *str)
char buf[4];
for (p = str; *p; p++) {
- if (IS_CNTRL(*p) || *p == ' ' || ! IS_ASCII(*p)) {
+ if (IS_CNTRL(*p) || *p == ' ' || !IS_ASCII(*p)) {
if (tmp == NULL)
tmp = Strnew_charp_n(str, (int)(p - str));
sprintf(buf, "%%%02X", (unsigned char)*p);
Strcat_charp(tmp, buf);
- } else {
+ }
+ else {
if (tmp)
Strcat_char(tmp, *p);
}
@@ -479,11 +474,11 @@ url_unquote(char *str)
char *p, *q;
int c;
- for (p = str; *p; ) {
+ for (p = str; *p;) {
if (*p == '%') {
q = p;
c = url_unquote_char(&q);
- if (c >= 0 && (IS_CNTRL(c) || c == ' ' || ! IS_ASCII(c))) {
+ if (c >= 0 && (IS_CNTRL(c) || c == ' ' || !IS_ASCII(c))) {
if (tmp == NULL)
tmp = Strnew_charp_n(str, (int)(p - str));
if (c != '\0' && c != '\n' && c != '\r')
@@ -509,13 +504,14 @@ file_quote(char *str)
char buf[4];
for (p = str; *p; p++) {
- if (IS_CNTRL(*p) || *p == ' ' || ! IS_ASCII(*p) || *p == '+' ||
+ if (IS_CNTRL(*p) || *p == ' ' || !IS_ASCII(*p) || *p == '+' ||
*p == ':' || *p == '#' || *p == '?' || *p == '&' || *p == '%') {
if (tmp == NULL)
tmp = Strnew_charp_n(str, (int)(p - str));
sprintf(buf, "%%%02X", (unsigned char)*p);
Strcat_charp(tmp, buf);
- } else {
+ }
+ else {
if (tmp)
Strcat_char(tmp, *p);
}
@@ -532,7 +528,7 @@ file_unquote(char *str)
char *p, *q;
int c;
- for (p = str; *p; ) {
+ for (p = str; *p;) {
if (*p == '%') {
q = p;
c = url_unquote_char(&q);
@@ -582,12 +578,14 @@ Str_form_quote(Str x)
if (tmp == NULL)
tmp = Strnew_charp_n(x->ptr, (int)(p - x->ptr));
Strcat_char(tmp, '+');
- } else if (! is_url_safe(*p)) {
+ }
+ else if (!is_url_safe(*p)) {
if (tmp == NULL)
tmp = Strnew_charp_n(x->ptr, (int)(p - x->ptr));
sprintf(buf, "%%%02X", (unsigned char)*p);
Strcat_charp(tmp, buf);
- } else {
+ }
+ else {
if (tmp)
Strcat_char(tmp, *p);
}
@@ -604,14 +602,15 @@ Str_form_unquote(Str x)
char *p = x->ptr, *ep = x->ptr + x->length, *q;
int c;
- for (; p < ep; ) {
+ for (; p < ep;) {
if (*p == '+') {
if (tmp == NULL)
tmp = Strnew_charp_n(x->ptr, (int)(p - x->ptr));
Strcat_char(tmp, ' ');
p++;
continue;
- } else if (*p == '%') {
+ }
+ else if (*p == '%') {
q = p;
c = url_unquote_char(&q);
if (c >= 0) {
@@ -653,12 +652,13 @@ shell_quote(char *str)
char *p;
for (p = str; *p; p++) {
- if (! is_shell_safe(*p)) {
+ if (!is_shell_safe(*p)) {
if (tmp == NULL)
tmp = Strnew_charp_n(str, (int)(p - str));
- Strcat_char(tmp, '\\');
+ Strcat_char(tmp, '\\');
Strcat_char(tmp, *p);
- } else {
+ }
+ else {
if (tmp)
Strcat_char(tmp, *p);
}
@@ -668,7 +668,7 @@ shell_quote(char *str)
return str;
}
-static char*
+static char *
w3m_dir(const char *name, char *dft)
{
#ifdef USE_PATH_ENVVAR
diff --git a/inflate.c b/inflate.c
index 15636f0..aec19a5 100644
--- a/inflate.c
+++ b/inflate.c
@@ -1,4 +1,4 @@
-/* $Id: inflate.c,v 1.2 2001/11/20 17:49:23 ukai Exp $ */
+/* $Id: inflate.c,v 1.3 2001/11/24 02:01:26 ukai Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <zlib.h>
@@ -16,9 +16,10 @@ main(int argc, char **argv)
if (argc > 1) {
f = fopen(argv[1], "rb");
- if (! f)
+ if (!f)
exit(1);
- } else
+ }
+ else
f = stdin;
s.zalloc = Z_NULL;
@@ -28,12 +29,12 @@ main(int argc, char **argv)
if (status != Z_OK)
exit(1);
s.avail_in = 0;
- s.next_out = (Bytef *)outbuf;
+ s.next_out = (Bytef *) outbuf;
s.avail_out = sizeof(outbuf);
- flush = Z_NO_FLUSH;
+ flush = Z_NO_FLUSH;
while (1) {
if (s.avail_in == 0) {
- s.next_in = (Bytef *)inbuf;
+ s.next_in = (Bytef *) inbuf;
s.avail_in = fread(inbuf, 1, sizeof(inbuf), f);
}
status = inflate(&s, flush);
@@ -46,7 +47,7 @@ main(int argc, char **argv)
exit(1);
if (s.avail_out == 0) {
fwrite(outbuf, 1, sizeof(outbuf), stdout);
- s.next_out = (Bytef *)outbuf;
+ s.next_out = (Bytef *) outbuf;
s.avail_out = sizeof(outbuf);
}
}
diff --git a/islang.c b/islang.c
index af124c7..bcf9688 100644
--- a/islang.c
+++ b/islang.c
@@ -2,7 +2,7 @@
* Copyright (c) 2000, NBG01720@nifty.ne.jp
*
* To compile this program:
- * gcc -Zomf -Zcrtdll -O2 -Wall -s islang.c
+ * gcc -Zomf -Zcrtdll -O2 -Wall -s islang.c
*/
#define INCL_DOSNLS
#include <os2.h>
@@ -11,27 +11,30 @@
#include <string.h>
#include <ctype.h>
-int main(int argc,char**argv){
- if(argc<=1)
- return 1;
-
- if(isdigit((int)*argv[1])){
- ULONG CpList[8],CpSize;
- APIRET rc=DosQueryCp(sizeof(CpList),CpList,&CpSize);
- if(rc)
- return rc;
- while(--argc>0)
- if(*CpList==atoi(argv[argc]))
- return 0;
- }else{
- char*lang=getenv("LANG");
- if(!lang||!*lang){
- lang=getenv("LANGUAGE");
- if(!lang||!*lang)
+int
+main(int argc, char **argv)
+{
+ if (argc <= 1)
return 1;
+
+ if (isdigit((int)*argv[1])) {
+ ULONG CpList[8], CpSize;
+ APIRET rc = DosQueryCp(sizeof(CpList), CpList, &CpSize);
+ if (rc)
+ return rc;
+ while (--argc > 0)
+ if (*CpList == atoi(argv[argc]))
+ return 0;
}
- if(!strnicmp(lang,argv[1],2))
- return 0;
- }
- return 1;
+ else {
+ char *lang = getenv("LANG");
+ if (!lang || !*lang) {
+ lang = getenv("LANGUAGE");
+ if (!lang || !*lang)
+ return 1;
+ }
+ if (!strnicmp(lang, argv[1], 2))
+ return 0;
+ }
+ return 1;
}
diff --git a/istream.c b/istream.c
index aed9e9c..d866160 100644
--- a/istream.c
+++ b/istream.c
@@ -1,4 +1,4 @@
-/* $Id: istream.c,v 1.5 2001/11/20 08:15:22 ukai Exp $ */
+/* $Id: istream.c,v 1.6 2001/11/24 02:01:26 ukai Exp $ */
#include "fm.h"
#include "istream.h"
#include <signal.h>
@@ -35,9 +35,9 @@ do_update(BaseStream base)
base->stream.cur = base->stream.next = 0;
len = base->read(base->handle, base->stream.buf, base->stream.size);
if (len <= 0)
- base->iseos = TRUE;
+ base->iseos = TRUE;
else
- base->stream.next += len;
+ base->stream.next += len;
}
static int
@@ -60,7 +60,7 @@ init_buffer(BaseStream base, char *buf, int bufsize)
sb->size = bufsize;
sb->cur = 0;
if (buf) {
- sb->buf = (uchar *)buf;
+ sb->buf = (uchar *) buf;
sb->next = bufsize;
}
else {
@@ -93,13 +93,13 @@ newInputStream(int des)
stream->base.type = IST_BASIC;
stream->base.handle = New(int);
*(int *)stream->base.handle = des;
- stream->base.read = (int (*)()) basic_read;
- stream->base.close = (void (*)()) basic_close;
+ stream->base.read = (int (*)())basic_read;
+ stream->base.close = (void (*)())basic_close;
return stream;
}
InputStream
-newFileStream(FILE *f, void (*closep)())
+newFileStream(FILE * f, void (*closep) ())
{
InputStream stream;
if (f == NULL)
@@ -112,9 +112,9 @@ newFileStream(FILE *f, void (*closep)())
if (closep)
stream->file.handle->close = closep;
else
- stream->file.handle->close = (void (*)()) fclose;
- stream->file.read = (int (*)()) file_read;
- stream->file.close = (void (*)()) file_close;
+ stream->file.handle->close = (void (*)())fclose;
+ stream->file.read = (int (*)())file_read;
+ stream->file.close = (void (*)())file_close;
return stream;
}
@@ -128,14 +128,14 @@ newStrStream(Str s)
init_str_stream(&stream->base, s);
stream->str.type = IST_STR;
stream->str.handle = s;
- stream->str.read = (int (*)()) str_read;
+ stream->str.read = (int (*)())str_read;
stream->str.close = NULL;
return stream;
}
#ifdef USE_SSL
InputStream
-newSSLStream(SSL *ssl, int sock)
+newSSLStream(SSL * ssl, int sock)
{
InputStream stream;
if (sock < 0)
@@ -146,8 +146,8 @@ newSSLStream(SSL *ssl, int sock)
stream->ssl.handle = New(struct ssl_handle);
stream->ssl.handle->ssl = ssl;
stream->ssl.handle->sock = sock;
- stream->ssl.read = (int (*)()) ssl_read;
- stream->ssl.close = (void (*)()) ssl_close;
+ stream->ssl.read = (int (*)())ssl_read;
+ stream->ssl.close = (void (*)())ssl_close;
return stream;
}
#endif
@@ -167,8 +167,8 @@ newEncodedStream(InputStream is, char encoding)
stream->ens.handle->pos = 0;
stream->ens.handle->encoding = encoding;
stream->ens.handle->s = NULL;
- stream->ens.read = (int (*)()) ens_read;
- stream->ens.close = (void (*)()) ens_close;
+ stream->ens.read = (int (*)())ens_read;
+ stream->ens.close = (void (*)())ens_close;
return stream;
}
@@ -240,7 +240,8 @@ StrISgets(InputStream stream)
else {
if (s == NULL)
s = Strnew_size(sb->next - sb->cur + MARGIN_STR_SIZE);
- Strcat_charp_n(s, (char *)&sb->buf[sb->cur], sb->next - sb->cur);
+ Strcat_charp_n(s, (char *)&sb->buf[sb->cur],
+ sb->next - sb->cur);
sb->cur = sb->next;
}
}
@@ -275,8 +276,8 @@ StrmyISgets(InputStream stream)
return s;
}
for (i = sb->cur;
- i < sb->next && sb->buf[i] != '\n' && sb->buf[i] != '\r';
- i++);
+ i < sb->next && sb->buf[i] != '\n' && sb->buf[i] != '\r';
+ i++) ;
if (i < sb->next) {
len = i - sb->cur + 1;
if (s == NULL)
@@ -289,7 +290,8 @@ StrmyISgets(InputStream stream)
else {
if (s == NULL)
s = Strnew_size(sb->next - sb->cur + MARGIN_STR_SIZE);
- Strcat_charp_n(s, (char *)&sb->buf[sb->cur], sb->next - sb->cur);
+ Strcat_charp_n(s, (char *)&sb->buf[sb->cur],
+ sb->next - sb->cur);
sb->cur = sb->next;
}
}
@@ -371,7 +373,7 @@ ssl_get_certificate(InputStream stream)
return NULL;
bp = BIO_new(BIO_s_mem());
X509_print(bp, x);
- len = (int)BIO_ctrl(bp, BIO_CTRL_INFO,0,(char *)&p);
+ len = (int)BIO_ctrl(bp, BIO_CTRL_INFO, 0, (char *)&p);
s = Strnew_charp_n(p, len);
BIO_free_all(bp);
return s;
@@ -431,7 +433,7 @@ ssl_read(struct ssl_handle *handle, char *buf, int len)
break;
switch (SSL_get_error(handle->ssl, status)) {
case SSL_ERROR_WANT_READ:
- case SSL_ERROR_WANT_WRITE: /* reads can trigger write errors; see SSL_get_error(3) */
+ case SSL_ERROR_WANT_WRITE: /* reads can trigger write errors; see SSL_get_error(3) */
continue;
default:
break;
@@ -466,7 +468,7 @@ ens_read(struct ens_handle *handle, char *buf, int len)
if (handle->encoding == ENC_BASE64)
Strchop(handle->s);
else if (handle->encoding == ENC_UUENCODE) {
- if (! strncmp(handle->s->ptr, "begin", 5))
+ if (!strncmp(handle->s->ptr, "begin", 5))
handle->s = StrmyISgets(handle->is);
Strchop(handle->s);
}
@@ -479,7 +481,7 @@ ens_read(struct ens_handle *handle, char *buf, int len)
handle->s = decodeU(&p);
handle->pos = 0;
}
-
+
if (len > handle->s->length - handle->pos)
len = handle->s->length - handle->pos;
diff --git a/istream.h b/istream.h
index 991cc9f..b7138fa 100644
--- a/istream.h
+++ b/istream.h
@@ -1,4 +1,4 @@
-/* $Id: istream.h,v 1.3 2001/11/15 00:32:13 a-ito Exp $ */
+/* $Id: istream.h,v 1.4 2001/11/24 02:01:26 ukai Exp $ */
#ifndef IO_STREAM_H
#define IO_STREAM_H
@@ -15,7 +15,7 @@
struct stream_buffer {
unsigned char *buf;
- int size, cur, next;
+ int size, cur, next;
};
typedef struct stream_buffer *StreamBuffer;
@@ -44,73 +44,73 @@ struct ens_handle {
struct base_stream {
struct stream_buffer stream;
- void *handle;
- char type;
- char iseos;
- int (*read) ();
- void (*close) ();
+ void *handle;
+ char type;
+ char iseos;
+ int (*read) ();
+ void (*close) ();
};
struct file_stream {
struct stream_buffer stream;
- struct file_handle *handle;
- char type;
- char iseos;
- int (*read) ();
- void (*close) ();
+ struct file_handle *handle;
+ char type;
+ char iseos;
+ int (*read) ();
+ void (*close) ();
};
struct str_stream {
struct stream_buffer stream;
- Str handle;
- char type;
- char iseos;
- int (*read) ();
- void (*close) ();
+ Str handle;
+ char type;
+ char iseos;
+ int (*read) ();
+ void (*close) ();
};
#ifdef USE_SSL
struct ssl_stream {
struct stream_buffer stream;
- struct ssl_handle *handle;
- char type;
- char iseos;
- int (*read) ();
- void (*close) ();
+ struct ssl_handle *handle;
+ char type;
+ char iseos;
+ int (*read) ();
+ void (*close) ();
};
#endif /* USE_SSL */
struct encoded_stream {
struct stream_buffer stream;
- struct ens_handle *handle;
- char type;
- char iseos;
- int (*read) ();
- void (*close) ();
+ struct ens_handle *handle;
+ char type;
+ char iseos;
+ int (*read) ();
+ void (*close) ();
};
union input_stream {
- struct base_stream base;
- struct file_stream file;
- struct str_stream str;
+ struct base_stream base;
+ struct file_stream file;
+ struct str_stream str;
#ifdef USE_SSL
- struct ssl_stream ssl;
+ struct ssl_stream ssl;
#endif /* USE_SSL */
struct encoded_stream ens;
};
-typedef struct base_stream *BaseStream;
-typedef struct file_stream *FileStream;
-typedef struct str_stream *StrStream;
+typedef struct base_stream *BaseStream;
+typedef struct file_stream *FileStream;
+typedef struct str_stream *StrStream;
#ifdef USE_SSL
-typedef struct ssl_stream *SSLStream;
+typedef struct ssl_stream *SSLStream;
#endif /* USE_SSL */
typedef struct encoded_stream *EncodedStrStream;
-typedef union input_stream *InputStream;
+typedef union input_stream *InputStream;
extern InputStream newInputStream(int des);
-extern InputStream newFileStream(FILE * f, void (*closep)());
+extern InputStream newFileStream(FILE * f, void (*closep) ());
extern InputStream newStrStream(Str s);
#ifdef USE_SSL
extern InputStream newSSLStream(SSL * ssl, int sock);
diff --git a/keybind.c b/keybind.c
index e5f25f4..47c71a0 100644
--- a/keybind.c
+++ b/keybind.c
@@ -1,127 +1,123 @@
-/* $Id: keybind.c,v 1.3 2001/11/15 00:32:13 a-ito Exp $ */
+/* $Id: keybind.c,v 1.4 2001/11/24 02:01:26 ukai Exp $ */
#include "funcname2.h"
-char GlobalKeymap[128] =
-{
-/* C-@ C-a C-b C-c C-d C-e C-f C-g */
+char GlobalKeymap[128] = {
+ /* C-@ C-a C-b C-c C-d C-e C-f C-g */
#ifdef __EMX__
- pcmap, linbeg, movL, nulcmd, nulcmd, linend, movR, curlno,
+ pcmap, linbeg, movL, nulcmd, nulcmd, linend, movR, curlno,
#else
- _mark, linbeg, movL, nulcmd, nulcmd, linend, movR, curlno,
+ _mark, linbeg, movL, nulcmd, nulcmd, linend, movR, curlno,
#endif
-/* C-h C-i C-j C-k C-l C-m C-n C-o */
- ldHist, nextA, followA,cooLst, rdrwSc, followA,movD, nulcmd,
-/* C-p C-q C-r C-s C-t C-u C-v C-w */
- movU, nulcmd, srchbak,srchfor,nulcmd, prevA, pgFore, wrapToggle,
-/* C-x C-y C-z C-[ C-\ C-] C-^ C-_ */
- nulcmd, nulcmd, susp, escmap, nulcmd, nulcmd, nulcmd, nulcmd,
-/* SPC ! " # $ % & ' */
+ /* C-h C-i C-j C-k C-l C-m C-n C-o */
+ ldHist, nextA, followA, cooLst, rdrwSc, followA, movD, nulcmd,
+ /* C-p C-q C-r C-s C-t C-u C-v C-w */
+ movU, nulcmd, srchbak, srchfor, nulcmd, prevA, pgFore, wrapToggle,
+ /* C-x C-y C-z C-[ C-\ C-] C-^ C-_ */
+ nulcmd, nulcmd, susp, escmap, nulcmd, nulcmd, nulcmd, nulcmd,
+ /* SPC ! " # $ % & ' */
pgFore, execsh, reMark, pipesh, linend, nulcmd, nulcmd, nulcmd,
-/* ( ) * + , - . / */
+ /* ( ) * + , - . / */
nulcmd, nulcmd, nulcmd, nulcmd, col1L, nulcmd, col1R, srchfor,
-/* 0 1 2 3 4 5 6 7 */
+ /* 0 1 2 3 4 5 6 7 */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* 8 9 : ; < = > ? */
+ /* 8 9 : ; < = > ? */
nulcmd, nulcmd, chkURL, nulcmd, shiftl, pginfo, shiftr, srchbak,
-/* @ A B C D E F G */
+ /* @ A B C D E F G */
readsh, nulcmd, backBf, nulcmd, nulcmd, editBf, rFrame, goLineL,
-/* H I J K L M N O */
- ldhelp, followI,lup1, ldown1, nulcmd, extbrz, srchprv, nulcmd,
-/* P Q R S T U V W */
- nulcmd, quitfm, reload, svBuf, nulcmd, goURL, ldfile, movLW,
-/* X Y Z [ \ ] ^ _ */
- nulcmd, nulcmd, ctrCsrH,topA, nulcmd, lastA, linbeg, nulcmd,
-/* ` a b c d e f g */
- nulcmd, svA, pgBack, curURL, nulcmd, nulcmd, nulcmd, goLineF,
-/* h i j k l m n o */
- movL, peekIMG,movD, movU, movR, nulcmd, srchnxt, ldOpt,
-/* p q r s t u v w */
- nulcmd, qquitfm,nulcmd, selMn, nulcmd, peekURL,vwSrc, movRW,
-/* x y z { | } ~ DEL */
- nulcmd, nulcmd, ctrCsrV,nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
+ /* H I J K L M N O */
+ ldhelp, followI, lup1, ldown1, nulcmd, extbrz, srchprv, nulcmd,
+ /* P Q R S T U V W */
+ nulcmd, quitfm, reload, svBuf, nulcmd, goURL, ldfile, movLW,
+ /* X Y Z [ \ ] ^ _ */
+ nulcmd, nulcmd, ctrCsrH, topA, nulcmd, lastA, linbeg, nulcmd,
+ /* ` a b c d e f g */
+ nulcmd, svA, pgBack, curURL, nulcmd, nulcmd, nulcmd, goLineF,
+ /* h i j k l m n o */
+ movL, peekIMG, movD, movU, movR, nulcmd, srchnxt, ldOpt,
+ /* p q r s t u v w */
+ nulcmd, qquitfm, nulcmd, selMn, nulcmd, peekURL, vwSrc, movRW,
+ /* x y z { | } ~ DEL */
+ nulcmd, nulcmd, ctrCsrV, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
};
-char EscKeymap[128] =
-{
-/* C-@ C-a C-b C-c C-d C-e C-f C-g */
+char EscKeymap[128] = {
+ /* C-@ C-a C-b C-c C-d C-e C-f C-g */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* C-h C-i C-j C-k C-l C-m C-n C-o */
- nulcmd, prevA, svA, nulcmd, nulcmd, svA, nulcmd, nulcmd,
-/* C-p C-q C-r C-s C-t C-u C-v C-w */
+ /* C-h C-i C-j C-k C-l C-m C-n C-o */
+ nulcmd, prevA, svA, nulcmd, nulcmd, svA, nulcmd, nulcmd,
+ /* C-p C-q C-r C-s C-t C-u C-v C-w */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* C-x C-y C-z C-[ C-\ C-] C-^ C-_ */
+ /* C-x C-y C-z C-[ C-\ C-] C-^ C-_ */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* SPC ! " # $ % & ' */
+ /* SPC ! " # $ % & ' */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* ( ) * + , - . / */
+ /* ( ) * + , - . / */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* 0 1 2 3 4 5 6 7 */
+ /* 0 1 2 3 4 5 6 7 */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* 8 9 : ; < = > ? */
- nulcmd, nulcmd, chkNMID,nulcmd, goLineF,nulcmd, goLineL,nulcmd,
-/* @ A B C D E F G */
+ /* 8 9 : ; < = > ? */
+ nulcmd, nulcmd, chkNMID, nulcmd, goLineF, nulcmd, goLineL, nulcmd,
+ /* @ A B C D E F G */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* H I J K L M N O */
- nulcmd, svI, nulcmd, nulcmd, nulcmd, linkbrz,nulcmd, escbmap,
-/* P Q R S T U V W */
+ /* H I J K L M N O */
+ nulcmd, svI, nulcmd, nulcmd, nulcmd, linkbrz, nulcmd, escbmap,
+ /* P Q R S T U V W */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, dictwordat,
-/* X Y Z [ \ ] ^ _ */
- nulcmd, nulcmd, nulcmd, escbmap,nulcmd, nulcmd, nulcmd, nulcmd,
-/* ` a b c d e f g */
- nulcmd, adBmark,ldBmark,nulcmd, nulcmd, editScr,nulcmd, goLine,
-/* h i j k l m n o */
+ /* X Y Z [ \ ] ^ _ */
+ nulcmd, nulcmd, nulcmd, escbmap, nulcmd, nulcmd, nulcmd, nulcmd,
+ /* ` a b c d e f g */
+ nulcmd, adBmark, ldBmark, nulcmd, nulcmd, editScr, nulcmd, goLine,
+ /* h i j k l m n o */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nextMk, nulcmd,
-/* p q r s t u v w */
- prevMk, nulcmd, nulcmd, svSrc, nulcmd, nulcmd, pgBack, dictword,
-/* x y z { | } ~ DEL */
+ /* p q r s t u v w */
+ prevMk, nulcmd, nulcmd, svSrc, nulcmd, nulcmd, pgBack, dictword,
+ /* x y z { | } ~ DEL */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
};
-char EscBKeymap[128] =
-{
-/* C-@ C-a C-b C-c C-d C-e C-f C-g */
+char EscBKeymap[128] = {
+ /* C-@ C-a C-b C-c C-d C-e C-f C-g */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* C-h C-i C-j C-k C-l C-m C-n C-o */
+ /* C-h C-i C-j C-k C-l C-m C-n C-o */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* C-p C-q C-r C-s C-t C-u C-v C-w */
+ /* C-p C-q C-r C-s C-t C-u C-v C-w */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* C-x C-y C-z C-[ C-\ C-] C-^ C-_ */
+ /* C-x C-y C-z C-[ C-\ C-] C-^ C-_ */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* SPC ! " # $ % & ' */
+ /* SPC ! " # $ % & ' */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* ( ) * + , - . / */
+ /* ( ) * + , - . / */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* 0 1 2 3 4 5 6 7 */
+ /* 0 1 2 3 4 5 6 7 */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* 8 9 : ; < = > ? */
+ /* 8 9 : ; < = > ? */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* @ A B C D E F G */
+ /* @ A B C D E F G */
nulcmd, movU, movD, movR, movL, nulcmd, goLineL, pgFore,
-/* H I J K L M N O */
+ /* H I J K L M N O */
goLineF, pgBack, nulcmd, nulcmd, nulcmd, mouse, nulcmd, nulcmd,
-/* P Q R S T U V W */
+ /* P Q R S T U V W */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* X Y Z [ \ ] ^ _ */
+ /* X Y Z [ \ ] ^ _ */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* ` a b c d e f g */
+ /* ` a b c d e f g */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* h i j k l m n o */
+ /* h i j k l m n o */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* p q r s t u v w */
+ /* p q r s t u v w */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* x y z { | } ~ DEL */
+ /* x y z { | } ~ DEL */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
};
-char EscDKeymap[128] =
-{
-/* 0 1 INS 3 4 PgUp, PgDn 7 */
- nulcmd, goLineF,mainMn, nulcmd, goLineL,pgBack, pgFore, nulcmd,
-/* 8 9 10 F1 F2 F3 F4 F5 */
+char EscDKeymap[128] = {
+ /* 0 1 INS 3 4 PgUp, PgDn 7 */
+ nulcmd, goLineF, mainMn, nulcmd, goLineL, pgBack, pgFore, nulcmd,
+ /* 8 9 10 F1 F2 F3 F4 F5 */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* 16 F6 F7 F8 F9 F10 22 23 */
+ /* 16 F6 F7 F8 F9 F10 22 23 */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* 24 25 26 27 HELP 29 30 31 */
+ /* 24 25 26 27 HELP 29 30 31 */
nulcmd, nulcmd, nulcmd, nulcmd, mainMn, nulcmd, nulcmd, nulcmd,
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
@@ -141,58 +137,58 @@ char EscDKeymap[128] =
};
#ifdef __EMX__
-char PcKeymap[256]={
-// Null
- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 0
-// S-Tab
- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, prevA, // 8
-// A-q A-w A-E A-r A-t A-y A-u A-i
- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 16
-// A-o A-p A-[ A-] A-a A-s
- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 24
-// A-d A-f A-g A-h A-j A-k A-l A-;
- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 32
-// A-' A-' A-\ A-x A-c A-v
- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 40
-// A-b A-n A-m A-, A-. A-/ A-+
- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 48
-// F1 F2 F3 F4 F5
- nulcmd, nulcmd, nulcmd, ldhelp, nulcmd, qquitfm,nulcmd, nulcmd, // 56
-// F6 F7 F8 F9 F10 Home
- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, goLineF, // 64
-// Up PgUp A-/ Left 5 Right C-* End
- movU, pgBack, nulcmd, movL, nulcmd, movR, nulcmd, goLineL, // 72
-// Down PgDn Ins Del S-F1 S-F2 S-F3 S-F4
- movD, pgFore, mainMn, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 80
-// S-F5 S-F6 S-F7 S-F8 S-F9 S-F10 C-F1 C-F2
- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 88
-// C-F3 C-F4 C-F5 C-F6 C-F7 C-F8 C-F9 C-F10
- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 96
-// A-F1 A-F2 A-F3 A-F4 A-F5 A-F6 A-F7 A-F8
- nulcmd, nulcmd, nulcmd, qquitfm,nulcmd, nulcmd, nulcmd, nulcmd, // 104
-// A-F9 A-F10 PrtSc C-Left C-Right C-End C-PgDn C-Home
- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 112
-// A-1 A-2 A-3 A-4 A-5 A-6 A-7/8 A-9
- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 120
-// A-0 A - A-= C-PgUp F11 F12 S-F11
- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 128
-// S-F12 C-F11 C-F12 A-F11 A-F12 C-Up C-/ C-5
- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 136
-// S-* C-Down C-Ins C-Del C-Tab C - C-+
- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 144
- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 152
-// A - A-Tab A-Enter
- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 160
- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 168
- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 176
- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 184
- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 192
- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 200
- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 208
- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 216
- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 224
- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 232
- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 240
- nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd // 248
+char PcKeymap[256] = {
+ // Null
+ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 0
+ // S-Tab
+ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, prevA, // 8
+ // A-q A-w A-E A-r A-t A-y A-u A-i
+ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 16
+ // A-o A-p A-[ A-] A-a A-s
+ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 24
+ // A-d A-f A-g A-h A-j A-k A-l A-;
+ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 32
+ // A-' A-' A-\ A-x A-c A-v
+ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 40
+ // A-b A-n A-m A-, A-. A-/ A-+
+ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 48
+ // F1 F2 F3 F4 F5
+ nulcmd, nulcmd, nulcmd, ldhelp, nulcmd, qquitfm, nulcmd, nulcmd, // 56
+ // F6 F7 F8 F9 F10 Home
+ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, goLineF, // 64
+ // Up PgUp A-/ Left 5 Right C-* End
+ movU, pgBack, nulcmd, movL, nulcmd, movR, nulcmd, goLineL, // 72
+ // Down PgDn Ins Del S-F1 S-F2 S-F3 S-F4
+ movD, pgFore, mainMn, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 80
+ // S-F5 S-F6 S-F7 S-F8 S-F9 S-F10 C-F1 C-F2
+ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 88
+ // C-F3 C-F4 C-F5 C-F6 C-F7 C-F8 C-F9 C-F10
+ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 96
+ // A-F1 A-F2 A-F3 A-F4 A-F5 A-F6 A-F7 A-F8
+ nulcmd, nulcmd, nulcmd, qquitfm, nulcmd, nulcmd, nulcmd, nulcmd, // 104
+ // A-F9 A-F10 PrtSc C-Left C-Right C-End C-PgDn C-Home
+ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 112
+ // A-1 A-2 A-3 A-4 A-5 A-6 A-7/8 A-9
+ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 120
+ // A-0 A - A-= C-PgUp F11 F12 S-F11
+ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 128
+ // S-F12 C-F11 C-F12 A-F11 A-F12 C-Up C-/ C-5
+ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 136
+ // S-* C-Down C-Ins C-Del C-Tab C - C-+
+ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 144
+ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 152
+ // A - A-Tab A-Enter
+ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 160
+ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 168
+ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 176
+ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 184
+ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 192
+ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 200
+ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 208
+ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 216
+ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 224
+ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 232
+ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, // 240
+ nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd // 248
};
#endif
diff --git a/keybind_lynx.c b/keybind_lynx.c
index 4597a35..415030e 100644
--- a/keybind_lynx.c
+++ b/keybind_lynx.c
@@ -1,4 +1,4 @@
-/* $Id: keybind_lynx.c,v 1.3 2001/11/20 17:49:23 ukai Exp $ */
+/* $Id: keybind_lynx.c,v 1.4 2001/11/24 02:01:26 ukai Exp $ */
/*
* Lynx-like key binding.
*
@@ -13,123 +13,119 @@
#include "funcname2.h"
-char GlobalKeymap[128] =
-{
-/* C-@ C-a C-b C-c C-d C-e C-f C-g */
- _mark, goLineF,backBf, nulcmd, nulcmd, goLineL,followA,curlno,
-/* C-h C-i C-j C-k C-l C-m C-n C-o */
+char GlobalKeymap[128] = {
+ /* C-@ C-a C-b C-c C-d C-e C-f C-g */
+ _mark, goLineF, backBf, nulcmd, nulcmd, goLineL, followA, curlno,
+ /* C-h C-i C-j C-k C-l C-m C-n C-o */
ldHist, nextA, followA, cooLst, rdrwSc, followA, nextA, nulcmd,
-/* C-p C-q C-r C-s C-t C-u C-v C-w */
+ /* C-p C-q C-r C-s C-t C-u C-v C-w */
prevA, nulcmd, reload, srchfor, nulcmd, nulcmd, pgFore, rdrwSc,
-/* C-x C-y C-z C-[ C-\ C-] C-^ C-_ */
- nulcmd, nulcmd, susp, escmap, nulcmd, nulcmd, nulcmd, nulcmd,
-/* SPC ! " # $ % & ' */
+ /* C-x C-y C-z C-[ C-\ C-] C-^ C-_ */
+ nulcmd, nulcmd, susp, escmap, nulcmd, nulcmd, nulcmd, nulcmd,
+ /* SPC ! " # $ % & ' */
pgFore, execsh, reMark, pipesh, linend, nulcmd, nulcmd, nulcmd,
-/* ( ) * + , - . / */
+ /* ( ) * + , - . / */
nulcmd, nulcmd, nulcmd, pgFore, nulcmd, pgBack, nulcmd, srchfor,
-/* 0 1 2 3 4 5 6 7 */
+ /* 0 1 2 3 4 5 6 7 */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* 8 9 : ; < = > ? */
+ /* 8 9 : ; < = > ? */
nulcmd, nulcmd, chkURL, nulcmd, shiftl, pginfo, shiftr, ldhelp,
-/* @ A B C D E F G */
+ /* @ A B C D E F G */
readsh, nulcmd, backBf, nulcmd, nulcmd, editBf, rFrame, goLine,
-/* H I J K L M N O */
- ldhelp, followI,lup1, ldown1, nulcmd, extbrz, nextMk, nulcmd,
-/* P Q R S T U V W */
- prevMk, quitfm, reload, svBuf, nulcmd, goURL, ldfile, nulcmd,
-/* X Y Z [ \ ] ^ _ */
+ /* H I J K L M N O */
+ ldhelp, followI, lup1, ldown1, nulcmd, extbrz, nextMk, nulcmd,
+ /* P Q R S T U V W */
+ prevMk, quitfm, reload, svBuf, nulcmd, goURL, ldfile, nulcmd,
+ /* X Y Z [ \ ] ^ _ */
nulcmd, nulcmd, ctrCsrH, nulcmd, vwSrc, nulcmd, linbeg, nulcmd,
-/* ` a b c d e f g */
- nulcmd, adBmark,pgBack, curURL, svA, nulcmd, nulcmd, goURL,
-/* h i j k l m n o */
- movL, peekIMG,movD, movU, movR, nulcmd, srchnxt,ldOpt,
-/* p q r s t u v w */
- svBuf, qquitfm,nulcmd, selMn, nulcmd, peekURL,ldBmark,wrapToggle,
-/* x y z { | } ~ DEL */
- nulcmd, nulcmd, ctrCsrV,nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
+ /* ` a b c d e f g */
+ nulcmd, adBmark, pgBack, curURL, svA, nulcmd, nulcmd, goURL,
+ /* h i j k l m n o */
+ movL, peekIMG, movD, movU, movR, nulcmd, srchnxt, ldOpt,
+ /* p q r s t u v w */
+ svBuf, qquitfm, nulcmd, selMn, nulcmd, peekURL, ldBmark, wrapToggle,
+ /* x y z { | } ~ DEL */
+ nulcmd, nulcmd, ctrCsrV, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
};
-char EscKeymap[128] =
-{
-/* C-@ C-a C-b C-c C-d C-e C-f C-g */
+char EscKeymap[128] = {
+ /* C-@ C-a C-b C-c C-d C-e C-f C-g */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* C-h C-i C-j C-k C-l C-m C-n C-o */
- nulcmd, prevA, svA, nulcmd, nulcmd, svA, nulcmd, nulcmd,
-/* C-p C-q C-r C-s C-t C-u C-v C-w */
+ /* C-h C-i C-j C-k C-l C-m C-n C-o */
+ nulcmd, prevA, svA, nulcmd, nulcmd, svA, nulcmd, nulcmd,
+ /* C-p C-q C-r C-s C-t C-u C-v C-w */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* C-x C-y C-z C-[ C-\ C-] C-^ C-_ */
+ /* C-x C-y C-z C-[ C-\ C-] C-^ C-_ */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* SPC ! " # $ % & ' */
+ /* SPC ! " # $ % & ' */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* ( ) * + , - . / */
+ /* ( ) * + , - . / */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* 0 1 2 3 4 5 6 7 */
+ /* 0 1 2 3 4 5 6 7 */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* 8 9 : ; < = > ? */
+ /* 8 9 : ; < = > ? */
nulcmd, nulcmd, chkNMID, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* @ A B C D E F G */
+ /* @ A B C D E F G */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* H I J K L M N O */
- nulcmd, svI, nulcmd, nulcmd, nulcmd, linkbrz,nulcmd, escbmap,
-/* P Q R S T U V W */
+ /* H I J K L M N O */
+ nulcmd, svI, nulcmd, nulcmd, nulcmd, linkbrz, nulcmd, escbmap,
+ /* P Q R S T U V W */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* X Y Z [ \ ] ^ _ */
- nulcmd, nulcmd, nulcmd, escbmap,nulcmd, nulcmd, nulcmd, nulcmd,
-/* ` a b c d e f g */
- nulcmd, adBmark,ldBmark,nulcmd, nulcmd, editScr,nulcmd, nulcmd,
-/* h i j k l m n o */
+ /* X Y Z [ \ ] ^ _ */
+ nulcmd, nulcmd, nulcmd, escbmap, nulcmd, nulcmd, nulcmd, nulcmd,
+ /* ` a b c d e f g */
+ nulcmd, adBmark, ldBmark, nulcmd, nulcmd, editScr, nulcmd, nulcmd,
+ /* h i j k l m n o */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* p q r s t u v w */
- nulcmd, nulcmd, nulcmd, svSrc, nulcmd, nulcmd, pgBack, nulcmd,
-/* x y z { | } ~ DEL */
+ /* p q r s t u v w */
+ nulcmd, nulcmd, nulcmd, svSrc, nulcmd, nulcmd, pgBack, nulcmd,
+ /* x y z { | } ~ DEL */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
};
-char EscBKeymap[128] =
-{
-/* C-@ C-a C-b C-c C-d C-e C-f C-g */
+char EscBKeymap[128] = {
+ /* C-@ C-a C-b C-c C-d C-e C-f C-g */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* C-h C-i C-j C-k C-l C-m C-n C-o */
+ /* C-h C-i C-j C-k C-l C-m C-n C-o */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* C-p C-q C-r C-s C-t C-u C-v C-w */
+ /* C-p C-q C-r C-s C-t C-u C-v C-w */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* C-x C-y C-z C-[ C-\ C-] C-^ C-_ */
+ /* C-x C-y C-z C-[ C-\ C-] C-^ C-_ */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* SPC ! " # $ % & ' */
+ /* SPC ! " # $ % & ' */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* ( ) * + , - . / */
+ /* ( ) * + , - . / */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* 0 1 2 3 4 5 6 7 */
+ /* 0 1 2 3 4 5 6 7 */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* 8 9 : ; < = > ? */
+ /* 8 9 : ; < = > ? */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* @ A B C D E F G */
+ /* @ A B C D E F G */
nulcmd, prevA, nextA, followA, backBf, nulcmd, nulcmd, nulcmd,
-/* H I J K L M N O */
+ /* H I J K L M N O */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, mouse, nulcmd, nulcmd,
-/* P Q R S T U V W */
+ /* P Q R S T U V W */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* X Y Z [ \ ] ^ _ */
+ /* X Y Z [ \ ] ^ _ */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* ` a b c d e f g */
+ /* ` a b c d e f g */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* h i j k l m n o */
+ /* h i j k l m n o */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* p q r s t u v w */
+ /* p q r s t u v w */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* x y z { | } ~ DEL */
+ /* x y z { | } ~ DEL */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
};
-char EscDKeymap[128] =
-{
-/* 0 1 INS 3 4 PgUp, PgDn 7 */
- nulcmd, goLineF,mainMn, nulcmd, goLineL,pgBack, pgFore, nulcmd,
-/* 8 9 10 F1 F2 F3 F4 F5 */
+char EscDKeymap[128] = {
+ /* 0 1 INS 3 4 PgUp, PgDn 7 */
+ nulcmd, goLineF, mainMn, nulcmd, goLineL, pgBack, pgFore, nulcmd,
+ /* 8 9 10 F1 F2 F3 F4 F5 */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* 16 F6 F7 F8 F9 F10 22 23 */
+ /* 16 F6 F7 F8 F9 F10 22 23 */
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
-/* 24 25 26 27 HELP 29 30 31 */
+ /* 24 25 26 27 HELP 29 30 31 */
nulcmd, nulcmd, nulcmd, nulcmd, mainMn, nulcmd, nulcmd, nulcmd,
nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd, nulcmd,
diff --git a/linein.c b/linein.c
index 9e8d921..d8b5184 100644
--- a/linein.c
+++ b/linein.c
@@ -1,4 +1,4 @@
-/* $Id: linein.c,v 1.7 2001/11/23 20:50:59 ukai Exp $ */
+/* $Id: linein.c,v 1.8 2001/11/24 02:01:26 ukai Exp $ */
#include "fm.h"
#include "local.h"
#include "myctype.h"
@@ -33,11 +33,11 @@ static int NCFileBuf;
static int NCFileOffset;
static void insertself(char c),
- _mvR(void), _mvL(void), _mvRw(void), _mvLw(void), delC(void), insC(void),
- _mvB(void), _mvE(void), _enter(void), _quo(void), _bs(void), _bsw(void),
- killn(void), killb(void), _inbrk(void), _esc(void),
- _prev(void), _next(void), _compl(void), _tcompl(void),
- _dcompl(void), _rdcompl(void), _rcompl(void);
+_mvR(void), _mvL(void), _mvRw(void), _mvLw(void), delC(void), insC(void),
+_mvB(void), _mvE(void), _enter(void), _quo(void), _bs(void), _bsw(void),
+killn(void), killb(void), _inbrk(void), _esc(void),
+_prev(void), _next(void), _compl(void), _tcompl(void),
+_dcompl(void), _rdcompl(void), _rcompl(void);
#ifdef __EMX__
static int getcntrl(void);
#endif
@@ -49,6 +49,7 @@ static void next_compl(int next);
static void next_dcompl(int next);
static Str doComplete(Str ifn, int *status, int next);
+/* *INDENT-OFF* */
void (*InputKeymap[32]) () = {
/* C-@ C-a C-b C-c C-d C-e C-f C-g */
_compl, _mvB, _mvL, _inbrk, delC, _mvE, _mvR, _inbrk,
@@ -59,8 +60,9 @@ void (*InputKeymap[32]) () = {
/* C-x C-y C-z C-[ C-\ C-] C-^ C-_ */
_tcompl,_mvRw, iself, _esc, iself, iself, iself, iself,
};
+/* *INDENT-ON* */
-static int setStrType(Str str, Lineprop * prop);
+static int setStrType(Str str, Lineprop *prop);
static void addPasswd(char *p, Lineprop *pr, int len, int pos, int limit);
static void addStr(char *p, Lineprop *pr, int len, int pos, int limit);
@@ -79,7 +81,7 @@ static void ins_kanji(Str tmp);
#endif
char *
-inputLineHist(char *prompt, char *def_str, int flag, Hist * hist)
+inputLineHist(char *prompt, char *def_str, int flag, Hist *hist)
{
int opos, x, y, lpos, rpos, epos;
unsigned char c;
@@ -100,19 +102,23 @@ inputLineHist(char *prompt, char *def_str, int flag, Hist * hist)
if (hist != NULL) {
use_hist = TRUE;
strCurrentBuf = NULL;
- } else {
+ }
+ else {
use_hist = FALSE;
}
if (flag & IN_URL) {
cm_mode = CPL_ALWAYS | CPL_URL;
move_word = TRUE;
- } else if (flag & IN_FILENAME) {
+ }
+ else if (flag & IN_FILENAME) {
cm_mode = CPL_ALWAYS;
move_word = TRUE;
- } else if (flag & IN_PASSWORD) {
+ }
+ else if (flag & IN_PASSWORD) {
cm_mode = CPL_NEVER;
is_passwd = TRUE;
- } else if (flag & IN_COMMAND)
+ }
+ else if (flag & IN_COMMAND)
cm_mode = CPL_ON;
else
cm_mode = CPL_OFF;
@@ -127,7 +133,8 @@ inputLineHist(char *prompt, char *def_str, int flag, Hist * hist)
if (def_str) {
strBuf = Strnew_charp(def_str);
CLen = CPos = setStrType(strBuf, strProp);
- } else {
+ }
+ else {
strBuf = Strnew();
CLen = CPos = 0;
}
@@ -146,7 +153,8 @@ inputLineHist(char *prompt, char *def_str, int flag, Hist * hist)
offset = x - rpos;
else if (y - epos > 0)
offset = y - epos;
- } else if (x - lpos < offset) {
+ }
+ else if (x - lpos < offset) {
if (x - lpos > 0)
offset = x - lpos;
else
@@ -162,7 +170,7 @@ inputLineHist(char *prompt, char *def_str, int flag, Hist * hist)
move(LASTLINE, opos + x - offset);
refresh();
- next_char:
+ next_char:
c = getch();
#ifdef __EMX__
if (c == 0) {
@@ -171,7 +179,7 @@ inputLineHist(char *prompt, char *def_str, int flag, Hist * hist)
}
#endif
cm_clear = TRUE;
- cm_disp_clear = TRUE;
+ cm_disp_clear = TRUE;
#ifdef JP_CHARSET
if (mode == PC_KANJI1) {
mode = PC_KANJI2;
@@ -179,36 +187,37 @@ inputLineHist(char *prompt, char *def_str, int flag, Hist * hist)
goto next_char;
Strcat_char(tmp, (c | (DisplayCode == CODE_SJIS ? 0 : 0x80)));
tmp = conv_str(tmp,
- (DisplayCode == CODE_SJIS ? CODE_SJIS : CODE_EUC), InnerCode);
+ (DisplayCode == CODE_SJIS ? CODE_SJIS : CODE_EUC),
+ InnerCode);
ins_kanji(tmp);
}
else
#endif
if (!i_quote &&
- (((cm_mode & CPL_ALWAYS) && (c == CTRL_I || c == ' ')) ||
- ((cm_mode & CPL_ON) && (c == CTRL_I)))) {
+ (((cm_mode & CPL_ALWAYS) && (c == CTRL_I || c == ' ')) ||
+ ((cm_mode & CPL_ON) && (c == CTRL_I)))) {
#ifdef EMACS_LIKE_LINEEDIT
- if (emacs_like_lineedit && cm_next) {
- _dcompl();
- need_redraw = TRUE;
- }
- else {
+ if (emacs_like_lineedit && cm_next) {
+ _dcompl();
+ need_redraw = TRUE;
+ }
+ else {
#endif
- _compl();
- cm_disp_next = -1;
+ _compl();
+ cm_disp_next = -1;
#ifdef EMACS_LIKE_LINEEDIT
- }
+ }
#endif
}
else if (!i_quote && CLen == CPos &&
(cm_mode & CPL_ALWAYS || cm_mode & CPL_ON) && c == CTRL_D) {
#ifdef EMACS_LIKE_LINEEDIT
- if (! emacs_like_lineedit) {
+ if (!emacs_like_lineedit) {
#endif
- _dcompl();
- need_redraw = TRUE;
+ _dcompl();
+ need_redraw = TRUE;
#ifdef EMACS_LIKE_LINEEDIT
- }
+ }
#endif
}
else if (!i_quote && c == DEL_CODE) {
@@ -217,10 +226,10 @@ inputLineHist(char *prompt, char *def_str, int flag, Hist * hist)
cm_disp_next = -1;
}
else if (!i_quote && c < 0x20) { /* Control code */
- (*InputKeymap[(int) c]) (c);
+ (*InputKeymap[(int)c]) (c);
if (cm_clear)
cm_next = FALSE;
- if (cm_disp_clear)
+ if (cm_disp_clear)
cm_disp_next = -1;
}
#ifdef JP_CHARSET
@@ -278,7 +287,7 @@ inputLineHist(char *prompt, char *def_str, int flag, Hist * hist)
}
if (use_hist && !(flag & IN_URL) && *p != '\0') {
char *q = lastHist(hist);
- if (! q || strcmp(q, p))
+ if (!q || strcmp(q, p))
pushHist(hist, p);
}
if (flag & IN_FILENAME)
@@ -295,7 +304,7 @@ getcntrl(void)
case K_DEL:
return CTRL_D;
case K_LEFT:
- return CTRL_B;
+ return CTRL_B;
case K_RIGHT:
return CTRL_F;
case K_UP:
@@ -323,7 +332,7 @@ addPasswd(char *p, Lineprop *pr, int len, int offset, int limit)
int rcol = 0, ncol;
ncol = calcPosition(p, pr, len, len, 0, CP_AUTO);
- if (ncol> offset + limit)
+ if (ncol > offset + limit)
ncol = offset + limit;
if (offset) {
addChar('{', 0);
@@ -364,17 +373,19 @@ addStr(char *p, Lineprop *pr, int len, int offset, int limit)
#endif
ncol = calcPosition(p, pr, len, i + delta, 0, CP_AUTO);
if (ncol - offset > limit)
- break;
+ break;
if (p[i] == '\t') {
for (; rcol < ncol; rcol++)
addChar(' ', 0);
continue;
#ifdef JP_CHARSET
- } else if (delta == 2) {
+ }
+ else if (delta == 2) {
addChar(p[i], pr[i]);
- addChar(p[i+1], pr[i+1]);
+ addChar(p[i + 1], pr[i + 1]);
#endif
- } else
+ }
+ else
addChar(p[i], pr[i]);
rcol = ncol;
}
@@ -427,16 +438,17 @@ _esc(void)
_rdcompl();
cm_clear = FALSE;
need_redraw = TRUE;
- } else
+ }
+ else
#else
- _rcompl();
+ _rcompl();
#endif
break;
case CTRL_D:
#ifdef EMACS_LIKE_LINEEDIT
if (!emacs_like_lineedit)
#else
- _rdcompl();
+ _rdcompl();
#endif
need_redraw = TRUE;
break;
@@ -515,14 +527,12 @@ static void
_mvLw(void)
{
int first = 1;
- while(CPos > 0
- && ( first || !terminated(strBuf->ptr[CPos-1])))
- {
+ while (CPos > 0 && (first || !terminated(strBuf->ptr[CPos - 1]))) {
CPos--;
first = 0;
#ifdef JP_CHARSET
- if (strProp[CPos] == PC_KANJI2)
- CPos--;
+ if (strProp[CPos] == PC_KANJI2)
+ CPos--;
#endif /* JP_CHARSET */
if (!move_word)
break;
@@ -532,18 +542,16 @@ _mvLw(void)
static void
_mvRw(void)
{
- int first = 1;
- while(CPos < CLen
- && ( first || !terminated(strBuf->ptr[CPos-1])))
- {
+ int first = 1;
+ while (CPos < CLen && (first || !terminated(strBuf->ptr[CPos - 1]))) {
CPos++;
first = 0;
#ifdef JP_CHARSET
- if (strProp[CPos] == PC_KANJI2)
- CPos++;
+ if (strProp[CPos] == PC_KANJI2)
+ CPos++;
#endif /* JP_CHARSET */
- if(!move_word)
- break;
+ if (!move_word)
+ break;
}
}
@@ -571,9 +579,9 @@ static void
_bsw(void)
{
int t = 0;
- while(CPos > 0 && !t) {
+ while (CPos > 0 && !t) {
_mvL();
- t = (move_word && terminated(strBuf->ptr[CPos-1]));
+ t = (move_word && terminated(strBuf->ptr[CPos - 1]));
delC();
}
}
@@ -727,10 +735,12 @@ next_dcompl(int next)
if (LASTLINE >= 3) {
comment = TRUE;
nline = LASTLINE - 2;
- } else if (LASTLINE) {
+ }
+ else if (LASTLINE) {
comment = FALSE;
nline = LASTLINE;
- } else {
+ }
+ else {
return;
}
if (cm_disp_next >= 0) {
@@ -772,25 +782,28 @@ next_dcompl(int next)
for (i = 0; i < NCFileBuf; i++) {
n = strlen(CFileBuf[i]) + 3;
if (len < n)
- len = n;
+ len = n;
}
col = COLS / len;
if (col == 0)
col = 1;
row = (NCFileBuf + col - 1) / col;
-disp_next:
+ disp_next:
if (comment) {
if (row > nline) {
row = nline;
y = 0;
- } else
+ }
+ else
y = nline - row + 1;
- } else {
+ }
+ else {
if (row >= nline) {
row = nline;
y = 0;
- } else
+ }
+ else
y = nline - row - 1;
}
if (y) {
@@ -829,7 +842,7 @@ disp_next:
addstr("----- Press TAB to continue -----");
else
#else
- addstr("----- Press CTRL-D to continue -----");
+ addstr("----- Press CTRL-D to continue -----");
#endif
boldend();
}
@@ -848,15 +861,14 @@ doComplete(Str ifn, int *status, int next)
NCFileBuf = 0;
ifn = Str_conv_to_system(ifn);
CompleteBuf = Strdup(ifn);
- while (Strlastchar(CompleteBuf) != '/' &&
- CompleteBuf->length > 0)
+ while (Strlastchar(CompleteBuf) != '/' && CompleteBuf->length > 0)
Strshrink(CompleteBuf, 1);
CDirBuf = Strdup(CompleteBuf);
if (cm_mode & CPL_URL) {
if (strncmp(CompleteBuf->ptr, "file://localhost/", 17) == 0)
Strdelete(CompleteBuf, 0, 16);
else if (strncmp(CompleteBuf->ptr, "file:///", 8) == 0)
- Strdelete(CompleteBuf, 0, 7);
+ Strdelete(CompleteBuf, 0, 7);
else if (strncmp(CompleteBuf->ptr, "file:/", 6) == 0 &&
CompleteBuf->ptr[6] != '/')
Strdelete(CompleteBuf, 0, 5);
@@ -884,18 +896,20 @@ doComplete(Str ifn, int *status, int next)
dir = readdir(d);
if (dir == NULL)
break;
- if (fl == 0 && (!strcmp(dir->d_name, ".") || !strcmp(dir->d_name, "..")))
+ if (fl == 0
+ && (!strcmp(dir->d_name, ".") || !strcmp(dir->d_name, "..")))
continue;
if (!strncmp(dir->d_name, fn, fl)) { /* match */
NCFileBuf++;
CFileBuf = New_Reuse(char *, CFileBuf, NCFileBuf);
- CFileBuf[NCFileBuf - 1] = NewAtom_N(char, strlen(dir->d_name) + 1);
+ CFileBuf[NCFileBuf - 1] =
+ NewAtom_N(char, strlen(dir->d_name) + 1);
strcpy(CFileBuf[NCFileBuf - 1], dir->d_name);
if (NCFileBuf == 1) {
CFileName = Strnew_charp(dir->d_name);
}
else {
- for (i = 0; CFileName->ptr[i] == dir->d_name[i]; i++);
+ for (i = 0; CFileName->ptr[i] == dir->d_name[i]; i++) ;
Strtruncate(CFileName, i);
}
}
@@ -952,13 +966,14 @@ _prev(void)
Hist *hist = CurrentHist;
char *p;
- if (! use_hist)
+ if (!use_hist)
return;
if (strCurrentBuf) {
p = prevHist(hist);
if (p == NULL)
return;
- } else {
+ }
+ else {
p = lastHist(hist);
if (p == NULL)
return;
@@ -975,14 +990,15 @@ _next(void)
Hist *hist = CurrentHist;
char *p;
- if (! use_hist)
+ if (!use_hist)
return;
if (strCurrentBuf == NULL)
return;
p = nextHist(hist);
if (p) {
strBuf = Strnew_charp(p);
- } else {
+ }
+ else {
strBuf = strCurrentBuf;
strCurrentBuf = NULL;
}
@@ -991,7 +1007,7 @@ _next(void)
}
static int
-setStrType(Str str, Lineprop * prop)
+setStrType(Str str, Lineprop *prop)
{
Lineprop ctype;
int i = 0, delta;
@@ -1005,25 +1021,26 @@ setStrType(Str str, Lineprop * prop)
#ifdef JP_CHARSET
if (ctype == PC_KANJI) {
prop[i] = PC_KANJI1;
- prop[i+1] = PC_KANJI2;
+ prop[i + 1] = PC_KANJI2;
}
else
#endif
- prop[i] = ctype;
+ prop[i] = ctype;
}
return i;
}
static int
-terminated(unsigned char c){
- int termchar[] = {'/', '&', '?', -1};
- int *tp;
+terminated(unsigned char c)
+{
+ int termchar[] = { '/', '&', '?', -1 };
+ int *tp;
- for(tp = termchar; *tp > 0; tp++){
- if(c == *tp){
- return 1;
+ for (tp = termchar; *tp > 0; tp++) {
+ if (c == *tp) {
+ return 1;
+ }
}
- }
- return 0;
+ return 0;
}
diff --git a/local.c b/local.c
index 0c2fbf5..7e39b77 100644
--- a/local.c
+++ b/local.c
@@ -1,4 +1,4 @@
-/* $Id: local.c,v 1.8 2001/11/21 18:51:48 ukai Exp $ */
+/* $Id: local.c,v 1.9 2001/11/24 02:01:26 ukai Exp $ */
#include "fm.h"
#include <string.h>
#include <stdio.h>
@@ -10,8 +10,8 @@
#include <unistd.h>
#endif /* HAVE_READLINK */
#ifdef __EMX__
-#include <limits.h> /* _MAX_PATH ? */
-#endif /* __EMX__ */
+#include <limits.h> /* _MAX_PATH ? */
+#endif /* __EMX__ */
#include "local.h"
#define CGIFN_NORMAL 0
@@ -27,9 +27,9 @@ setLocalCookie()
{
Str buf;
char hostname[256];
- gethostname(hostname,256);
+ gethostname(hostname, 256);
- buf = Sprintf("%d.%ld@%s",getpid(),lrand48(),hostname);
+ buf = Sprintf("%d.%ld@%s", getpid(), lrand48(), hostname);
Local_cookie = buf->ptr;
}
@@ -57,7 +57,10 @@ dirBuffer(char *dname)
return NULL;
dirname = Strnew_charp(dname);
qdir = html_quote(Str_conv_from_system(dirname)->ptr);
- tmp = Sprintf("<title>Directory list of %s</title><h1>Directory list of %s</h1>\n", qdir, qdir);
+ tmp =
+ Sprintf
+ ("<title>Directory list of %s</title><h1>Directory list of %s</h1>\n",
+ qdir, qdir);
flist = New_N(char *, nfile_max);
nfile = 0;
while ((dir = readdir(d)) != NULL) {
@@ -82,7 +85,7 @@ dirBuffer(char *dname)
n = 1;
Strcat_charp(tmp, "<TABLE CELLPADDING=0><TR VALIGN=TOP>\n");
}
- qsort((void *) flist, nfile, sizeof(char *), strCmp);
+ qsort((void *)flist, nfile, sizeof(char *), strCmp);
for (i = 0; i < nfile; i++) {
p = flist[i];
if (strcmp(p, ".") == 0)
@@ -91,7 +94,7 @@ dirBuffer(char *dname)
if (Strlastchar(fbuf) != '/')
Strcat_char(fbuf, '/');
Strcat_charp(fbuf, p);
-#ifdef HAVE_READLINK /* readlink == lstat() ? (ukai) */
+#ifdef HAVE_READLINK /* readlink == lstat() ? (ukai) */
if (lstat(fbuf->ptr, &lst) < 0)
continue;
#endif /* READLINK */
@@ -132,7 +135,8 @@ dirBuffer(char *dname)
if (S_ISLNK(lst.st_mode)) {
if ((l = readlink(fbuf->ptr, lbuf, sizeof(lbuf))) > 0) {
lbuf[l] = '\0';
- Strcat_m_charp(tmp, " -> ", html_quote(conv_from_system(lbuf)), NULL);
+ Strcat_m_charp(tmp, " -> ",
+ html_quote(conv_from_system(lbuf)), NULL);
if (S_ISDIR(st.st_mode))
Strcat_char(tmp, '/');
}
@@ -160,46 +164,43 @@ check_local_cgi(char *file, int status)
if (status & CGIFN_CONTAIN_SLASH) {
/* local CGI file must be just under /cgi-bin/
- or /$LIB/
- */
+ * or /$LIB/
+ */
return -1;
}
#ifdef __EMX__
if (CGIFN_MODE(status) != CGIFN_CGIBIN) {
char tmp[_MAX_PATH];
- int len;
+ int len;
- _abspath(tmp, w3m_lib_dir(), _MAX_PATH); /* Translate '\\' to '/'
- *
- */
- len = strlen(tmp);
- while (len > 1 && tmp[len-1] == '/')
- len--;
- if (strnicmp(file, tmp, len) || /* and ignore case */
- (file[len] != '/'))
+ _abspath(tmp, w3m_lib_dir(), _MAX_PATH); /* Translate '\\' to '/'
+ *
+ */
+ len = strlen(tmp);
+ while (len > 1 && tmp[len - 1] == '/')
+ len--;
+ if (strnicmp(file, tmp, len) || /* and ignore case */
+ (file[len] != '/'))
return -1;
}
#else /* not __EMX__ */
if (CGIFN_MODE(status) != CGIFN_CGIBIN) {
- char *tmp = Strnew_charp(w3m_lib_dir())->ptr;
- int len = strlen(tmp);
+ char *tmp = Strnew_charp(w3m_lib_dir())->ptr;
+ int len = strlen(tmp);
- while (len > 1 && tmp[len-1] == '/')
- len--;
- if (strncmp(file, tmp, len) ||
- (file[len] != '/'))
- /*
- * a local-CGI script should be located on either
- * /cgi-bin/ directory or LIB_DIR (typically /usr/local/lib/w3m).
- */
- return -1;
+ while (len > 1 && tmp[len - 1] == '/')
+ len--;
+ if (strncmp(file, tmp, len) || (file[len] != '/'))
+ /*
+ * a local-CGI script should be located on either
+ * /cgi-bin/ directory or LIB_DIR (typically /usr/local/lib/w3m).
+ */
+ return -1;
}
#endif /* not __EMX__ */
if (stat(file, &st) < 0)
return -1;
- if ((st.st_uid == geteuid() && (st.st_mode & S_IXUSR)) ||
- (st.st_gid == getegid() && (st.st_mode & S_IXGRP)) ||
- (st.st_mode & S_IXOTH)) { /* executable */
+ if ((st.st_uid == geteuid() && (st.st_mode & S_IXUSR)) || (st.st_gid == getegid() && (st.st_mode & S_IXGRP)) || (st.st_mode & S_IXOTH)) { /* executable */
return 0;
}
return -1;
@@ -209,8 +210,8 @@ void
set_environ(char *var, char *value)
{
#ifdef HAVE_SETENV
- if ( var != NULL && value != NULL )
- setenv(var, value, 1);
+ if (var != NULL && value != NULL)
+ setenv(var, value, 1);
#else /* not HAVE_SETENV */
#ifdef HAVE_PUTENV
Str tmp = Strnew_m_charp(var, "=", value, NULL);
@@ -241,10 +242,10 @@ set_environ(char *var, char *value)
}
}
}
- newenv = (char **) GC_malloc((i + 2) * sizeof(char *));
+ newenv = (char **)GC_malloc((i + 2) * sizeof(char *));
if (newenv == NULL)
return;
- for (e = environ, ne = newenv; *e != NULL; *(ne++) = *(e++));
+ for (e = environ, ne = newenv; *e != NULL; *(ne++) = *(e++)) ;
*(ne++) = p;
*ne = NULL;
environ = newenv;
@@ -266,7 +267,7 @@ set_cgi_environ(char *name, char *fn, char *req_uri)
set_environ("SCRIPT_NAME", name);
set_environ("SCRIPT_FILENAME", fn);
set_environ("REQUEST_URI", req_uri);
- set_environ("LOCAL_COOKIE",Local_cookie);
+ set_environ("LOCAL_COOKIE", Local_cookie);
}
static Str
@@ -296,7 +297,7 @@ cgi_filename(char *fn, int *status)
struct stat st;
if (cgi_bin != NULL && strncmp(fn, "/cgi-bin/", 9) == 0) {
*status = CGIFN_CGIBIN;
- if (strchr(fn+9,'/'))
+ if (strchr(fn + 9, '/'))
*status |= CGIFN_CONTAIN_SLASH;
tmp = checkPath(fn + 9, cgi_bin);
if (tmp == NULL)
@@ -307,7 +308,7 @@ cgi_filename(char *fn, int *status)
*status = CGIFN_NORMAL;
tmp = Strnew_charp(w3m_lib_dir());
fn += 5;
- if (strchr(fn+1,'/'))
+ if (strchr(fn + 1, '/'))
*status |= CGIFN_CONTAIN_SLASH;
if (Strlastchar(tmp) == '/')
fn++;
@@ -316,7 +317,7 @@ cgi_filename(char *fn, int *status)
}
if (*fn == '/' && document_root != NULL && stat(fn, &st) < 0) {
*status = CGIFN_DROOT;
- if (strchr(fn+1,'/'))
+ if (strchr(fn + 1, '/'))
*status |= CGIFN_CONTAIN_SLASH;
tmp = Strnew_charp(document_root);
if (Strlastchar(tmp) != '/')
@@ -329,55 +330,57 @@ cgi_filename(char *fn, int *status)
}
static pid_t
-localcgi_popen_r(FILE **p_fp)
+localcgi_popen_r(FILE ** p_fp)
{
- int fd[2];
- FILE *fp;
- pid_t pid;
- Str emsg;
-
- if (pipe(fd) < 0) {
- emsg = Sprintf("localcgi_popen_r: pipe: %s", strerror(errno));
- disp_err_message(emsg->ptr, FALSE);
- return (pid_t)-1;
- }
+ int fd[2];
+ FILE *fp;
+ pid_t pid;
+ Str emsg;
- flush_tty();
- if ((pid = fork()) < 0) {
- emsg = Sprintf("localcgi_popen_r: fork: %s", strerror(errno));
- disp_err_message(emsg->ptr, FALSE);
- close(fd[0]);
- close(fd[1]);
- return (pid_t)-1;
- }
- else if (!pid) {
- close_tty();
- dup2(fd[1], 1);
+ if (pipe(fd) < 0) {
+ emsg = Sprintf("localcgi_popen_r: pipe: %s", strerror(errno));
+ disp_err_message(emsg->ptr, FALSE);
+ return (pid_t) - 1;
+ }
- if (fd[1] > 1)
- close(fd[1]);
+ flush_tty();
+ if ((pid = fork()) < 0) {
+ emsg = Sprintf("localcgi_popen_r: fork: %s", strerror(errno));
+ disp_err_message(emsg->ptr, FALSE);
+ close(fd[0]);
+ close(fd[1]);
+ return (pid_t) - 1;
+ }
+ else if (!pid) {
+ close_tty();
+ dup2(fd[1], 1);
- close(fd[0]);
- }
- else {
- close(fd[1]);
+ if (fd[1] > 1)
+ close(fd[1]);
- if (!(fp = fdopen(fd[0], "r"))) {
- emsg = Sprintf("localcgi_popen_r: fdopen(%d, \"r\"): %s", fd[0], strerror(errno));
- disp_err_message(emsg->ptr, FALSE);
- kill(pid, SIGTERM);
- close(fd[0]);
- return (pid_t)-1;
+ close(fd[0]);
}
+ else {
+ close(fd[1]);
+
+ if (!(fp = fdopen(fd[0], "r"))) {
+ emsg =
+ Sprintf("localcgi_popen_r: fdopen(%d, \"r\"): %s", fd[0],
+ strerror(errno));
+ disp_err_message(emsg->ptr, FALSE);
+ kill(pid, SIGTERM);
+ close(fd[0]);
+ return (pid_t) - 1;
+ }
- *p_fp = fp;
- }
+ *p_fp = fp;
+ }
- return pid;
+ return pid;
}
FILE *
-localcgi_post(char *uri, char *qstr, FormList * request, char *referer)
+localcgi_post(char *uri, char *qstr, FormList *request, char *referer)
{
FILE *f, *f1;
Str tmp1;
@@ -391,27 +394,28 @@ localcgi_post(char *uri, char *qstr, FormList * request, char *referer)
tmp1 = tmpfname(TMPF_DFL, NULL);
f1 = fopen(tmp1->ptr, "w");
if (f1 == NULL)
- return NULL;
+ return NULL;
pushText(fileToDelete, tmp1->ptr);
if ((pid = localcgi_popen_r(&f))) {
- fclose(f1);
- return pid > 0 ? f : NULL;
+ fclose(f1);
+ return pid > 0 ? f : NULL;
}
if (qstr == NULL) {
- set_cgi_environ(uri, file, uri);
- } else {
- set_cgi_environ(uri, file,
- Strnew_m_charp(uri, "?", qstr, NULL)->ptr);
+ set_cgi_environ(uri, file, uri);
+ }
+ else {
+ set_cgi_environ(uri, file, Strnew_m_charp(uri, "?", qstr, NULL)->ptr);
}
set_environ("REQUEST_METHOD", "POST");
if (qstr)
- set_environ("QUERY_STRING", qstr);
+ set_environ("QUERY_STRING", qstr);
set_environ("CONTENT_LENGTH", Sprintf("%d", request->length)->ptr);
if (referer && referer != NO_REFERER)
- set_environ("HTTP_REFERER",referer);
+ set_environ("HTTP_REFERER", referer);
if (request->enctype == FORM_ENCTYPE_MULTIPART) {
set_environ("CONTENT_TYPE",
- Sprintf("multipart/form-data; boundary=%s", request->boundary)->ptr);
+ Sprintf("multipart/form-data; boundary=%s",
+ request->boundary)->ptr);
}
else {
set_environ("CONTENT_TYPE", "application/x-www-form-urlencoded");
@@ -430,13 +434,13 @@ localcgi_post(char *uri, char *qstr, FormList * request, char *referer)
fputs(request->body, f1);
}
fclose(f1);
- freopen( tmp1->ptr, "r", stdin);
-#ifdef HAVE_CHDIR /* ifndef __EMX__ ? */
+ freopen(tmp1->ptr, "r", stdin);
+#ifdef HAVE_CHDIR /* ifndef __EMX__ ? */
chdir(mydirname(file));
#endif
execl(file, mybasename(file), NULL);
fprintf(stderr, "execl(\"%s\", \"%s\", NULL): %s\n",
- file, mybasename(file), strerror(errno));
+ file, mybasename(file), strerror(errno));
exit(1);
return NULL;
}
@@ -448,31 +452,32 @@ localcgi_get(char *uri, char *request, char *referer)
int status;
pid_t pid;
char *file;
-
+
file = cgi_filename(uri, &status);
if (check_local_cgi(file, status) < 0)
return NULL;
if ((pid = localcgi_popen_r(&f)) < 0)
- return NULL;
+ return NULL;
else if (pid)
- return f;
+ return f;
if (!strcmp(request, "")) {
- set_cgi_environ(Strnew_charp(uri)->ptr, file, Strnew_charp(uri)->ptr);
- } else {
- set_cgi_environ(Strnew_charp(uri)->ptr, file,
- Strnew_m_charp(uri, "?", request, NULL)->ptr);
+ set_cgi_environ(Strnew_charp(uri)->ptr, file, Strnew_charp(uri)->ptr);
+ }
+ else {
+ set_cgi_environ(Strnew_charp(uri)->ptr, file,
+ Strnew_m_charp(uri, "?", request, NULL)->ptr);
}
if (referer && referer != NO_REFERER)
- set_environ("HTTP_REFERER",referer);
+ set_environ("HTTP_REFERER", referer);
set_environ("REQUEST_METHOD", "GET");
set_environ("QUERY_STRING", request);
freopen(DEV_NULL_PATH, "r", stdin);
-#ifdef HAVE_CHDIR /* ifndef __EMX__? */
+#ifdef HAVE_CHDIR /* ifndef __EMX__? */
chdir(mydirname(file));
#endif
execl(file, mybasename(file), NULL);
fprintf(stderr, "execl(\"%s\", \"%s\", NULL): %s\n",
- file, mybasename(file), strerror(errno));
+ file, mybasename(file), strerror(errno));
exit(1);
return NULL;
}
diff --git a/mailcap.c b/mailcap.c
index 2379e0d..ebad89d 100644
--- a/mailcap.c
+++ b/mailcap.c
@@ -1,4 +1,4 @@
-/* $Id: mailcap.c,v 1.5 2001/11/20 04:11:16 ukai Exp $ */
+/* $Id: mailcap.c,v 1.6 2001/11/24 02:01:26 ukai Exp $ */
#include "fm.h"
#include "myctype.h"
#include <stdio.h>
@@ -6,8 +6,7 @@
#include "parsetag.h"
#include "local.h"
-static struct mailcap DefaultMailcap[] =
-{
+static struct mailcap DefaultMailcap[] = {
{"image/*", "xv %s", 0, NULL, NULL, NULL}, /* */
{"audio/basic", "showaudio %s", 0, NULL, NULL, NULL},
{NULL, NULL, 0, NULL, NULL, NULL}
@@ -74,7 +73,8 @@ searchMailcap(struct mailcap *table, char *type)
i = mailcapMatch(table, type);
if (i > level) {
if (table->test) {
- Str command = unquote_mailcap(table->test, type, NULL, NULL, NULL);
+ Str command =
+ unquote_mailcap(table->test, type, NULL, NULL, NULL);
if (system(command->ptr) != 0)
continue;
}
@@ -86,7 +86,7 @@ searchMailcap(struct mailcap *table, char *type)
}
static int
-matchMailcapAttr(char *p, char *attr, int len, Str * value)
+matchMailcapAttr(char *p, char *attr, int len, Str *value)
{
int quoted;
char *q = NULL;
@@ -140,7 +140,7 @@ extractMailcapEntry(char *mcap_entry, struct mailcap *mcap)
if (!IS_SPACE(p[j]))
k = j;
}
- mcap->type = allocStr(p, (k >= 0)? k + 1 : j);
+ mcap->type = allocStr(p, (k >= 0) ? k + 1 : j);
if (!p[j])
return 0;
p += j + 1;
@@ -156,7 +156,7 @@ extractMailcapEntry(char *mcap_entry, struct mailcap *mcap)
else if (p[j] == '\\')
quoted = 1;
}
- mcap->viewer = allocStr(p, (k >= 0)? k + 1 : j);
+ mcap->viewer = allocStr(p, (k >= 0) ? k + 1 : j);
p += j;
while (*p == ';') {
@@ -168,8 +168,8 @@ extractMailcapEntry(char *mcap_entry, struct mailcap *mcap)
else if (matchMailcapAttr(p, "copiousoutput", 13, NULL)) {
mcap->flags |= MAILCAP_COPIOUSOUTPUT;
}
- else if (matchMailcapAttr(p, "x-htmloutput", 12, NULL) ||
- matchMailcapAttr(p, "htmloutput", 10, NULL)) {
+ else if (matchMailcapAttr(p, "x-htmloutput", 12, NULL) ||
+ matchMailcapAttr(p, "htmloutput", 10, NULL)) {
mcap->flags |= MAILCAP_HTMLOUTPUT;
}
else if (matchMailcapAttr(p, "test", 4, &tmp)) {
@@ -241,13 +241,13 @@ searchExtViewer(char *type)
if (mailcap_list == NULL)
goto no_user_mailcap;
-
+
for (i = 0; i < mailcap_list->nitem; i++) {
if ((p = searchMailcap(UserMailcap[i], type)) != NULL)
return p;
}
- no_user_mailcap:
+ no_user_mailcap:
return searchMailcap(DefaultMailcap, type);
}
@@ -262,45 +262,46 @@ searchExtViewer(char *type)
Str
quote_mailcap(char *s, int flag)
{
- Str d;
-
- d = Strnew();
-
- for (;; ++s)
- switch (*s) {
- case '\0':
- goto end;
- case '$':
- case '`':
- case '"':
- case '\\':
- if (!(flag & MCF_SQUOTED))
- Strcat_char(d, '\\');
-
- Strcat_char(d, *s);
- break;
- case '\'':
- if (flag & MCF_SQUOTED) {
- Strcat_charp(d, "'\\''");
- break;
- }
- default:
- if (!flag && !IS_ALNUM(*s))
- Strcat_char(d, '\\');
- case '_':
- case '.':
- case ':':
- case '/':
- Strcat_char(d, *s);
- break;
- }
-end:
- return d;
+ Str d;
+
+ d = Strnew();
+
+ for (;; ++s)
+ switch (*s) {
+ case '\0':
+ goto end;
+ case '$':
+ case '`':
+ case '"':
+ case '\\':
+ if (!(flag & MCF_SQUOTED))
+ Strcat_char(d, '\\');
+
+ Strcat_char(d, *s);
+ break;
+ case '\'':
+ if (flag & MCF_SQUOTED) {
+ Strcat_charp(d, "'\\''");
+ break;
+ }
+ default:
+ if (!flag && !IS_ALNUM(*s))
+ Strcat_char(d, '\\');
+ case '_':
+ case '.':
+ case ':':
+ case '/':
+ Strcat_char(d, *s);
+ break;
+ }
+ end:
+ return d;
}
static Str
-unquote_mailcap_loop(char *qstr, char *type, char *name, char *attr, int *stat, int flag0)
+unquote_mailcap_loop(char *qstr, char *type, char *name, char *attr, int *stat,
+ int flag0)
{
Str str, tmp, test, then;
char *p;
@@ -308,7 +309,7 @@ unquote_mailcap_loop(char *qstr, char *type, char *name, char *attr, int *stat,
if (stat)
*stat = 0;
-
+
if (qstr == NULL)
return NULL;
@@ -317,15 +318,15 @@ unquote_mailcap_loop(char *qstr, char *type, char *name, char *attr, int *stat,
for (flag = flag0, p = qstr; *p; p++) {
if (status == MC_QUOTED) {
- if (prev_status == MC_PREC2)
- Strcat_char(tmp, *p);
- else
- Strcat_char(str, *p);
- status = prev_status;
+ if (prev_status == MC_PREC2)
+ Strcat_char(tmp, *p);
+ else
+ Strcat_char(str, *p);
+ status = prev_status;
continue;
}
else if (*p == '\\') {
- prev_status = status;
+ prev_status = status;
status = MC_QUOTED;
continue;
}
@@ -334,35 +335,35 @@ unquote_mailcap_loop(char *qstr, char *type, char *name, char *attr, int *stat,
if (*p == '%') {
status = MC_PREC;
}
- else {
- if (*p == '\'') {
- if (!flag0 && flag & MCF_SQUOTED)
- flag &= ~MCF_SQUOTED;
- else if (!flag)
- flag |= MCF_SQUOTED;
- }
- else if (*p == '"') {
- if (!flag0 && flag & MCF_DQUOTED)
- flag &= ~MCF_DQUOTED;
- else if (!flag)
- flag |= MCF_DQUOTED;
- }
- Strcat_char(str, *p);
- }
+ else {
+ if (*p == '\'') {
+ if (!flag0 && flag & MCF_SQUOTED)
+ flag &= ~MCF_SQUOTED;
+ else if (!flag)
+ flag |= MCF_SQUOTED;
+ }
+ else if (*p == '"') {
+ if (!flag0 && flag & MCF_DQUOTED)
+ flag &= ~MCF_DQUOTED;
+ else if (!flag)
+ flag |= MCF_DQUOTED;
+ }
+ Strcat_char(str, *p);
+ }
break;
case MC_PREC:
if (IS_ALPHA(*p)) {
switch (*p) {
case 's':
if (name) {
- Strcat_charp(str, quote_mailcap(name, flag)->ptr);
+ Strcat_charp(str, quote_mailcap(name, flag)->ptr);
if (stat)
*stat |= MCSTAT_REPNAME;
}
break;
case 't':
if (type) {
- Strcat_charp(str, quote_mailcap(type, flag)->ptr);
+ Strcat_charp(str, quote_mailcap(type, flag)->ptr);
if (stat)
*stat |= MCSTAT_REPTYPE;
}
@@ -372,7 +373,7 @@ unquote_mailcap_loop(char *qstr, char *type, char *name, char *attr, int *stat,
}
else if (*p == '{') {
status = MC_PREC2;
- test = then = NULL;
+ test = then = NULL;
tmp = Strnew();
}
else if (*p == '%') {
@@ -380,35 +381,35 @@ unquote_mailcap_loop(char *qstr, char *type, char *name, char *attr, int *stat,
}
break;
case MC_PREC2:
- if (sp > 0 || *p == '{') {
+ if (sp > 0 || *p == '{') {
Strcat_char(tmp, *p);
- switch (*p) {
- case '{':
- ++sp;
- break;
- case '}':
- --sp;
- break;
- default:
- break;
- }
+ switch (*p) {
+ case '{':
+ ++sp;
+ break;
+ case '}':
+ --sp;
+ break;
+ default:
+ break;
+ }
+ }
+ else if (*p == '}') {
+ char *q;
+ if (attr && (q = strcasestr(attr, tmp->ptr)) != NULL &&
+ (q == attr || IS_SPACE(*(q - 1)) || *(q - 1) == ';') &&
+ matchattr(q, tmp->ptr, tmp->length, &tmp)) {
+ Strcat_charp(str, quote_mailcap(tmp->ptr, flag)->ptr);
+ if (stat)
+ *stat |= MCSTAT_REPPARAM;
+ }
+ status = MC_NORMAL;
}
- else if (*p == '}') {
- char *q;
- if (attr && (q = strcasestr(attr, tmp->ptr)) != NULL &&
- (q == attr || IS_SPACE(*(q-1)) || *(q-1) == ';') &&
- matchattr(q, tmp->ptr, tmp->length, &tmp)) {
- Strcat_charp(str, quote_mailcap(tmp->ptr, flag)->ptr);
- if (stat)
- *stat |= MCSTAT_REPPARAM;
- }
- status = MC_NORMAL;
- }
- else {
- Strcat_char(tmp, *p);
- }
- break;
+ else {
+ Strcat_char(tmp, *p);
+ }
+ break;
}
}
return str;
@@ -417,5 +418,5 @@ unquote_mailcap_loop(char *qstr, char *type, char *name, char *attr, int *stat,
Str
unquote_mailcap(char *qstr, char *type, char *name, char *attr, int *stat)
{
- return unquote_mailcap_loop(qstr, type, name, attr, stat, 0);
+ return unquote_mailcap_loop(qstr, type, name, attr, stat, 0);
}
diff --git a/main.c b/main.c
index b7386ef..fa26c59 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.22 2001/11/23 22:07:45 ukai Exp $ */
+/* $Id: main.c,v 1.23 2001/11/24 02:01:26 ukai Exp $ */
#define MAINPROGRAM
#include "fm.h"
#include <signal.h>
@@ -55,11 +55,11 @@ int (*searchRoutine) (Buffer *, char *);
JMP_BUF IntReturn;
static void cmd_loadfile(char *path);
-static void cmd_loadURL(char *url, ParsedURL * current);
-static void cmd_loadBuffer(Buffer * buf, int prop, int link);
+static void cmd_loadURL(char *url, ParsedURL *current);
+static void cmd_loadBuffer(Buffer *buf, int prop, int link);
static void keyPressEventProc(int c);
#ifdef USE_MARK
-static void cmd_mark(Lineprop * p);
+static void cmd_mark(Lineprop *p);
#endif /* USE_MARK */
int show_params_p = 0;
void show_params(FILE * fp);
@@ -72,10 +72,10 @@ int prec_num = 0;
int prev_key = -1;
int on_target = 1;
-void set_buffer_environ(Buffer*);
+void set_buffer_environ(Buffer *);
static void _followForm(int);
-static void _goLine(char*);
+static void _goLine(char *);
#define PREC_NUM (prec_num ? prec_num : 1)
#define PREC_LIMIT 10000
static int searchKeyNum(void);
@@ -86,7 +86,7 @@ static int searchKeyNum(void);
#define usage() fusage(stderr, 1)
static void
-fusage(FILE *f, int err)
+fusage(FILE * f, int err)
{
fprintf(f, "version %s\n", version);
fprintf(f, "usage: w3m [options] [URL or filename]\noptions:\n");
@@ -94,7 +94,7 @@ fusage(FILE *f, int err)
fprintf(f, " -r ignore backspace effect\n");
fprintf(f, " -l line # of preserved line (default 10000)\n");
#ifdef JP_CHARSET
-#ifndef DEBIAN /* disabled by ukai: -s is used for squeeze multi lines */
+#ifndef DEBIAN /* disabled by ukai: -s is used for squeeze multi lines */
fprintf(f, " -e EUC-JP\n");
fprintf(f, " -s Shift_JIS\n");
fprintf(f, " -j JIS\n");
@@ -111,13 +111,17 @@ fusage(FILE *f, int err)
fprintf(f, " -M monochrome display\n");
#endif /* USE_COLOR */
fprintf(f, " -F automatically render frame\n");
- fprintf(f, " -cols width specify column width (used with -dump)\n");
- fprintf(f, " -ppc count specify the number of pixels per character (4.0...32.0)\n");
+ fprintf(f,
+ " -cols width specify column width (used with -dump)\n");
+ fprintf(f,
+ " -ppc count specify the number of pixels per character (4.0...32.0)\n");
fprintf(f, " -dump dump formatted page into stdout\n");
- fprintf(f, " -dump_head dump response of HEAD request into stdout\n");
+ fprintf(f,
+ " -dump_head dump response of HEAD request into stdout\n");
fprintf(f, " -dump_source dump page source into stdout\n");
fprintf(f, " -dump_both dump HEAD and source into stdout\n");
- fprintf(f, " -dump_extra dump HEAD, source, and extra information into stdout\n");
+ fprintf(f,
+ " -dump_extra dump HEAD, source, and extra information into stdout\n");
fprintf(f, " -post file use POST method with file content\n");
fprintf(f, " -header string insert string as a header\n");
fprintf(f, " +<num> goto <num> line\n");
@@ -127,13 +131,14 @@ fusage(FILE *f, int err)
fprintf(f, " -no-mouse don't use mouse\n");
#endif /* USE_MOUSE */
#ifdef USE_COOKIE
- fprintf(f, " -cookie use cookie (-no-cookie: don't use cookie)\n");
+ fprintf(f,
+ " -cookie use cookie (-no-cookie: don't use cookie)\n");
#endif /* USE_COOKIE */
fprintf(f, " -pauth user:pass proxy authentication\n");
#ifndef KANJI_SYMBOLS
fprintf(f, " -no-graph don't use graphic character\n");
#endif /* not KANJI_SYMBOLS */
-#ifdef DEBIAN /* replaced by ukai: pager requires -s */
+#ifdef DEBIAN /* replaced by ukai: pager requires -s */
fprintf(f, " -s squeeze multiple blank lines\n");
#else
fprintf(f, " -S squeeze multiple blank lines\n");
@@ -157,45 +162,50 @@ static GC_warn_proc orig_GC_warn_proc = NULL;
static void
wrap_GC_warn_proc(char *msg, GC_word arg)
{
- if (fmInitialized) {
- static struct {
- char *msg;
- GC_word arg;
- } msg_ring[GC_WARN_KEEP_MAX] = {
- {NULL, 0}, {NULL, 0}, {NULL, 0}, {NULL, 0}, {NULL, 0},
- {NULL, 0}, {NULL, 0}, {NULL, 0}, {NULL, 0}, {NULL, 0},
- {NULL, 0}, {NULL, 0}, {NULL, 0}, {NULL, 0}, {NULL, 0},
- {NULL, 0}, {NULL, 0}, {NULL, 0}, {NULL, 0}, {NULL, 0},
- };
- static int i = 0;
- static int n = 0;
- static int lock = 0;
- int j;
-
- j = (i + n) % (sizeof(msg_ring) / sizeof(msg_ring[0]));
- msg_ring[j].msg = msg;
- msg_ring[j].arg = arg;
-
- if (n < sizeof(msg_ring) / sizeof(msg_ring[0]))
- ++n;
- else
- ++i;
+ if (fmInitialized) {
+ /* *INDENT-OFF* */
+ static struct {
+ char *msg;
+ GC_word arg;
+ } msg_ring[GC_WARN_KEEP_MAX] = {
+ {NULL, 0}, {NULL, 0}, {NULL, 0}, {NULL, 0}, {NULL, 0},
+ {NULL, 0}, {NULL, 0}, {NULL, 0}, {NULL, 0}, {NULL, 0},
+ {NULL, 0}, {NULL, 0}, {NULL, 0}, {NULL, 0}, {NULL, 0},
+ {NULL, 0}, {NULL, 0}, {NULL, 0}, {NULL, 0}, {NULL, 0},
+ };
+ /* *INDENT-ON* */
+ static int i = 0;
+ static int n = 0;
+ static int lock = 0;
+ int j;
+
+ j = (i + n) % (sizeof(msg_ring) / sizeof(msg_ring[0]));
+ msg_ring[j].msg = msg;
+ msg_ring[j].arg = arg;
+
+ if (n < sizeof(msg_ring) / sizeof(msg_ring[0]))
+ ++n;
+ else
+ ++i;
- if (!lock) {
- lock = 1;
+ if (!lock) {
+ lock = 1;
- for (; n > 0 ; --n, ++i) {
- i %= sizeof(msg_ring) / sizeof(msg_ring[0]);
- disp_message_nsec(Sprintf(msg_ring[i].msg, (unsigned long)msg_ring[i].arg)->ptr, FALSE, 1, TRUE, FALSE);
- }
+ for (; n > 0; --n, ++i) {
+ i %= sizeof(msg_ring) / sizeof(msg_ring[0]);
+ disp_message_nsec(Sprintf
+ (msg_ring[i].msg,
+ (unsigned long)msg_ring[i].arg)->ptr, FALSE,
+ 1, TRUE, FALSE);
+ }
- lock = 0;
+ lock = 0;
+ }
}
- }
- else if (orig_GC_warn_proc)
- orig_GC_warn_proc(msg, arg);
- else
- fprintf(stderr, msg, (unsigned long)arg);
+ else if (orig_GC_warn_proc)
+ orig_GC_warn_proc(msg, arg);
+ else
+ fprintf(stderr, msg, (unsigned long)arg);
}
static void
@@ -206,13 +216,13 @@ sig_chld(int signo)
pid_t pid;
while ((pid = waitpid(-1, &stat, WNOHANG)) > 0) {
- ;
+ ;
}
#elif HAVE_WAIT3
int pid;
while ((pid = wait3(&stat, WNOHANG, NULL)) > 0) {
- ;
+ ;
}
#else
wait(&stat);
@@ -222,31 +232,31 @@ sig_chld(int signo)
}
Str
-make_optional_header_string (char *s)
+make_optional_header_string(char *s)
{
char *p;
Str hs;
- for (p = s; *p && *p != ':'; p++);
+ for (p = s; *p && *p != ':'; p++) ;
if (*p != ':' || p == s)
- return NULL;
+ return NULL;
if (strchr(s, '\n')) {
- return NULL;
+ return NULL;
}
hs = Strnew_size(p - s);
strncpy(hs->ptr, s, p - s);
hs->length = p - s;
if (!Strcasecmp_charp(hs, "content-type")) {
- override_content_type = TRUE;
+ override_content_type = TRUE;
}
Strcat_charp(hs, ": ");
- if (*(p + 1)) { /* not null header */
- for (p = p + 1; isspace(*p); p++); /* skip white spaces */
- Strcat_charp(hs, p);
+ if (*(p + 1)) { /* not null header */
+ for (p = p + 1; isspace(*p); p++) ; /* skip white spaces */
+ Strcat_charp(hs, p);
}
Strcat_charp(hs, "\r\n");
return hs;
-}
+}
int
MAIN(int argc, char **argv, char **envp)
@@ -307,7 +317,7 @@ MAIN(int argc, char **argv, char **envp)
#ifdef USE_COOKIE
initCookie();
#endif /* USE_COOKIE */
- setLocalCookie(); /* setup cookie for local CGI */
+ setLocalCookie(); /* setup cookie for local CGI */
LoadHist = newHist();
SaveHist = newHist();
@@ -320,31 +330,27 @@ MAIN(int argc, char **argv, char **envp)
if (!non_null(HTTP_proxy) &&
((p = getenv("HTTP_PROXY")) ||
- (p = getenv("http_proxy")) ||
- (p = getenv("HTTP_proxy")))) {
+ (p = getenv("http_proxy")) || (p = getenv("HTTP_proxy")))) {
HTTP_proxy = p;
parseURL(p, &HTTP_proxy_parsed, NULL);
}
#ifdef USE_GOPHER
if (!non_null(GOPHER_proxy) &&
((p = getenv("GOPHER_PROXY")) ||
- (p = getenv("gopher_proxy")) ||
- (p = getenv("GOPHER_proxy")))) {
+ (p = getenv("gopher_proxy")) || (p = getenv("GOPHER_proxy")))) {
GOPHER_proxy = p;
parseURL(p, &GOPHER_proxy_parsed, NULL);
}
#endif /* USE_GOPHER */
if (!non_null(FTP_proxy) &&
((p = getenv("FTP_PROXY")) ||
- (p = getenv("ftp_proxy")) ||
- (p = getenv("FTP_proxy")))) {
+ (p = getenv("ftp_proxy")) || (p = getenv("FTP_proxy")))) {
FTP_proxy = p;
parseURL(p, &FTP_proxy_parsed, NULL);
}
if (!non_null(NO_proxy) &&
((p = getenv("NO_PROXY")) ||
- (p = getenv("no_proxy")) ||
- (p = getenv("NO_proxy")))) {
+ (p = getenv("no_proxy")) || (p = getenv("NO_proxy")))) {
NO_proxy = p;
set_no_proxy(p);
}
@@ -361,7 +367,7 @@ MAIN(int argc, char **argv, char **envp)
if (!strcmp("-t", argv[i])) {
if (++i >= argc)
usage();
- if (atoi(argv[i]) > 0)
+ if (atoi(argv[i]) > 0)
Tabstop = atoi(argv[i]);
}
else if (!strcmp("-r", argv[i]))
@@ -369,11 +375,11 @@ MAIN(int argc, char **argv, char **envp)
else if (!strcmp("-l", argv[i])) {
if (++i >= argc)
usage();
- if (atoi(argv[i]) > 0)
- PagerMax = atoi(argv[i]);
+ if (atoi(argv[i]) > 0)
+ PagerMax = atoi(argv[i]);
}
#ifdef JP_CHARSET
-#ifndef DEBIAN /* XXX: use -o kanjicode={S|J|E} */
+#ifndef DEBIAN /* XXX: use -o kanjicode={S|J|E} */
else if (!strcmp("-s", argv[i]))
DisplayCode = CODE_SJIS;
else if (!strcmp("-j", argv[i]))
@@ -419,7 +425,7 @@ MAIN(int argc, char **argv, char **envp)
else if (!strcmp("-T", argv[i])) {
if (++i >= argc)
usage();
- DefaultType = default_type = argv[i];
+ DefaultType = default_type = argv[i];
}
else if (!strcmp("-m", argv[i]))
SearchHeader = search_header = TRUE;
@@ -435,13 +441,13 @@ MAIN(int argc, char **argv, char **envp)
if (++i >= argc)
usage();
BookmarkFile = argv[i];
- if (BookmarkFile[0] != '~' && BookmarkFile[0] != '/') {
- Str tmp = Strnew_charp(CurrentDir);
- if (Strlastchar(tmp) != '/')
- Strcat_char(tmp, '/');
- Strcat_charp(tmp, BookmarkFile);
- BookmarkFile = cleanupName(tmp->ptr);
- }
+ if (BookmarkFile[0] != '~' && BookmarkFile[0] != '/') {
+ Str tmp = Strnew_charp(CurrentDir);
+ if (Strlastchar(tmp) != '/')
+ Strcat_char(tmp, '/');
+ Strcat_charp(tmp, BookmarkFile);
+ BookmarkFile = cleanupName(tmp->ptr);
+ }
}
else if (!strcmp("-F", argv[i]))
RenderFrame = TRUE;
@@ -453,17 +459,17 @@ MAIN(int argc, char **argv, char **envp)
WrapSearch = TRUE;
}
}
- else if (!strcmp("-dump", argv[i]))
+ else if (!strcmp("-dump", argv[i]))
w3m_dump = DUMP_BUFFER;
- else if (!strcmp("-dump_source", argv[i]))
+ else if (!strcmp("-dump_source", argv[i]))
w3m_dump = DUMP_SOURCE;
- else if (!strcmp("-dump_head", argv[i]))
+ else if (!strcmp("-dump_head", argv[i]))
w3m_dump = DUMP_HEAD;
- else if (!strcmp("-dump_both", argv[i]))
- w3m_dump = (DUMP_HEAD|DUMP_SOURCE);
- else if (!strcmp("-dump_extra", argv[i]))
- w3m_dump = (DUMP_HEAD|DUMP_SOURCE|DUMP_EXTRA);
- else if (!strcmp("-halfdump", argv[i]))
+ else if (!strcmp("-dump_both", argv[i]))
+ w3m_dump = (DUMP_HEAD | DUMP_SOURCE);
+ else if (!strcmp("-dump_extra", argv[i]))
+ w3m_dump = (DUMP_HEAD | DUMP_SOURCE | DUMP_EXTRA);
+ else if (!strcmp("-halfdump", argv[i]))
w3m_dump = DUMP_HALFDUMP;
else if (!strcmp("-halfload", argv[i])) {
w3m_dump = 0;
@@ -499,22 +505,22 @@ MAIN(int argc, char **argv, char **envp)
showLineNum = TRUE;
else if (!strcmp("-no-proxy", argv[i]))
Do_not_use_proxy = TRUE;
- else if (!strcmp("-post", argv[i])) {
- if (++i >= argc)
- usage();
- post_file = argv[i];
- }
- else if (!strcmp("-header", argv[i])) {
- Str hs;
- if (++i >= argc)
- usage();
- if ((hs = make_optional_header_string(argv[i])) != NULL) {
- if (header_string == NULL)
- header_string = hs;
- else
- Strcat (header_string, hs);
- }
- }
+ else if (!strcmp("-post", argv[i])) {
+ if (++i >= argc)
+ usage();
+ post_file = argv[i];
+ }
+ else if (!strcmp("-header", argv[i])) {
+ Str hs;
+ if (++i >= argc)
+ usage();
+ if ((hs = make_optional_header_string(argv[i])) != NULL) {
+ if (header_string == NULL)
+ header_string = hs;
+ else
+ Strcat(header_string, hs);
+ }
+ }
#ifdef USE_MOUSE
else if (!strcmp("-no-mouse", argv[i])) {
use_mouse = FALSE;
@@ -579,7 +585,7 @@ MAIN(int argc, char **argv, char **envp)
}
if (option_assigned)
- sync_with_option();
+ sync_with_option();
#ifdef __WATT32__
if (w3m_debug)
@@ -597,7 +603,7 @@ MAIN(int argc, char **argv, char **envp)
/* redirected output */
w3m_dump = DUMP_BUFFER;
}
- if (w3m_dump) {
+ if (w3m_dump) {
if (COLS == 0)
COLS = 80;
}
@@ -607,11 +613,11 @@ MAIN(int argc, char **argv, char **envp)
if (w3m_backend)
backend();
if (!w3m_dump) {
- initKeymap();
+ initKeymap();
#ifdef USE_MENU
- initMenu();
- CurrentMenuData = NULL;
-#endif /* MENU */
+ initMenu();
+ CurrentMenuData = NULL;
+#endif /* MENU */
fmInit();
}
orig_GC_warn_proc = GC_set_warn_proc(wrap_GC_warn_proc);
@@ -619,9 +625,9 @@ MAIN(int argc, char **argv, char **envp)
if (load_argc == 0) {
if (w3m_halfdump)
printf("<pre>\n");
- /* no URL specified */
+ /* no URL specified */
if (!isatty(0)) {
- redin = newFileStream(fdopen(dup(0), "rb"), (void (*)()) pclose);
+ redin = newFileStream(fdopen(dup(0), "rb"), (void (*)())pclose);
newbuf = openGeneralPagerBuffer(redin);
dup2(1, 0);
}
@@ -632,7 +638,9 @@ MAIN(int argc, char **argv, char **envp)
}
else if (visual_start) {
Str s_page;
- s_page = Strnew_charp("<title>W3M startup page</title><center><b>Welcome to ");
+ s_page =
+ Strnew_charp
+ ("<title>W3M startup page</title><center><b>Welcome to ");
Strcat_charp(s_page, "<a href='http://w3m.sourceforge.net/'>");
Strcat_m_charp(s_page,
"w3m</a>!<p><p>This is w3m version ",
@@ -676,42 +684,50 @@ MAIN(int argc, char **argv, char **envp)
}
for (; i < load_argc; i++) {
if (i >= 0) {
- SearchHeader = search_header;
- DefaultType = default_type;
- if (w3m_halfdump)
+ SearchHeader = search_header;
+ DefaultType = default_type;
+ if (w3m_halfdump)
printf("<pre>\n");
- if (w3m_dump == DUMP_HEAD) {
+ if (w3m_dump == DUMP_HEAD) {
request = New(FormList);
request->method = FORM_METHOD_HEAD;
- newbuf = loadGeneralFile(load_argv[i], NULL, NO_REFERER, 0, request);
+ newbuf =
+ loadGeneralFile(load_argv[i], NULL, NO_REFERER, 0,
+ request);
}
else {
- if (post_file && i == 0) {
- FILE *fp;
- Str body;
- if (!strcmp (post_file, "-"))
- fp = stdin;
- else
- fp = fopen (post_file, "r");
- if (fp == NULL) {
+ if (post_file && i == 0) {
+ FILE *fp;
+ Str body;
+ if (!strcmp(post_file, "-"))
+ fp = stdin;
+ else
+ fp = fopen(post_file, "r");
+ if (fp == NULL) {
Strcat(err_msg,
- Sprintf("w3m: Can't open %s.\n", post_file));
- continue;
- }
- body = Strfgetall (fp);
- if (fp != stdin) fclose (fp);
- request = newFormList (NULL, "post", NULL, NULL, NULL, NULL, NULL);
- request->body = body->ptr;
- request->boundary = NULL;
- request->length = body->length;
- }
- else {
- request = NULL;
- }
- newbuf = loadGeneralFile(load_argv[i], NULL, NO_REFERER, 0, request);
+ Sprintf("w3m: Can't open %s.\n", post_file));
+ continue;
+ }
+ body = Strfgetall(fp);
+ if (fp != stdin)
+ fclose(fp);
+ request =
+ newFormList(NULL, "post", NULL, NULL, NULL, NULL,
+ NULL);
+ request->body = body->ptr;
+ request->boundary = NULL;
+ request->length = body->length;
+ }
+ else {
+ request = NULL;
+ }
+ newbuf =
+ loadGeneralFile(load_argv[i], NULL, NO_REFERER, 0,
+ request);
}
if (newbuf == NULL) {
- Strcat(err_msg, Sprintf("w3m: Can't load %s.\n", load_argv[i]));
+ Strcat(err_msg,
+ Sprintf("w3m: Can't load %s.\n", load_argv[i]));
continue;
}
else if (newbuf == NO_BUFFER)
@@ -731,9 +747,9 @@ MAIN(int argc, char **argv, char **envp)
pushHashHist(URLHist, parsedURL2Str(&newbuf->currentURL)->ptr);
break;
}
- } else
- if (newbuf == NO_BUFFER)
- continue;
+ }
+ else if (newbuf == NO_BUFFER)
+ continue;
newbuf->search_header = search_header;
if (Currentbuf == NULL)
Firstbuf = Currentbuf = newbuf;
@@ -754,8 +770,10 @@ MAIN(int argc, char **argv, char **envp)
saveBuffer(Currentbuf, stdout);
}
if (w3m_halfdump)
- printf("</pre><title>%s</title>\n", html_quote(newbuf->buffername));
- } else {
+ printf("</pre><title>%s</title>\n",
+ html_quote(newbuf->buffername));
+ }
+ else {
if (Currentbuf->frameset != NULL && RenderFrame)
rFrame();
Currentbuf = newbuf;
@@ -766,9 +784,9 @@ MAIN(int argc, char **argv, char **envp)
}
if (w3m_dump) {
#ifdef USE_COOKIE
- save_cookies();
-#endif /* USE_COOKIE */
- w3m_exit(0);
+ save_cookies();
+#endif /* USE_COOKIE */
+ w3m_exit(0);
}
if (!Firstbuf || Firstbuf == NO_BUFFER) {
@@ -783,8 +801,8 @@ MAIN(int argc, char **argv, char **envp)
if (newbuf == NO_BUFFER) {
#ifdef USE_COOKIE
save_cookies();
-#endif /* USE_COOKIE */
- if (! err_msg->length)
+#endif /* USE_COOKIE */
+ if (!err_msg->length)
w3m_exit(0);
}
w3m_exit(2);
@@ -837,20 +855,22 @@ MAIN(int argc, char **argv, char **envp)
if (alarm_status == AL_IMPLICIT) {
alarm_buffer = Currentbuf;
alarm_status = AL_IMPLICIT_DONE;
- } else if (alarm_status == AL_IMPLICIT_DONE && alarm_buffer != Currentbuf) {
+ }
+ else if (alarm_status == AL_IMPLICIT_DONE
+ && alarm_buffer != Currentbuf) {
alarm_sec = 0;
alarm_status = AL_UNSET;
}
- if (alarm_sec > 0) {
- signal(SIGALRM, SigAlarm);
- alarm(alarm_sec);
- }
+ if (alarm_sec > 0) {
+ signal(SIGALRM, SigAlarm);
+ alarm(alarm_sec);
+ }
#endif
c = getch();
#ifdef USE_ALARM
- if (alarm_sec > 0) {
- alarm(0);
- }
+ if (alarm_sec > 0) {
+ alarm(0);
+ }
#endif
#ifdef USE_MOUSE
if (use_mouse)
@@ -858,13 +878,13 @@ MAIN(int argc, char **argv, char **envp)
#endif /* USE_MOUSE */
if (IS_ASCII(c)) { /* Ascii */
if (((prec_num && c == '0') || '1' <= c) && (c <= '9')) {
- prec_num = prec_num * 10 + (int) (c - '0');
+ prec_num = prec_num * 10 + (int)(c - '0');
if (prec_num > PREC_LIMIT)
prec_num = PREC_LIMIT;
}
else {
set_buffer_environ(Currentbuf);
- keyPressEventProc((int) c);
+ keyPressEventProc((int)c);
prec_num = 0;
}
}
@@ -877,7 +897,7 @@ static void
keyPressEventProc(int c)
{
CurrentKey = c;
- w3mFuncList[(int) GlobalKeymap[c]].func();
+ w3mFuncList[(int)GlobalKeymap[c]].func();
onA();
}
@@ -892,7 +912,7 @@ pushEvent(int event, void *user_data)
}
static void
-dump_source(Buffer * buf)
+dump_source(Buffer *buf)
{
FILE *f;
char c;
@@ -908,7 +928,7 @@ dump_source(Buffer * buf)
}
static void
-dump_head(Buffer * buf)
+dump_head(Buffer *buf)
{
TextListItem *ti;
@@ -924,11 +944,11 @@ dump_head(Buffer * buf)
}
static void
-dump_extra(Buffer * buf)
+dump_extra(Buffer *buf)
{
- printf("W3m-current-url: %s\n",parsedURL2Str(&buf->currentURL)->ptr);
+ printf("W3m-current-url: %s\n", parsedURL2Str(&buf->currentURL)->ptr);
if (buf->baseURL)
- printf("W3m-base-url: %s\n",parsedURL2Str(buf->baseURL)->ptr);
+ printf("W3m-base-url: %s\n", parsedURL2Str(buf->baseURL)->ptr);
#ifdef JP_CHARSET
printf("W3m-document-charset: %s\n", code_to_str(buf->document_code));
#endif
@@ -943,10 +963,11 @@ nulcmd(void)
void
pcmap(void)
{
- w3mFuncList[(int) PcKeymap[(int) getch()]].func();
+ w3mFuncList[(int)PcKeymap[(int)getch()]].func();
}
-#else /* not __EMX__ */
-void pcmap(void)
+#else /* not __EMX__ */
+void
+pcmap(void)
{
}
#endif
@@ -958,7 +979,7 @@ escmap(void)
c = getch();
if (IS_ASCII(c)) {
CurrentKey = K_ESC | c;
- w3mFuncList[(int) EscKeymap[(int) c]].func();
+ w3mFuncList[(int)EscKeymap[(int)c]].func();
}
}
@@ -972,7 +993,7 @@ escbmap(void)
escdmap(c);
else if (IS_ASCII(c)) {
CurrentKey = K_ESCB | c;
- w3mFuncList[(int) EscBKeymap[(int) c]].func();
+ w3mFuncList[(int)EscBKeymap[(int)c]].func();
}
}
@@ -981,23 +1002,22 @@ escdmap(char c)
{
int d;
- d = (int) c - (int) '0';
+ d = (int)c - (int)'0';
c = getch();
if (IS_DIGIT(c)) {
- d = d * 10 + (int) c - (int) '0';
+ d = d * 10 + (int)c - (int)'0';
c = getch();
}
if (c == '~') {
CurrentKey = K_ESCD | d;
- w3mFuncList[(int) EscDKeymap[d]].func();
+ w3mFuncList[(int)EscDKeymap[d]].func();
}
}
void
-tmpClearBuffer(Buffer * buf)
+tmpClearBuffer(Buffer *buf)
{
- if (buf->pagerSource == NULL &&
- writeBufferCache(buf) == 0) {
+ if (buf->pagerSource == NULL && writeBufferCache(buf) == 0) {
buf->firstLine = NULL;
buf->topLine = NULL;
buf->currentLine = NULL;
@@ -1022,7 +1042,7 @@ saveBufferInfo()
}
static void
-pushBuffer(Buffer * buf)
+pushBuffer(Buffer *buf)
{
Buffer *b;
@@ -1044,7 +1064,7 @@ pushBuffer(Buffer * buf)
}
static void
-delBuffer(Buffer * buf)
+delBuffer(Buffer *buf)
{
if (buf == NULL)
return;
@@ -1056,7 +1076,7 @@ delBuffer(Buffer * buf)
}
static void
-repBuffer(Buffer * oldbuf, Buffer * buf)
+repBuffer(Buffer *oldbuf, Buffer *buf)
{
Firstbuf = replaceBuffer(Firstbuf, oldbuf, buf);
Currentbuf = buf;
@@ -1106,7 +1126,8 @@ nscroll(int n, int mode)
lnum = Currentbuf->topLine->linenumber;
else if (lnum > Currentbuf->lastLine->linenumber)
lnum = Currentbuf->lastLine->linenumber;
- } else {
+ }
+ else {
tlnum = Currentbuf->topLine->linenumber;
llnum = Currentbuf->topLine->linenumber + LASTLINE - 1;
#ifdef NEXTPAGE_TOPLINE
@@ -1144,7 +1165,7 @@ pgBack(void)
{
#ifdef VI_PREC_NUM
if (vi_prec_num)
- nscroll(- searchKeyNum() * (LASTLINE - 1), B_NORMAL);
+ nscroll(-searchKeyNum() * (LASTLINE - 1), B_NORMAL);
else
#endif
nscroll(-(prec_num ? searchKeyNum() : searchKeyNum() * (LASTLINE - 1)),
@@ -1162,7 +1183,7 @@ lup1(void)
void
ldown1(void)
{
- nscroll(- searchKeyNum(), B_SCROLL);
+ nscroll(-searchKeyNum(), B_SCROLL);
}
/* move cursor position to the center of screen */
@@ -1174,9 +1195,13 @@ ctrCsrV(void)
return;
offsety = LASTLINE / 2 - Currentbuf->cursorY;
if (offsety != 0) {
-/* Currentbuf->currentLine = lineSkip(Currentbuf,
- * Currentbuf->currentLine,offsety, FALSE); */
- Currentbuf->topLine = lineSkip(Currentbuf, Currentbuf->topLine, -offsety, FALSE);
+#if 0
+ Currentbuf->currentLine = lineSkip(Currentbuf,
+ Currentbuf->currentLine, offsety,
+ FALSE);
+#endif
+ Currentbuf->topLine =
+ lineSkip(Currentbuf, Currentbuf->topLine, -offsety, FALSE);
arrangeLine(Currentbuf);
displayBuffer(Currentbuf, B_NORMAL);
}
@@ -1225,7 +1250,7 @@ srchfor(void)
prevtrap = signal(SIGINT, intTrap);
crmode();
if (SETJMP(IntReturn) == 0)
- for (i = 0; i < n; i++)
+ for (i = 0; i < n; i++)
wrapped = forwardSearch(Currentbuf, SearchString);
signal(SIGINT, prevtrap);
term_raw();
@@ -1257,7 +1282,7 @@ srchbak(void)
prevtrap = signal(SIGINT, intTrap);
crmode();
if (SETJMP(IntReturn) == 0)
- for (i = 0; i < n; i++)
+ for (i = 0; i < n; i++)
wrapped = backwardSearch(Currentbuf, SearchString);
signal(SIGINT, prevtrap);
term_raw();
@@ -1274,10 +1299,8 @@ srch_nxtprv(int reverse)
{
int i;
int wrapped = 0;
- static int (*routine[2]) (Buffer *, char *) =
- {
- forwardSearch, backwardSearch
- };
+ static int (*routine[2]) (Buffer *, char *) = {
+ forwardSearch, backwardSearch};
MySignalHandler(*prevtrap) ();
if (searchRoutine == NULL) {
@@ -1301,9 +1324,10 @@ srch_nxtprv(int reverse)
disp_message("Search wrapped", FALSE);
}
else {
- disp_message(Sprintf("%s%s",
- routine[reverse] == forwardSearch ? "Forward: " : "Backward: ",
- SearchString)->ptr, FALSE);
+ disp_message(Sprintf("%s%s",
+ routine[reverse] ==
+ forwardSearch ? "Forward: " : "Backward: ",
+ SearchString)->ptr, FALSE);
}
}
@@ -1322,7 +1346,7 @@ srchprv(void)
}
static void
-shiftvisualpos(Buffer * buf, int shift)
+shiftvisualpos(Buffer *buf, int shift)
{
buf->visualpos -= shift;
if (buf->visualpos >= buf->COLS)
@@ -1343,7 +1367,7 @@ shiftl(void)
if (Currentbuf->firstLine == NULL)
return;
column = Currentbuf->currentColumn;
- columnSkip(Currentbuf, searchKeyNum() * (- Currentbuf->COLS + 1) + 1);
+ columnSkip(Currentbuf, searchKeyNum() * (-Currentbuf->COLS + 1) + 1);
shiftvisualpos(Currentbuf, Currentbuf->currentColumn - column);
displayBuffer(Currentbuf, B_NORMAL);
}
@@ -1405,21 +1429,21 @@ setEnv(void)
char *env;
char *var, *value;
- CurrentKeyData = NULL; /* not allowed in w3m-control: */
+ CurrentKeyData = NULL; /* not allowed in w3m-control: */
env = searchKeyData();
if (env == NULL || *env == '\0' || strchr(env, '=') == NULL) {
- if (env != NULL && *env != '\0')
- env = Sprintf("%s=", env)->ptr;
- env = inputStrHist("Set environ: ", env, TextHist);
- if (env == NULL || *env == '\0') {
- displayBuffer(Currentbuf, B_NORMAL);
- return;
- }
+ if (env != NULL && *env != '\0')
+ env = Sprintf("%s=", env)->ptr;
+ env = inputStrHist("Set environ: ", env, TextHist);
+ if (env == NULL || *env == '\0') {
+ displayBuffer(Currentbuf, B_NORMAL);
+ return;
+ }
}
if ((value = strchr(env, '=')) != NULL && value > env) {
- var = allocStr(env, value - env);
- value++;
- set_environ(var, value);
+ var = allocStr(env, value - env);
+ value++;
+ set_environ(var, value);
}
displayBuffer(Currentbuf, B_NORMAL);
}
@@ -1431,37 +1455,37 @@ pipeBuf(void)
char *cmd, *tmpf;
FILE *f;
- CurrentKeyData = NULL; /* not allowed in w3m-control: */
+ CurrentKeyData = NULL; /* not allowed in w3m-control: */
cmd = searchKeyData();
if (cmd == NULL || *cmd == '\0') {
- cmd = inputLineHist("Pipe buffer to: ", "", IN_COMMAND, ShellHist);
- if (cmd == NULL || *cmd == '\0') {
- displayBuffer(Currentbuf, B_NORMAL);
- return;
- }
+ cmd = inputLineHist("Pipe buffer to: ", "", IN_COMMAND, ShellHist);
+ if (cmd == NULL || *cmd == '\0') {
+ displayBuffer(Currentbuf, B_NORMAL);
+ return;
+ }
}
tmpf = tmpfname(TMPF_DFL, NULL)->ptr;
f = fopen(tmpf, "w");
if (f == NULL) {
- disp_message(Sprintf("Can't save buffer to %s", cmd)->ptr, TRUE);
- return;
+ disp_message(Sprintf("Can't save buffer to %s", cmd)->ptr, TRUE);
+ return;
}
saveBuffer(Currentbuf, f);
fclose(f);
pushText(fileToDelete, tmpf);
if (strcasestr(cmd, "%s"))
- cmd = Sprintf(cmd, tmpf)->ptr;
+ cmd = Sprintf(cmd, tmpf)->ptr;
else
- cmd = Sprintf("%s < %s", cmd, tmpf)->ptr;
+ cmd = Sprintf("%s < %s", cmd, tmpf)->ptr;
buf = getpipe(cmd);
if (buf == NULL) {
- disp_message("Execution failed", FALSE);
+ disp_message("Execution failed", FALSE);
}
else {
- buf->bufferprop |= (BP_INTERNAL | BP_NO_URL);
- if (buf->type == NULL)
- buf->type = "text/plain";
- pushBuffer(buf);
+ buf->bufferprop |= (BP_INTERNAL | BP_NO_URL);
+ if (buf->type == NULL)
+ buf->type = "text/plain";
+ pushBuffer(buf);
}
displayBuffer(Currentbuf, B_FORCE_REDRAW);
}
@@ -1542,7 +1566,7 @@ execsh(void)
CurrentKeyData = NULL; /* not allowed in w3m-control: */
cmd = searchKeyData();
if (cmd == NULL || *cmd == '\0') {
- cmd = inputLineHist("(exec shell)!", "", IN_COMMAND, ShellHist);
+ cmd = inputLineHist("(exec shell)!", "", IN_COMMAND, ShellHist);
}
if (cmd != NULL)
cmd = conv_to_system(cmd);
@@ -1609,14 +1633,14 @@ _movL(int n)
if (Currentbuf->firstLine == NULL)
return;
for (i = 0; i < m; i++)
- cursorLeft(Currentbuf, n);
+ cursorLeft(Currentbuf, n);
displayBuffer(Currentbuf, B_NORMAL);
}
void
movL(void)
{
- _movL(Currentbuf->COLS / 2);
+ _movL(Currentbuf->COLS / 2);
}
void
@@ -1633,7 +1657,7 @@ _movD(int n)
if (Currentbuf->firstLine == NULL)
return;
for (i = 0; i < m; i++)
- cursorDown(Currentbuf, n);
+ cursorDown(Currentbuf, n);
displayBuffer(Currentbuf, B_NORMAL);
}
@@ -1657,7 +1681,7 @@ _movU(int n)
if (Currentbuf->firstLine == NULL)
return;
for (i = 0; i < m; i++)
- cursorUp(Currentbuf, n);
+ cursorUp(Currentbuf, n);
displayBuffer(Currentbuf, B_NORMAL);
}
@@ -1681,7 +1705,7 @@ _movR(int n)
if (Currentbuf->firstLine == NULL)
return;
for (i = 0; i < m; i++)
- cursorRight(Currentbuf, n);
+ cursorRight(Currentbuf, n);
displayBuffer(Currentbuf, B_NORMAL);
}
@@ -1705,11 +1729,11 @@ movR1(void)
#define IS_WORD_CHAR(c,p) (IS_ALNUM(c) && CharType(p) == PC_ASCII)
static int
-prev_nonnull_line(Line * line)
+prev_nonnull_line(Line *line)
{
Line *l;
- for (l = line; l != NULL && l->len == 0; l = l->prev);
+ for (l = line; l != NULL && l->len == 0; l = l->prev) ;
if (l == NULL || l->len == 0)
return -1;
@@ -1742,7 +1766,8 @@ movLW(void)
lb = Currentbuf->currentLine->lineBuf;
pb = Currentbuf->currentLine->propBuf;
while (Currentbuf->pos > 0 &&
- !IS_WORD_CHAR(lb[Currentbuf->pos - 1], pb[Currentbuf->pos - 1])) {
+ !IS_WORD_CHAR(lb[Currentbuf->pos - 1],
+ pb[Currentbuf->pos - 1])) {
Currentbuf->pos--;
}
if (Currentbuf->pos > 0)
@@ -1758,7 +1783,8 @@ movLW(void)
lb = Currentbuf->currentLine->lineBuf;
pb = Currentbuf->currentLine->propBuf;
while (Currentbuf->pos > 0 &&
- IS_WORD_CHAR(lb[Currentbuf->pos - 1], pb[Currentbuf->pos - 1])) {
+ IS_WORD_CHAR(lb[Currentbuf->pos - 1],
+ pb[Currentbuf->pos - 1])) {
Currentbuf->pos--;
}
}
@@ -1768,11 +1794,11 @@ movLW(void)
}
static int
-next_nonnull_line(Line * line)
+next_nonnull_line(Line *line)
{
Line *l;
- for (l = line; l != NULL && l->len == 0; l = l->next);
+ for (l = line; l != NULL && l->len == 0; l = l->next) ;
if (l == NULL || l->len == 0)
return -1;
@@ -1811,7 +1837,7 @@ movRW(void)
while (1) {
while (lb[Currentbuf->pos] &&
- !IS_WORD_CHAR(lb[Currentbuf->pos], pb[Currentbuf->pos]))
+ !IS_WORD_CHAR(lb[Currentbuf->pos], pb[Currentbuf->pos]))
Currentbuf->pos++;
if (lb[Currentbuf->pos])
break;
@@ -1919,7 +1945,7 @@ susp(void)
shell = "/bin/sh";
system(shell);
#else /* SIGSTOP */
- kill((pid_t)0, SIGSTOP);
+ kill((pid_t) 0, SIGSTOP);
#endif /* SIGSTOP */
fmInit();
displayBuffer(Currentbuf, B_FORCE_REDRAW);
@@ -1941,7 +1967,9 @@ _goLine(char *l)
Currentbuf->topLine = Currentbuf->currentLine = Currentbuf->firstLine;
}
else if (*l == '$') {
- Currentbuf->topLine = lineSkip(Currentbuf, Currentbuf->lastLine, -(LASTLINE + 1) / 2, TRUE);
+ Currentbuf->topLine =
+ lineSkip(Currentbuf, Currentbuf->lastLine, -(LASTLINE + 1) / 2,
+ TRUE);
Currentbuf->currentLine = Currentbuf->lastLine;
}
else
@@ -1954,7 +1982,7 @@ void
goLine(void)
{
if (prec_num)
- _goLine("^");
+ _goLine("^");
_goLine(inputStr("Goto line: ", ""));
prec_num = 0;
}
@@ -2003,13 +2031,10 @@ editBf(void)
Buffer *buf, *fbuf = NULL;
Str cmd;
- if (fn == NULL ||
- Currentbuf->pagerSource != NULL || /* Behaving as a pager */
- (Currentbuf->type == NULL &&
- Currentbuf->edit == NULL) || /* Reading shell */
- Currentbuf->real_scheme != SCM_LOCAL ||
- !strcmp(Currentbuf->currentURL.file, "-") || /* file is std *
- * input */
+ if (fn == NULL || Currentbuf->pagerSource != NULL || /* Behaving as a pager */
+ (Currentbuf->type == NULL && Currentbuf->edit == NULL) || /* Reading shell */
+ Currentbuf->real_scheme != SCM_LOCAL || !strcmp(Currentbuf->currentURL.file, "-") || /* file is std *
+ * input */
Currentbuf->bufferprop & BP_FRAME) { /* Frame */
disp_err_message("Can't edit other than local file", TRUE);
return;
@@ -2019,7 +2044,8 @@ editBf(void)
if (Currentbuf->firstLine == NULL) {
top = 1;
linenum = 1;
- } else {
+ }
+ else {
top = Currentbuf->topLine->linenumber;
linenum = Currentbuf->currentLine->linenumber;
}
@@ -2030,8 +2056,7 @@ editBf(void)
cmd = unquote_mailcap(Currentbuf->edit,
Currentbuf->real_type,
fn,
- checkHeader(Currentbuf, "Content-Type:"),
- NULL);
+ checkHeader(Currentbuf, "Content-Type:"), NULL);
}
else {
char *file = shell_quote(fn);
@@ -2040,7 +2065,8 @@ editBf(void)
cmd = Sprintf(Editor, linenum, file);
else
cmd = Sprintf(Editor, file);
- } else {
+ }
+ else {
if (strcasestr(Editor, "%d"))
cmd = Sprintf(Editor, linenum);
else if (strcasestr(Editor, "vi"))
@@ -2082,7 +2108,8 @@ editBf(void)
displayBuffer(Currentbuf, B_FORCE_REDRAW);
return;
}
- Currentbuf->topLine = lineSkip(Currentbuf, Currentbuf->topLine, top - 1, FALSE);
+ Currentbuf->topLine =
+ lineSkip(Currentbuf, Currentbuf->topLine, top - 1, FALSE);
gotoLine(Currentbuf, linenum);
Currentbuf->pos = pos;
Currentbuf->currentColumn = currentColumn;
@@ -2117,7 +2144,8 @@ editScr(void)
cmd = Sprintf(Editor, lnum, tmpf->ptr);
else
cmd = Sprintf(Editor, tmpf->ptr);
- } else {
+ }
+ else {
if (strcasestr(Editor, "%d"))
cmd = Sprintf(Editor, lnum);
else if (strcasestr(Editor, "vi"))
@@ -2142,7 +2170,7 @@ void
_mark(void)
{
Line *l;
- if (! use_mark)
+ if (!use_mark)
return;
if (Currentbuf->firstLine == NULL)
return;
@@ -2152,9 +2180,9 @@ _mark(void)
}
static void
-cmd_mark(Lineprop * p)
+cmd_mark(Lineprop *p)
{
- if (! use_mark)
+ if (!use_mark)
return;
if ((*p & PM_MARK) && (*p & PE_STAND))
*p &= ~PE_STAND;
@@ -2170,7 +2198,7 @@ nextMk(void)
Line *l;
int i;
- if (! use_mark)
+ if (!use_mark)
return;
if (Currentbuf->firstLine == NULL)
return;
@@ -2203,7 +2231,7 @@ prevMk(void)
Line *l;
int i;
- if (! use_mark)
+ if (!use_mark)
return;
if (Currentbuf->firstLine == NULL)
return;
@@ -2239,7 +2267,7 @@ reMark(void)
char *str;
char *p, *p1, *p2;
- if (! use_mark)
+ if (!use_mark)
return;
str = inputStrHist("(Mark)Regexp: ", MarkString, TextHist);
if (str == NULL || *str == '\0') {
@@ -2270,7 +2298,7 @@ reMark(void)
#ifdef JP_CHARSET
static char *
-cURLcode(char *url, Buffer * buf)
+cURLcode(char *url, Buffer *buf)
{
char *p;
Str s;
@@ -2289,7 +2317,7 @@ cURLcode(char *url, Buffer * buf)
#endif /* not JP_CHARSET */
static Buffer *
-loadNormalBuf(Buffer * buf, int renderframe)
+loadNormalBuf(Buffer *buf, int renderframe)
{
pushBuffer(buf);
if (renderframe && RenderFrame && Currentbuf->frameset != NULL)
@@ -2298,7 +2326,7 @@ loadNormalBuf(Buffer * buf, int renderframe)
}
static Buffer *
-loadLink(char *url, char *target, char *referer, FormList * request)
+loadLink(char *url, char *target, char *referer, FormList *request)
{
Buffer *buf, *nfbuf;
union frameset_element *f_element = NULL;
@@ -2315,10 +2343,7 @@ loadLink(char *url, char *target, char *referer, FormList * request)
if (referer == NULL)
referer = parsedURL2Str(&Currentbuf->currentURL)->ptr;
buf = loadGeneralFile(cURLcode(url, Currentbuf),
- baseURL(Currentbuf),
- referer,
- flag,
- request);
+ baseURL(Currentbuf), referer, flag, request);
if (buf == NULL) {
char *emsg = Sprintf("Can't load %s", url)->ptr;
disp_err_message(emsg, FALSE);
@@ -2342,7 +2367,7 @@ loadLink(char *url, char *target, char *referer, FormList * request)
!strcmp(target, "_top") || /* this link is specified to * be
* opened as an indivisual * page */
!(Currentbuf->bufferprop & BP_FRAME) /* This page is not a *
- * frame page */
+ * * * * * frame page */
) {
return loadNormalBuf(buf, TRUE);
}
@@ -2361,9 +2386,7 @@ loadLink(char *url, char *target, char *referer, FormList * request)
/* frame page */
/* stack current frameset */
- pushFrameTree(&(nfbuf->frameQ),
- copyFrameSet(nfbuf->frameset),
- Currentbuf);
+ pushFrameTree(&(nfbuf->frameQ), copyFrameSet(nfbuf->frameset), Currentbuf);
/* delete frame view buffer */
delBuffer(Currentbuf);
Currentbuf = nfbuf;
@@ -2387,7 +2410,9 @@ loadLink(char *url, char *target, char *referer, FormList * request)
#ifdef LABEL_TOPLINE
if (label_topline)
Currentbuf->topLine = lineSkip(Currentbuf, Currentbuf->topLine,
- Currentbuf->currentLine->linenumber - Currentbuf->topLine->linenumber,
+ Currentbuf->currentLine->
+ linenumber -
+ Currentbuf->topLine->linenumber,
FALSE);
#endif
Currentbuf->pos = al->start.pos;
@@ -2413,7 +2438,7 @@ gotoLabel(char *label)
buf = newBuffer(Currentbuf->width);
copyBuffer(buf, Currentbuf);
for (i = 0; i < MAX_LB; i++)
- buf->linkBuffer[i] = NULL;
+ buf->linkBuffer[i] = NULL;
buf->currentURL.label = allocStr(label, 0);
pushHashHist(URLHist, parsedURL2Str(&buf->currentURL)->ptr);
(*buf->clone)++;
@@ -2422,7 +2447,7 @@ gotoLabel(char *label)
#ifdef LABEL_TOPLINE
if (label_topline)
Currentbuf->topLine = lineSkip(Currentbuf, Currentbuf->topLine,
- Currentbuf->currentLine->linenumber
+ Currentbuf->currentLine->linenumber
- Currentbuf->topLine->linenumber,
FALSE);
#endif
@@ -2446,7 +2471,7 @@ followA(void)
a = retrieveCurrentAnchor(Currentbuf);
if (a == NULL) {
- _followForm(FALSE);
+ _followForm(FALSE);
return;
}
if (*a->url == '#') { /* index within this buffer */
@@ -2454,8 +2479,7 @@ followA(void)
return;
}
parseURL2(a->url, &u, baseURL(Currentbuf));
- if (Strcmp(parsedURL2Str(&u),
- parsedURL2Str(&Currentbuf->currentURL)) == 0) {
+ if (Strcmp(parsedURL2Str(&u), parsedURL2Str(&Currentbuf->currentURL)) == 0) {
/* index within this buffer */
if (u.label) {
gotoLabel(u.label);
@@ -2477,8 +2501,7 @@ followA(void)
return;
}
#ifdef USE_NNTP
- else if (!strncasecmp(a->url, "news:", 5) &&
- strchr(a->url, '@') == NULL) {
+ else if (!strncasecmp(a->url, "news:", 5) && strchr(a->url, '@') == NULL) {
/* news:newsgroup is not supported */
disp_err_message("news:newsgroup_name is not supported", TRUE);
return;
@@ -2514,7 +2537,9 @@ followI(void)
return;
message(Sprintf("loading %s", a->url)->ptr, 0, 0);
refresh();
- buf = loadGeneralFile(cURLcode(a->url, Currentbuf), baseURL(Currentbuf), NULL, 0, NULL);
+ buf =
+ loadGeneralFile(cURLcode(a->url, Currentbuf), baseURL(Currentbuf),
+ NULL, 0, NULL);
if (buf == NULL) {
char *emsg = Sprintf("Can't load %s", a->url)->ptr;
disp_err_message(emsg, FALSE);
@@ -2526,7 +2551,7 @@ followI(void)
}
static FormItemList *
-save_submit_formlist(FormItemList * src)
+save_submit_formlist(FormItemList *src)
{
FormList *list;
FormList *srclist;
@@ -2562,7 +2587,7 @@ save_submit_formlist(FormItemList * src)
item->size = srcitem->size;
item->rows = srcitem->rows;
item->maxlength = srcitem->maxlength;
- item->readonly = srcitem->readonly;
+ item->readonly = srcitem->readonly;
#ifdef MENU_SELECT
opt = curopt = NULL;
for (srcopt = srcitem->select_option; srcopt; srcopt = srcopt->next) {
@@ -2607,14 +2632,14 @@ static Str
conv_form_encoding(Str val, FormItemList *fi, Buffer *buf)
{
return conv_str(val, InnerCode, fi->parent->charset ? fi->parent->charset
- : (buf->document_code ? buf->document_code : CODE_EUC));
+ : (buf->document_code ? buf->document_code : CODE_EUC));
}
#else
#define conv_form_encoding(val, fi, buf) (val)
#endif
static void
-query_from_followform(Str * query, FormItemList * fi, int multipart)
+query_from_followform(Str *query, FormItemList *fi, int multipart)
{
FormItemList *f2;
FILE *body = NULL;
@@ -2626,8 +2651,9 @@ query_from_followform(Str * query, FormItemList * fi, int multipart)
return;
}
fi->parent->body = (*query)->ptr;
- fi->parent->boundary = Sprintf("------------------------------%d%ld%ld%ld",
- getpid(), fi->parent, fi->parent->body, fi->parent->boundary)->ptr;
+ fi->parent->boundary =
+ Sprintf("------------------------------%d%ld%ld%ld", getpid(),
+ fi->parent, fi->parent->body, fi->parent->boundary)->ptr;
}
*query = Strnew();
for (f2 = fi->parent->item; f2; f2 = f2->next) {
@@ -2655,22 +2681,27 @@ query_from_followform(Str * query, FormItemList * fi, int multipart)
if (f2->type == FORM_INPUT_IMAGE) {
*query = Strdup(conv_form_encoding(f2->name, fi, Currentbuf));
Strcat_charp(*query, ".x");
- form_write_data(body, fi->parent->boundary, (*query)->ptr, "1");
+ form_write_data(body, fi->parent->boundary, (*query)->ptr,
+ "1");
*query = Strdup(f2->name);
Strcat_charp(*query, ".y");
- form_write_data(body, fi->parent->boundary, (*query)->ptr, "1");
+ form_write_data(body, fi->parent->boundary, (*query)->ptr,
+ "1");
}
else if (f2->name && f2->name->length > 0 && f2->value != NULL) {
/* not IMAGE */
*query = conv_form_encoding(f2->value, fi, Currentbuf);
if (f2->type == FORM_INPUT_FILE)
form_write_from_file(body, fi->parent->boundary,
- conv_form_encoding(f2->name, fi, Currentbuf)->ptr,
- (*query)->ptr, Str_conv_to_system(f2->value)->ptr);
+ conv_form_encoding(f2->name, fi,
+ Currentbuf)->ptr,
+ (*query)->ptr,
+ Str_conv_to_system(f2->value)->ptr);
else
form_write_data(body, fi->parent->boundary,
- conv_form_encoding(f2->name, fi, Currentbuf)->ptr,
- (*query)->ptr);
+ conv_form_encoding(f2->name, fi,
+ Currentbuf)->ptr,
+ (*query)->ptr);
}
}
else {
@@ -2684,16 +2715,18 @@ query_from_followform(Str * query, FormItemList * fi, int multipart)
else {
/* not IMAGE */
if (f2->name && f2->name->length > 0) {
- Strcat(*query, Str_form_quote(conv_form_encoding(
- f2->name, fi, Currentbuf)));
+ Strcat(*query,
+ Str_form_quote(conv_form_encoding
+ (f2->name, fi, Currentbuf)));
Strcat_char(*query, '=');
}
if (f2->value != NULL) {
if (fi->parent->method == FORM_METHOD_INTERNAL)
Strcat(*query, Str_form_quote(f2->value));
else {
- Strcat(*query, Str_form_quote(conv_form_encoding(
- f2->value, fi, Currentbuf)));
+ Strcat(*query,
+ Str_form_quote(conv_form_encoding
+ (f2->value, fi, Currentbuf)));
}
}
}
@@ -2716,14 +2749,14 @@ query_from_followform(Str * query, FormItemList * fi, int multipart)
void
submitForm(void)
{
- _followForm(TRUE);
+ _followForm(TRUE);
}
/* process form */
void
followForm(void)
{
- _followForm(FALSE);
+ _followForm(FALSE);
}
static void
@@ -2743,15 +2776,15 @@ _followForm(int submit)
a = retrieveCurrentForm(Currentbuf);
if (a == NULL)
return;
- fi = (FormItemList *) a->url;
+ fi = (FormItemList *)a->url;
switch (fi->type) {
case FORM_INPUT_TEXT:
- if (submit)
- goto do_submit;
- if (fi->readonly)
- disp_message_nsec("Read only field!", FALSE, 1, TRUE, FALSE);
+ if (submit)
+ goto do_submit;
+ if (fi->readonly)
+ disp_message_nsec("Read only field!", FALSE, 1, TRUE, FALSE);
p = inputStrHist("TEXT:", fi->value ? fi->value->ptr : NULL, TextHist);
- if (p == NULL || fi->readonly)
+ if (p == NULL || fi->readonly)
return;
fi->value = Strnew_charp(p);
formUpdateBuffer(a, Currentbuf, fi);
@@ -2759,12 +2792,13 @@ _followForm(int submit)
goto do_submit;
break;
case FORM_INPUT_FILE:
- if (submit)
- goto do_submit;
- if (fi->readonly)
- disp_message_nsec("Read only field!", FALSE, 1, TRUE, FALSE);
- p = inputFilenameHist("Filename:", fi->value ? fi->value->ptr : NULL, NULL);
- if (p == NULL || fi->readonly)
+ if (submit)
+ goto do_submit;
+ if (fi->readonly)
+ disp_message_nsec("Read only field!", FALSE, 1, TRUE, FALSE);
+ p = inputFilenameHist("Filename:", fi->value ? fi->value->ptr : NULL,
+ NULL);
+ if (p == NULL || fi->readonly)
return;
fi->value = Strnew_charp(p);
formUpdateBuffer(a, Currentbuf, fi);
@@ -2772,12 +2806,12 @@ _followForm(int submit)
goto do_submit;
break;
case FORM_INPUT_PASSWORD:
- if (submit)
- goto do_submit;
- if (fi->readonly) {
- disp_message_nsec("Read only field!", FALSE, 1, TRUE, FALSE);
- return;
- }
+ if (submit)
+ goto do_submit;
+ if (fi->readonly) {
+ disp_message_nsec("Read only field!", FALSE, 1, TRUE, FALSE);
+ return;
+ }
p = inputLine("TEXT:", fi->value ? fi->value->ptr : NULL, IN_PASSWORD);
if (p == NULL)
return;
@@ -2787,43 +2821,44 @@ _followForm(int submit)
goto do_submit;
break;
case FORM_TEXTAREA:
- if (submit)
- goto do_submit;
- if (fi->readonly)
- disp_message_nsec("Read only field!", FALSE, 1, TRUE, FALSE);
- input_textarea(fi);
+ if (submit)
+ goto do_submit;
+ if (fi->readonly)
+ disp_message_nsec("Read only field!", FALSE, 1, TRUE, FALSE);
+ input_textarea(fi);
formUpdateBuffer(a, Currentbuf, fi);
break;
case FORM_INPUT_RADIO:
- if (submit)
- goto do_submit;
- if (fi->readonly) {
- disp_message_nsec("Read only field!", FALSE, 1, TRUE, FALSE);
- return;
- }
+ if (submit)
+ goto do_submit;
+ if (fi->readonly) {
+ disp_message_nsec("Read only field!", FALSE, 1, TRUE, FALSE);
+ return;
+ }
formRecheckRadio(a, Currentbuf, fi);
break;
case FORM_INPUT_CHECKBOX:
- if (submit)
- goto do_submit;
- if (fi->readonly) {
- disp_message_nsec("Read only field!", FALSE, 1, TRUE, FALSE);
- return;
- }
+ if (submit)
+ goto do_submit;
+ if (fi->readonly) {
+ disp_message_nsec("Read only field!", FALSE, 1, TRUE, FALSE);
+ return;
+ }
fi->checked = !fi->checked;
formUpdateBuffer(a, Currentbuf, fi);
break;
#ifdef MENU_SELECT
case FORM_SELECT:
- if (submit)
- goto do_submit;
- if (! formChooseOptionByMenu(fi,
- Currentbuf->cursorX - Currentbuf->pos + a->start.pos + Currentbuf->rootX,
- Currentbuf->cursorY))
- break;
+ if (submit)
+ goto do_submit;
+ if (!formChooseOptionByMenu(fi,
+ Currentbuf->cursorX - Currentbuf->pos +
+ a->start.pos + Currentbuf->rootX,
+ Currentbuf->cursorY))
+ break;
formUpdateBuffer(a, Currentbuf, fi);
- if (fi->parent->nitems == 1)
- goto do_submit;
+ if (fi->parent->nitems == 1)
+ goto do_submit;
break;
#endif /* MENU_SELECT */
case FORM_INPUT_IMAGE:
@@ -2841,7 +2876,7 @@ _followForm(int submit)
/* It means "current URL" */
tmp2 = parsedURL2Str(&Currentbuf->currentURL);
if ((p = strchr(tmp2->ptr, '?')) != NULL)
- Strshrink(tmp2, (tmp2->ptr + tmp2->length) - p);
+ Strshrink(tmp2, (tmp2->ptr + tmp2->length) - p);
}
if (fi->parent->method == FORM_METHOD_GET) {
@@ -2864,39 +2899,38 @@ _followForm(int submit)
if (multipart) {
unlink(fi->parent->body);
}
- if (buf && !(buf->bufferprop & BP_REDIRECTED)) { /* buf must be Currentbuf */
- /* BP_REDIRECTED means that the buffer is obtained through
+ if (buf && !(buf->bufferprop & BP_REDIRECTED)) { /* buf must be Currentbuf */
+ /* BP_REDIRECTED means that the buffer is obtained through
* Location: header. In this case, buf->form_submit must not be set
* because the page is not loaded by POST method but GET method.
*/
buf->form_submit = save_submit_formlist(fi);
}
}
- else if ((fi->parent->method == FORM_METHOD_INTERNAL &&
- Strcmp_charp(fi->parent->action,"map") == 0) ||
- Currentbuf->bufferprop & BP_INTERNAL) { /* internal */
+ else if ((fi->parent->method == FORM_METHOD_INTERNAL && Strcmp_charp(fi->parent->action, "map") == 0) || Currentbuf->bufferprop & BP_INTERNAL) { /* internal */
do_internal(tmp2->ptr, tmp->ptr);
return;
}
else {
- disp_err_message("Can't send form because of illegal method.", FALSE);
+ disp_err_message("Can't send form because of illegal method.",
+ FALSE);
}
break;
case FORM_INPUT_RESET:
for (i = 0; i < Currentbuf->formitem->nanchor; i++) {
a2 = &Currentbuf->formitem->anchors[i];
- f2 = (FormItemList *) a2->url;
+ f2 = (FormItemList *)a2->url;
if (f2->parent == fi->parent &&
f2->name && f2->value &&
f2->type != FORM_INPUT_SUBMIT &&
f2->type != FORM_INPUT_HIDDEN &&
f2->type != FORM_INPUT_RESET) {
- f2->value = f2->init_value;
- f2->checked = f2->init_checked;
+ f2->value = f2->init_value;
+ f2->checked = f2->init_checked;
#ifdef MENU_SELECT
- f2->label = f2->init_label;
- f2->selected = f2->init_selected;
-#endif /* MENU_SELECT */
+ f2->label = f2->init_label;
+ f2->selected = f2->init_selected;
+#endif /* MENU_SELECT */
formUpdateBuffer(a2, Currentbuf, f2);
}
}
@@ -2909,7 +2943,8 @@ _followForm(int submit)
}
static void
-drawAnchorCursor0(Buffer * buf, int hseq, int prevhseq, int tline, int eline, int active)
+drawAnchorCursor0(Buffer *buf, int hseq, int prevhseq, int tline, int eline,
+ int active)
{
int i, j;
Line *l;
@@ -2918,7 +2953,7 @@ drawAnchorCursor0(Buffer * buf, int hseq, int prevhseq, int tline, int eline, in
l = buf->topLine;
for (j = 0; j < buf->href->nanchor; j++) {
an = &buf->href->anchors[j];
- if (an->start.line < tline)
+ if (an->start.line < tline)
continue;
if (an->start.line >= eline)
return;
@@ -2951,7 +2986,7 @@ drawAnchorCursor0(Buffer * buf, int hseq, int prevhseq, int tline, int eline, in
void
-drawAnchorCursor(Buffer * buf)
+drawAnchorCursor(Buffer *buf)
{
Anchor *an;
int hseq, prevhseq;
@@ -3079,7 +3114,8 @@ nextA(void)
po = &hl->marks[hseq];
an = retrieveAnchor(Currentbuf->href, po->line, po->pos);
if (an == NULL)
- an = retrieveAnchor(Currentbuf->formitem, po->line, po->pos);
+ an = retrieveAnchor(Currentbuf->formitem, po->line,
+ po->pos);
hseq++;
} while (an == NULL || an == pan);
}
@@ -3138,7 +3174,8 @@ prevA(void)
po = hl->marks + hseq;
an = retrieveAnchor(Currentbuf->href, po->line, po->pos);
if (an == NULL)
- an = retrieveAnchor(Currentbuf->formitem, po->line, po->pos);
+ an = retrieveAnchor(Currentbuf->formitem, po->line,
+ po->pos);
hseq--;
} while (an == NULL || an == pan);
}
@@ -3174,46 +3211,46 @@ nextX(int d, int dy)
int i, x, y, n = searchKeyNum();
if (Currentbuf->firstLine == NULL)
- return;
+ return;
if (!hl || hl->nmark == 0)
- return;
+ return;
an = retrieveCurrentAnchor(Currentbuf);
if (an == NULL)
- an = retrieveCurrentForm(Currentbuf);
+ an = retrieveCurrentForm(Currentbuf);
l = Currentbuf->currentLine;
x = Currentbuf->pos;
y = l->linenumber;
pan = NULL;
for (i = 0; i < n; i++) {
- if (an)
- x = (d > 0) ? an->end.pos : an->start.pos - 1;
- an = NULL;
- while (1) {
- for (; x >= 0 && x < l->len; x += d) {
- an = retrieveAnchor(Currentbuf->href, y, x);
- if (! an)
- an = retrieveAnchor(Currentbuf->formitem, y, x);
- if (an) {
- pan = an;
- break;
- }
- }
- if (! dy || an)
- break;
- l = (dy > 0) ? l->next : l->prev;
- if (! l)
- break;
- x = (d > 0) ? 0 : l->len - 1;
- y = l->linenumber;
- }
- if (! an)
- break;
+ if (an)
+ x = (d > 0) ? an->end.pos : an->start.pos - 1;
+ an = NULL;
+ while (1) {
+ for (; x >= 0 && x < l->len; x += d) {
+ an = retrieveAnchor(Currentbuf->href, y, x);
+ if (!an)
+ an = retrieveAnchor(Currentbuf->formitem, y, x);
+ if (an) {
+ pan = an;
+ break;
+ }
+ }
+ if (!dy || an)
+ break;
+ l = (dy > 0) ? l->next : l->prev;
+ if (!l)
+ break;
+ x = (d > 0) ? 0 : l->len - 1;
+ y = l->linenumber;
+ }
+ if (!an)
+ break;
}
if (pan == NULL)
- return;
+ return;
gotoLine(Currentbuf, y);
Currentbuf->pos = pan->start.pos;
arrangeCursor(Currentbuf);
@@ -3230,37 +3267,37 @@ nextY(int d)
int hseq;
if (Currentbuf->firstLine == NULL)
- return;
+ return;
if (!hl || hl->nmark == 0)
- return;
+ return;
an = retrieveCurrentAnchor(Currentbuf);
if (an == NULL)
- an = retrieveCurrentForm(Currentbuf);
+ an = retrieveCurrentForm(Currentbuf);
x = Currentbuf->pos;
y = Currentbuf->currentLine->linenumber + d;
pan = NULL;
hseq = -1;
for (i = 0; i < n; i++) {
- if (an)
- hseq = abs(an->hseq);
- an = NULL;
- for (; y >= 0 && y <= Currentbuf->lastLine->linenumber; y += d) {
- an = retrieveAnchor(Currentbuf->href, y, x);
- if (! an)
- an = retrieveAnchor(Currentbuf->formitem, y, x);
- if (an && hseq != abs(an->hseq)) {
- pan = an;
- break;
- }
- }
- if (! an)
- break;
+ if (an)
+ hseq = abs(an->hseq);
+ an = NULL;
+ for (; y >= 0 && y <= Currentbuf->lastLine->linenumber; y += d) {
+ an = retrieveAnchor(Currentbuf->href, y, x);
+ if (!an)
+ an = retrieveAnchor(Currentbuf->formitem, y, x);
+ if (an && hseq != abs(an->hseq)) {
+ pan = an;
+ break;
+ }
+ }
+ if (!an)
+ break;
}
if (pan == NULL)
- return;
+ return;
gotoLine(Currentbuf, pan->start.line);
arrangeLine(Currentbuf);
displayBuffer(Currentbuf, B_NORMAL);
@@ -3309,7 +3346,7 @@ nextU(void)
}
static int
-checkBackBuffer(Buffer * buf)
+checkBackBuffer(Buffer *buf)
{
Buffer *fbuf = buf->linkBuffer[LB_N_FRAME];
@@ -3317,7 +3354,7 @@ checkBackBuffer(Buffer * buf)
if (fbuf->frameQ)
return TRUE; /* Currentbuf has stacked frames */
/* when no frames stacked and next is frame source, try next's
- nextBuffer */
+ * nextBuffer */
if (RenderFrame && fbuf == buf->nextBuffer) {
if (fbuf->nextBuffer != NULL)
return TRUE;
@@ -3348,27 +3385,29 @@ backBf(void)
if (buf) {
if (buf->frameQ) {
struct frameset *fs;
- long linenumber = buf->frameQ->linenumber;
- long top = buf->frameQ->top_linenumber;
- short pos = buf->frameQ->pos;
- short currentColumn = buf->frameQ->currentColumn;
- AnchorList *formitem = buf->frameQ->formitem;
+ long linenumber = buf->frameQ->linenumber;
+ long top = buf->frameQ->top_linenumber;
+ short pos = buf->frameQ->pos;
+ short currentColumn = buf->frameQ->currentColumn;
+ AnchorList *formitem = buf->frameQ->formitem;
- fs = popFrameTree(&(buf->frameQ));
+ fs = popFrameTree(&(buf->frameQ));
deleteFrameSet(buf->frameset);
buf->frameset = fs;
if (buf == Currentbuf) {
rFrame();
- Currentbuf->topLine = lineSkip(Currentbuf,
- Currentbuf->firstLine, top - 1, FALSE);
+ Currentbuf->topLine = lineSkip(Currentbuf,
+ Currentbuf->firstLine, top - 1,
+ FALSE);
gotoLine(Currentbuf, linenumber);
- Currentbuf->pos = pos;
- Currentbuf->currentColumn = currentColumn;
+ Currentbuf->pos = pos;
+ Currentbuf->currentColumn = currentColumn;
arrangeCursor(Currentbuf);
- formResetBuffer(Currentbuf, formitem);
+ formResetBuffer(Currentbuf, formitem);
}
- } else if (RenderFrame && buf == Currentbuf) {
+ }
+ else if (RenderFrame && buf == Currentbuf) {
delBuffer(Currentbuf);
}
}
@@ -3384,7 +3423,7 @@ deletePrevBuf()
}
static void
-cmd_loadURL(char *url, ParsedURL * current)
+cmd_loadURL(char *url, ParsedURL *current)
{
Buffer *buf;
@@ -3403,8 +3442,7 @@ cmd_loadURL(char *url, ParsedURL * current)
return;
}
#ifdef USE_NNTP
- else if (!strncasecmp(url, "news:", 5) &&
- strchr(url, '@') == NULL) {
+ else if (!strncasecmp(url, "news:", 5) && strchr(url, '@') == NULL) {
/* news:newsgroup is not supported */
disp_err_message("news:newsgroup_name is not supported", TRUE);
return;
@@ -3463,7 +3501,7 @@ goURL(void)
}
static void
-cmd_loadBuffer(Buffer * buf, int prop, int link)
+cmd_loadBuffer(Buffer *buf, int prop, int link)
{
if (buf == NULL) {
disp_err_message("Can't load string", FALSE);
@@ -3495,12 +3533,13 @@ adBmark(void)
{
Str tmp;
- tmp = Sprintf("file://%s/" W3MBOOKMARK_CMDNAME
- "?mode=panel&bmark=%s&url=%s&title=%s",
+ tmp = Sprintf("file://%s/" W3MBOOKMARK_CMDNAME
+ "?mode=panel&bmark=%s&url=%s&title=%s",
w3m_lib_dir(),
- (Str_form_quote(Strnew_charp(BookmarkFile)))->ptr,
- (Str_form_quote(parsedURL2Str(&Currentbuf->currentURL)))->ptr,
- (Str_form_quote(Strnew_charp(Currentbuf->buffername)))->ptr);
+ (Str_form_quote(Strnew_charp(BookmarkFile)))->ptr,
+ (Str_form_quote(parsedURL2Str(&Currentbuf->currentURL)))->
+ ptr,
+ (Str_form_quote(Strnew_charp(Currentbuf->buffername)))->ptr);
cmd_loadURL(tmp->ptr, NULL);
}
@@ -3517,21 +3556,21 @@ setOpt(void)
{
char *opt;
- CurrentKeyData = NULL; /* not allowed in w3m-control: */
+ CurrentKeyData = NULL; /* not allowed in w3m-control: */
opt = searchKeyData();
if (opt == NULL || *opt == '\0' || strchr(opt, '=') == NULL) {
- if (opt != NULL && *opt != '\0') {
- char *v = get_param_option(opt);
- opt = Sprintf("%s=%s", opt, v ? v : "")->ptr;
- }
- opt = inputStrHist("Set option: ", opt, TextHist);
- if (opt == NULL || *opt == '\0') {
- displayBuffer(Currentbuf, B_NORMAL);
- return;
- }
+ if (opt != NULL && *opt != '\0') {
+ char *v = get_param_option(opt);
+ opt = Sprintf("%s=%s", opt, v ? v : "")->ptr;
+ }
+ opt = inputStrHist("Set option: ", opt, TextHist);
+ if (opt == NULL || *opt == '\0') {
+ displayBuffer(Currentbuf, B_NORMAL);
+ return;
+ }
}
if (set_param_option(opt))
- sync_with_option();
+ sync_with_option();
displayBuffer(Currentbuf, B_FORCE_REDRAW);
}
@@ -3574,7 +3613,8 @@ follow_map(struct parsed_tagarg *arg)
a = retrieveCurrentImg(Currentbuf);
if (a != NULL)
- x = Currentbuf->cursorX - Currentbuf->pos + a->start.pos + Currentbuf->rootX;
+ x = Currentbuf->cursorX - Currentbuf->pos + a->start.pos +
+ Currentbuf->rootX;
else
x = Currentbuf->cursorX + Currentbuf->rootX;
url = follow_map_menu(Currentbuf, arg, x, Currentbuf->cursorY + 2);
@@ -3649,7 +3689,7 @@ svBuf(void)
CurrentKeyData = NULL; /* not allowed in w3m-control: */
file = searchKeyData();
if (file == NULL || *file == '\0') {
- file = inputLineHist("Save buffer to: ", NULL, IN_COMMAND, SaveHist);
+ file = inputLineHist("Save buffer to: ", NULL, IN_COMMAND, SaveHist);
}
if (file != NULL)
file = conv_to_system(file);
@@ -3692,17 +3732,19 @@ svSrc(void)
CurrentKeyData = NULL; /* not allowed in w3m-control: */
PermitSaveToPipe = TRUE;
if (Currentbuf->real_scheme == SCM_LOCAL)
- file = conv_from_system(guess_save_name(NULL,
- Currentbuf->currentURL.real_file));
+ file = conv_from_system(guess_save_name(NULL,
+ Currentbuf->currentURL.
+ real_file));
else
- file = guess_save_name(Currentbuf, Currentbuf->currentURL.file);
+ file = guess_save_name(Currentbuf, Currentbuf->currentURL.file);
doFileCopy(Currentbuf->sourcefile, file);
PermitSaveToPipe = FALSE;
displayBuffer(Currentbuf, B_NORMAL);
}
static void
-_peekURL(int only_img){
+_peekURL(int only_img)
+{
Anchor *a;
ParsedURL pu;
@@ -3717,7 +3759,8 @@ _peekURL(int only_img){
else if (s->length <= offset) /* bug ? */
offset = 0;
goto disp;
- } else {
+ }
+ else {
offset = 0;
}
a = (only_img ? NULL : retrieveCurrentAnchor(Currentbuf));
@@ -3727,7 +3770,7 @@ _peekURL(int only_img){
a = retrieveCurrentForm(Currentbuf);
if (a == NULL)
return;
- s = Strnew_charp(form2str((FormItemList *) a->url));
+ s = Strnew_charp(form2str((FormItemList *)a->url));
goto disp;
}
}
@@ -3736,23 +3779,23 @@ _peekURL(int only_img){
disp:
n = searchKeyNum();
if (n > 1 && s->length > (n - 1) * (COLS - 1))
- disp_message_nomouse(&s->ptr[(n - 1) * (COLS - 1)], TRUE);
+ disp_message_nomouse(&s->ptr[(n - 1) * (COLS - 1)], TRUE);
else
- disp_message_nomouse(&s->ptr[offset], TRUE);
+ disp_message_nomouse(&s->ptr[offset], TRUE);
}
/* peek URL */
void
peekURL(void)
{
- _peekURL(0);
+ _peekURL(0);
}
/* peek URL of image */
void
peekIMG(void)
{
- _peekURL(1);
+ _peekURL(1);
}
/* show current URL */
@@ -3771,21 +3814,22 @@ curURL(void)
static int offset = 0, n;
if (Currentbuf->bufferprop & BP_INTERNAL)
- return;
+ return;
if (CurrentKey == prev_key && s != NULL) {
if (s->length - offset >= COLS)
offset++;
else if (s->length <= offset) /* bug ? */
offset = 0;
- } else {
+ }
+ else {
offset = 0;
s = currentURL();
}
n = searchKeyNum();
if (n > 1 && s->length > (n - 1) * (COLS - 1))
- disp_message_nomouse(&s->ptr[(n - 1) * (COLS - 1)], TRUE);
+ disp_message_nomouse(&s->ptr[(n - 1) * (COLS - 1)], TRUE);
else
- disp_message_nomouse(&s->ptr[offset], TRUE);
+ disp_message_nomouse(&s->ptr[offset], TRUE);
}
/* view HTML source */
@@ -3795,8 +3839,7 @@ vwSrc(void)
char *fn;
Buffer *buf;
- if (Currentbuf->type == NULL ||
- Currentbuf->bufferprop & BP_FRAME)
+ if (Currentbuf->type == NULL || Currentbuf->bufferprop & BP_FRAME)
return;
if ((buf = Currentbuf->linkBuffer[LB_SOURCE]) != NULL ||
(buf = Currentbuf->linkBuffer[LB_N_SOURCE]) != NULL) {
@@ -3819,9 +3862,11 @@ vwSrc(void)
else {
return;
}
- } else if (Currentbuf->real_scheme == SCM_LOCAL) {
+ }
+ else if (Currentbuf->real_scheme == SCM_LOCAL) {
fn = Currentbuf->filename;
- } else {
+ }
+ else {
fn = Currentbuf->sourcefile;
}
if (!strcasecmp(Currentbuf->type, "text/html")) {
@@ -3849,7 +3894,7 @@ vwSrc(void)
else if (!strcasecmp(Currentbuf->type, "text/plain")) {
DefaultType = "text/html";
buf = loadGeneralFile(file_to_url(fn), NULL, NO_REFERER, 0, NULL);
- DefaultType = NULL;
+ DefaultType = NULL;
if (buf == NULL || buf == NO_BUFFER)
return;
if (Currentbuf->real_type &&
@@ -3858,7 +3903,8 @@ vwSrc(void)
else
buf->real_type = Currentbuf->real_type;
if (!strcmp(buf->buffername, conv_from_system(lastFileName(fn))))
- buf->buffername = Sprintf("HTML view of %s", Currentbuf->buffername)->ptr;
+ buf->buffername =
+ Sprintf("HTML view of %s", Currentbuf->buffername)->ptr;
buf->linkBuffer[LB_SOURCE] = Currentbuf;
Currentbuf->linkBuffer[LB_N_SOURCE] = buf;
}
@@ -3898,7 +3944,8 @@ reload(void)
if (Currentbuf->firstLine == NULL) {
top = 1;
linenum = 1;
- } else {
+ }
+ else {
top = Currentbuf->topLine->linenumber;
linenum = Currentbuf->currentLine->linenumber;
}
@@ -3989,7 +4036,8 @@ reload(void)
displayBuffer(Currentbuf, B_FORCE_REDRAW);
return;
}
- Currentbuf->topLine = lineSkip(Currentbuf, Currentbuf->firstLine, top - 1, FALSE);
+ Currentbuf->topLine =
+ lineSkip(Currentbuf, Currentbuf->firstLine, top - 1, FALSE);
gotoLine(Currentbuf, linenum);
Currentbuf->pos = pos;
Currentbuf->currentColumn = currentColumn;
@@ -4001,27 +4049,26 @@ reload(void)
void
chkURL(void)
{
- static char *url_like_pat[] =
- {
- "http://[a-zA-Z0-9][a-zA-Z0-9:%\\-\\./?=~_\\&+@#,\\$]*[a-zA-Z0-9_/]",
+ static char *url_like_pat[] = {
+ "http://[a-zA-Z0-9][a-zA-Z0-9:%\\-\\./?=~_\\&+@#,\\$]*[a-zA-Z0-9_/]",
#ifdef USE_SSL
- "https://[a-zA-Z0-9][a-zA-Z0-9:%\\-\\./?=~_\\&+@#,\\$]*[a-zA-Z0-9_/]",
+ "https://[a-zA-Z0-9][a-zA-Z0-9:%\\-\\./?=~_\\&+@#,\\$]*[a-zA-Z0-9_/]",
#endif /* USE_SSL */
#ifdef USE_GOPHER
"gopher://[a-zA-Z0-9][a-zA-Z0-9:%\\-\\./_]*",
#endif /* USE_GOPHER */
- "ftp://[a-zA-Z0-9][a-zA-Z0-9:%\\-\\./=_+@#,\\$]*[a-zA-Z0-9_/]",
+ "ftp://[a-zA-Z0-9][a-zA-Z0-9:%\\-\\./=_+@#,\\$]*[a-zA-Z0-9_/]",
#ifdef USE_NNTP
"news:[^<> ][^<> ]*",
"nntp://[a-zA-Z0-9][a-zA-Z0-9:%\\-\\./_]*",
#endif /* USE_NNTP */
- "mailto:[^<> ][^<> ]*@[a-zA-Z0-9][a-zA-Z0-9\\-\\._]*[a-zA-Z0-9]",
+ "mailto:[^<> ][^<> ]*@[a-zA-Z0-9][a-zA-Z0-9\\-\\._]*[a-zA-Z0-9]",
#ifdef INET6
- "http://[a-zA-Z0-9:%\\-\\./_@]*\\[[a-fA-F0-9:][a-fA-F0-9:\\.]*\\][a-zA-Z0-9:%\\-\\./?=~_\\&+@#,\\$]*",
+ "http://[a-zA-Z0-9:%\\-\\./_@]*\\[[a-fA-F0-9:][a-fA-F0-9:\\.]*\\][a-zA-Z0-9:%\\-\\./?=~_\\&+@#,\\$]*",
#ifdef USE_SSL
- "https://[a-zA-Z0-9:%\\-\\./_@]*\\[[a-fA-F0-9:][a-fA-F0-9:\\.]*\\][a-zA-Z0-9:%\\-\\./?=~_\\&+@#,\\$]*",
+ "https://[a-zA-Z0-9:%\\-\\./_@]*\\[[a-fA-F0-9:][a-fA-F0-9:\\.]*\\][a-zA-Z0-9:%\\-\\./?=~_\\&+@#,\\$]*",
#endif /* USE_SSL */
- "ftp://[a-zA-Z0-9:%\\-\\./_@]*\\[[a-fA-F0-9:][a-fA-F0-9:\\.]*\\][a-zA-Z0-9:%\\-\\./=_+@#,\\$]*",
+ "ftp://[a-zA-Z0-9:%\\-\\./_@]*\\[[a-fA-F0-9:][a-fA-F0-9:\\.]*\\][a-zA-Z0-9:%\\-\\./=_+@#,\\$]*",
#endif /* INET6 */
NULL
};
@@ -4039,8 +4086,7 @@ chkURL(void)
void
chkNMID(void)
{
- static char *url_like_pat[] =
- {
+ static char *url_like_pat[] = {
"<[^<> ][^<> ]*@[A-z0-9\\.\\-_][A-z0-9\\.\\-_]*>",
NULL,
};
@@ -4114,7 +4160,8 @@ invoke_browser(char *url)
if (browser != NULL)
browser = conv_to_system(browser);
}
- } else {
+ }
+ else {
browser = conv_to_system(browser);
}
if (browser == NULL || *browser == '\0')
@@ -4185,7 +4232,9 @@ curlno()
len = l->width;
}
col = Currentbuf->currentColumn + Currentbuf->cursorX + 1;
- all = (Currentbuf->lastLine ? Currentbuf->lastLine->real_linenumber : Currentbuf->allLine);
+ all =
+ (Currentbuf->lastLine ? Currentbuf->lastLine->
+ real_linenumber : Currentbuf->allLine);
if (all == 0 && Currentbuf->lastLine != NULL)
all = Currentbuf->currentLine->real_linenumber;
if (all == 0)
@@ -4194,7 +4243,7 @@ curlno()
tmp = Sprintf("line %d col %d/%d", cur, col, len);
else
tmp = Sprintf("line %d/%d (%d%%) col %d/%d",
- cur, all, cur * 100 / all, col, len);
+ cur, all, cur * 100 / all, col, len);
#ifdef JP_CHARSET
Strcat_charp(tmp, " ");
Strcat_charp(tmp, code_to_str(Currentbuf->document_code));
@@ -4262,10 +4311,11 @@ process_mouse(int btn, int x, int y)
return;
}
if (y == Currentbuf->cursorY &&
- (x == Currentbuf->cursorX + Currentbuf->rootX
+ (x == Currentbuf->cursorX + Currentbuf->rootX
#ifdef JP_CHARSET
|| (Currentbuf->currentLine != NULL &&
- (Currentbuf->currentLine->propBuf[Currentbuf->pos] & PC_KANJI1)
+ (Currentbuf->currentLine->
+ propBuf[Currentbuf->pos] & PC_KANJI1)
&& x == Currentbuf->cursorX + Currentbuf->rootX + 1)
#endif /* JP_CHARSET */
)) {
@@ -4273,7 +4323,7 @@ process_mouse(int btn, int x, int y)
return;
}
if (x >= Currentbuf->rootX)
- cursorXY(Currentbuf, x - Currentbuf->rootX, y);
+ cursorXY(Currentbuf, x - Currentbuf->rootX, y);
displayBuffer(Currentbuf, B_NORMAL);
}
@@ -4284,33 +4334,36 @@ process_mouse(int btn, int x, int y)
case MOUSE_BTN3_DOWN:
#ifdef USE_MENU
if (x >= Currentbuf->rootX)
- cursorXY(Currentbuf, x - Currentbuf->rootX, y);
+ cursorXY(Currentbuf, x - Currentbuf->rootX, y);
onA();
mainMenu(x, y);
#endif /* USE_MENU */
break;
case MOUSE_BTN4_DOWN_RXVT:
for (i = 0; i < MOUSE_SCROLL_LINE; i++)
- ldown1();
+ ldown1();
break;
case MOUSE_BTN5_DOWN_RXVT:
for (i = 0; i < MOUSE_SCROLL_LINE; i++)
- lup1();
+ lup1();
break;
}
- } else if (btn == MOUSE_BTN4_DOWN_XTERM) {
+ }
+ else if (btn == MOUSE_BTN4_DOWN_XTERM) {
for (i = 0; i < MOUSE_SCROLL_LINE; i++)
- ldown1();
- } else if (btn == MOUSE_BTN5_DOWN_XTERM) {
+ ldown1();
+ }
+ else if (btn == MOUSE_BTN5_DOWN_XTERM) {
for (i = 0; i < MOUSE_SCROLL_LINE; i++)
- lup1();
+ lup1();
}
-
+
if (btn != MOUSE_BTN4_DOWN_RXVT || press_btn == MOUSE_BTN_RESET) {
press_btn = btn;
press_x = x;
press_y = y;
- } else {
+ }
+ else {
press_btn = MOUSE_BTN_RESET;
}
}
@@ -4332,11 +4385,11 @@ mouse()
{
int btn, x, y;
- btn = (unsigned char) getch() - 32;
- x = (unsigned char) getch() - 33;
+ btn = (unsigned char)getch() - 32;
+ x = (unsigned char)getch() - 33;
if (x < 0)
x += 0x100;
- y = (unsigned char) getch() - 33;
+ y = (unsigned char)getch() - 33;
if (y < 0)
y += 0x100;
@@ -4419,7 +4472,7 @@ wrapToggle(void)
}
static char *
-GetWord(Buffer * buf)
+GetWord(Buffer *buf)
{
Line *l = buf->currentLine;
char *lb;
@@ -4435,7 +4488,7 @@ GetWord(Buffer * buf)
if (!IS_ALPHA(lb[e]))
return NULL;
b = e;
- while (b > 0 && IS_ALPHA(lb[b-1]))
+ while (b > 0 && IS_ALPHA(lb[b - 1]))
b--;
while (e < l->len && IS_ALPHA(lb[e]))
e++;
@@ -4508,10 +4561,10 @@ set_buffer_environ(Buffer *buf)
if (buf == NULL)
return;
set_environ("W3M_SOURCEFILE", buf->sourcefile);
- set_environ("W3M_FILENAME",buf->filename);
- set_environ("W3M_CURRENT_WORD",GetWord(buf));
+ set_environ("W3M_FILENAME", buf->filename);
+ set_environ("W3M_CURRENT_WORD", GetWord(buf));
set_environ("W3M_TITLE", buf->buffername);
- set_environ("W3M_URL",parsedURL2Str(&buf->currentURL)->ptr);
+ set_environ("W3M_URL", parsedURL2Str(&buf->currentURL)->ptr);
if (buf->real_type)
set_environ("W3M_TYPE", buf->real_type);
else
@@ -4521,7 +4574,7 @@ set_buffer_environ(Buffer *buf)
#endif /* JP_CHARSET */
a = retrieveCurrentAnchor(buf);
if (a == NULL) {
- set_environ("W3M_CURRENT_LINK","");
+ set_environ("W3M_CURRENT_LINK", "");
}
else {
parseURL2(a->url, &pu, baseURL(buf));
@@ -4530,20 +4583,20 @@ set_buffer_environ(Buffer *buf)
}
a = retrieveCurrentImg(buf);
if (a == NULL) {
- set_environ("W3M_CURRENT_IMG","");
+ set_environ("W3M_CURRENT_IMG", "");
}
else {
parseURL2(a->url, &pu, baseURL(buf));
s = parsedURL2Str(&pu);
- set_environ("W3M_CURRENT_IMG",s->ptr);
+ set_environ("W3M_CURRENT_IMG", s->ptr);
}
a = retrieveCurrentForm(buf);
if (a == NULL) {
- set_environ("W3M_CURRENT_FORM","");
+ set_environ("W3M_CURRENT_FORM", "");
}
else {
- s = Strnew_charp(form2str((FormItemList *) a->url));
- set_environ("W3M_CURRENT_FORM",s->ptr);
+ s = Strnew_charp(form2str((FormItemList *)a->url));
+ set_environ("W3M_CURRENT_FORM", s->ptr);
}
}
@@ -4593,13 +4646,13 @@ deleteFiles()
}
void
-w3m_exit( int i )
+w3m_exit(int i)
{
deleteFiles();
#ifdef USE_SSL
free_ssl_ctx();
#endif
- exit( i );
+ exit(i);
}
#ifdef USE_ALARM
@@ -4607,24 +4660,26 @@ static MySignalHandler
SigAlarm(SIGNAL_ARG)
{
if (alarm_sec > 0) {
- CurrentKey = -1;
- CurrentKeyData = (char *)alarm_event.user_data;
+ CurrentKey = -1;
+ CurrentKeyData = (char *)alarm_event.user_data;
#ifdef USE_MENU
- CurrentMenuData = NULL;
+ CurrentMenuData = NULL;
#endif
- w3mFuncList[alarm_event.cmd].func();
- onA();
- if (alarm_status == AL_IMPLICIT) {
- alarm_buffer = Currentbuf;
- alarm_status = AL_IMPLICIT_DONE;
- } else if (alarm_status == AL_IMPLICIT_DONE && alarm_buffer != Currentbuf) {
- alarm_sec = 0;
- alarm_status = AL_UNSET;
- }
- if (alarm_sec > 0) {
- signal(SIGALRM, SigAlarm);
- alarm(alarm_sec);
- }
+ w3mFuncList[alarm_event.cmd].func();
+ onA();
+ if (alarm_status == AL_IMPLICIT) {
+ alarm_buffer = Currentbuf;
+ alarm_status = AL_IMPLICIT_DONE;
+ }
+ else if (alarm_status == AL_IMPLICIT_DONE
+ && alarm_buffer != Currentbuf) {
+ alarm_sec = 0;
+ alarm_status = AL_UNSET;
+ }
+ if (alarm_sec > 0) {
+ signal(SIGALRM, SigAlarm);
+ alarm(alarm_sec);
+ }
}
SIGNAL_RETURN;
}
@@ -4636,24 +4691,25 @@ setAlarm(void)
int sec = 0, cmd = -1;
extern int w3mNFuncList;
- CurrentKeyData = NULL; /* not allowed in w3m-control: */
+ CurrentKeyData = NULL; /* not allowed in w3m-control: */
data = searchKeyData();
if (data == NULL || *data == '\0') {
- data = inputStrHist("(Alarm)sec command: ", "", TextHist);
- if (data == NULL) {
- displayBuffer(Currentbuf, B_NORMAL);
- return;
- }
+ data = inputStrHist("(Alarm)sec command: ", "", TextHist);
+ if (data == NULL) {
+ displayBuffer(Currentbuf, B_NORMAL);
+ return;
+ }
}
if (*data != '\0') {
- sec = atoi(getWord(&data));
- if (sec > 0)
- cmd = getFuncList(getWord(&data), w3mFuncList, w3mNFuncList);
+ sec = atoi(getWord(&data));
+ if (sec > 0)
+ cmd = getFuncList(getWord(&data), w3mFuncList, w3mNFuncList);
}
if (cmd >= 0) {
setAlarmEvent(sec, AL_EXPLICIT, cmd, getQWord(&data));
- } else {
- alarm_sec = 0;
+ }
+ else {
+ alarm_sec = 0;
}
displayBuffer(Currentbuf, B_NORMAL);
}
@@ -4661,7 +4717,8 @@ setAlarm(void)
void
setAlarmEvent(int sec, short status, int cmd, void *data)
{
- if (status == AL_EXPLICIT || (status == AL_IMPLICIT && alarm_status != AL_EXPLICIT)) {
+ if (status == AL_EXPLICIT
+ || (status == AL_IMPLICIT && alarm_status != AL_EXPLICIT)) {
alarm_sec = sec;
alarm_status = status;
alarm_event.cmd = cmd;
diff --git a/map.c b/map.c
index 70b0eed..5fb02c2 100644
--- a/map.c
+++ b/map.c
@@ -1,4 +1,4 @@
-/* $Id: map.c,v 1.3 2001/11/20 17:49:23 ukai Exp $ */
+/* $Id: map.c,v 1.4 2001/11/24 02:01:26 ukai Exp $ */
/*
* client-side image maps
*/
@@ -6,7 +6,7 @@
#ifdef MENU_MAP
char *
-follow_map_menu(Buffer * buf, struct parsed_tagarg *arg, int x, int y)
+follow_map_menu(Buffer *buf, struct parsed_tagarg *arg, int x, int y)
{
MapList *ml;
char *name;
@@ -25,12 +25,12 @@ follow_map_menu(Buffer * buf, struct parsed_tagarg *arg, int x, int y)
if (ml == NULL)
return NULL;
- for (n = 0, t = ml->urls->first; t != NULL; n++, t = t->next);
+ for (n = 0, t = ml->urls->first; t != NULL; n++, t = t->next) ;
if (n == 0)
return NULL;
label = New_N(char *, n + 1);
for (i = 0, t = ml->urls->first, s = ml->alts->first; t != NULL;
- i++, t = t->next, s = s->next)
+ i++, t = t->next, s = s->next)
label[i] = *s->ptr ? s->ptr : t->ptr;
label[n] = NULL;
@@ -49,7 +49,7 @@ char *map1 = "<HTML><HEAD><TITLE>Image map links</TITLE></HEAD>\
<BODY><H1>Image map links</H1>";
Buffer *
-follow_map_panel(Buffer * buf, struct parsed_tagarg *arg)
+follow_map_panel(Buffer *buf, struct parsed_tagarg *arg)
{
Str mappage;
MapList *ml;
@@ -70,7 +70,7 @@ follow_map_panel(Buffer * buf, struct parsed_tagarg *arg)
mappage = Strnew_charp(map1);
for (t = ml->urls->first, s = ml->alts->first; t != NULL;
- t = t->next, s = s->next) {
+ t = t->next, s = s->next) {
parseURL2(t->ptr, &pu, baseURL(buf));
Strcat_charp(mappage, "<a href=\"");
Strcat_charp(mappage, html_quote(parsedURL2Str(&pu)->ptr));
@@ -134,7 +134,7 @@ append_frame_info(Buffer *buf, Str html, struct frameset *set, int level)
* information of current page and link
*/
Buffer *
-page_info_panel(Buffer * buf)
+page_info_panel(Buffer *buf)
{
Str tmp = Strnew_size(1024);
Anchor *a;
@@ -144,8 +144,10 @@ page_info_panel(Buffer * buf)
struct frameset *f_set = NULL;
int all;
- Strcat_charp(tmp, "<html><head><title>Information about current page</title></head><body>");
- Strcat_charp(tmp, "<h1>Information about current page</h1><table cellpadding=0>");
+ Strcat_charp(tmp,
+ "<html><head><title>Information about current page</title></head><body>");
+ Strcat_charp(tmp,
+ "<h1>Information about current page</h1><table cellpadding=0>");
if (buf == NULL)
goto end;
Strcat_charp(tmp, "<tr><td nowrap>Title<td>");
@@ -191,7 +193,7 @@ page_info_panel(Buffer * buf)
}
a = retrieveCurrentForm(buf);
if (a != NULL) {
- s = Strnew_charp(form2str((FormItemList *) a->url));
+ s = Strnew_charp(form2str((FormItemList *)a->url));
Strcat_charp(tmp, "<tr><td nowrap>Method/type of current form<td>");
Strcat_charp(tmp, html_quote(s->ptr));
}
@@ -207,8 +209,7 @@ page_info_panel(Buffer * buf)
if (buf->frameset != NULL)
f_set = buf->frameset;
else if (buf->bufferprop & BP_FRAME &&
- buf->nextBuffer != NULL &&
- buf->nextBuffer->frameset != NULL)
+ buf->nextBuffer != NULL && buf->nextBuffer->frameset != NULL)
f_set = buf->nextBuffer->frameset;
if (f_set) {
diff --git a/menu.c b/menu.c
index 0018298..586b2f0 100644
--- a/menu.c
+++ b/menu.c
@@ -1,4 +1,4 @@
-/* $Id: menu.c,v 1.5 2001/11/21 19:24:35 ukai Exp $ */
+/* $Id: menu.c,v 1.6 2001/11/24 02:01:26 ukai Exp $ */
/*
* w3m menu.c
*/
@@ -33,8 +33,7 @@ extern int do_getch();
#ifdef USE_MENU
#ifdef KANJI_SYMBOLS
-static char *FRAME[] =
-{
+static char *FRAME[] = {
#ifdef MENU_THIN_FRAME
"┌", "─", "┐",
"│", " ", "│",
@@ -44,28 +43,28 @@ static char *FRAME[] =
"┃", " ", "┃",
"┗", "━", "┛",
#endif /* not MENU_THIN_FRAME */
- ":", ":"};
+ ":", ":"
+};
#define FRAME_WIDTH 2
#define G_start
-/**/
-#define G_end /**/
-
+ /**/
+#define G_end /**/
#else /* not KANJI_SYMBOLS */
-static char *N_FRAME[] =
-{
+static char *N_FRAME[] = {
"+", "-", "+",
"|", " ", "|",
"+", "-", "+",
- ":", ":"};
+ ":", ":"
+};
#define FRAME_WIDTH 1
-static char *G_FRAME[] =
-{
+static char *G_FRAME[] = {
"l", "q", "k",
"x", " ", "x",
"m", "q", "j",
- ":", ":"};
+ ":", ":"
+};
static char **FRAME = NULL;
static int graph_mode = FALSE;
@@ -97,9 +96,10 @@ static int mSrchB(char c);
static int mSrchN(char c);
static int mSrchP(char c);
#ifdef __EMX__
-static int mPc(char c);
+static int mPc(char c);
#endif
+/* *INDENT-OFF* */
static int (*MenuKeymap[128]) (char c) = {
/* C-@ C-a C-b C-c C-d C-e C-f C-g */
#ifdef __EMX__
@@ -266,7 +266,7 @@ static int (*MenuPcKeymap[256])(char c)={
mNull, mNull, mNull, mNull, mNull, mNull, mNull, mNull // 248
};
#endif
-
+/* *INDENT-ON* */
/* --- SelectMenu --- */
static Menu SelectMenu;
@@ -281,9 +281,8 @@ static int smDelBuf(char c);
static Menu MainMenu;
#if LANG == JA
-static MenuItem MainMenuItem[] =
-{
-/* type label variabel value func popup keys data */
+static MenuItem MainMenuItem[] = {
+ /* type label variabel value func popup keys data */
{MENU_FUNC, "戻る (b)", NULL, 0, backBf, NULL, "b", NULL},
{MENU_POPUP, "バッファ選択 (s)", NULL, 0, NULL, &SelectMenu, "s", NULL},
{MENU_FUNC, "ソースを表示 (v)", NULL, 0, vwSrc, NULL, "vV", NULL},
@@ -305,9 +304,8 @@ static MenuItem MainMenuItem[] =
{MENU_END, "", NULL, 0, nulcmd, NULL, "", NULL},
};
#else /* LANG != JA */
-static MenuItem MainMenuItem[] =
-{
-/* type label variable value func popup keys data */
+static MenuItem MainMenuItem[] = {
+ /* type label variable value func popup keys data */
{MENU_FUNC, " Back (b) ", NULL, 0, backBf, NULL, "b", NULL},
{MENU_POPUP, " Select Buffer(s) ", NULL, 0, NULL, &SelectMenu, "s", NULL},
{MENU_FUNC, " View Source (v) ", NULL, 0, vwSrc, NULL, "vV", NULL},
@@ -343,7 +341,7 @@ static Menu *CurrentMenu = NULL;
#define mvaddnstr(y, x, str, n) (move(y, x), addnstr_sup(str, n))
void
-new_menu(Menu * menu, MenuItem * item)
+new_menu(Menu *menu, MenuItem *item)
{
int i, l;
char *p;
@@ -362,7 +360,7 @@ new_menu(Menu * menu, MenuItem * item)
if (item == NULL)
return;
- for (i = 0; item[i].type != MENU_END; i++);
+ for (i = 0; item[i].type != MENU_END; i++) ;
menu->nitem = i;
menu->height = menu->nitem;
for (i = 0; i < 128; i++)
@@ -372,8 +370,8 @@ new_menu(Menu * menu, MenuItem * item)
if ((p = item[i].keys) != NULL) {
while (*p) {
if (IS_ASCII(*p)) {
- menu->keymap[(int) *p] = mSelect;
- menu->keyselect[(int) *p] = i;
+ menu->keymap[(int)*p] = mSelect;
+ menu->keyselect[(int)*p] = i;
}
p++;
}
@@ -385,7 +383,7 @@ new_menu(Menu * menu, MenuItem * item)
}
void
-geom_menu(Menu * menu, int x, int y, int select)
+geom_menu(Menu *menu, int x, int y, int select)
{
int win_x, win_y, win_w, win_h;
@@ -424,7 +422,7 @@ geom_menu(Menu * menu, int x, int y, int select)
}
void
-draw_all_menu(Menu * menu)
+draw_all_menu(Menu *menu)
{
if (menu->parent != NULL)
draw_all_menu(menu->parent);
@@ -432,7 +430,7 @@ draw_all_menu(Menu * menu)
}
void
-draw_menu(Menu * menu)
+draw_menu(Menu *menu)
{
int x, y, w;
int i, j;
@@ -508,14 +506,14 @@ draw_menu(Menu * menu)
}
void
-draw_menu_item(Menu * menu, int select)
+draw_menu_item(Menu *menu, int select)
{
mvaddnstr(menu->y + select - menu->offset, menu->x,
menu->item[select].label, menu->width);
}
int
-select_menu(Menu * menu, int select)
+select_menu(Menu *menu, int select)
{
if (select < 0 || select >= menu->nitem)
return (MENU_NOTHING);
@@ -531,8 +529,8 @@ select_menu(Menu * menu, int select)
standout();
draw_menu_item(menu, menu->select);
standend();
-/*
- * move(menu->cursorY, menu->cursorX); */
+ /*
+ * move(menu->cursorY, menu->cursorX); */
move(menu->y + select - menu->offset, menu->x);
toggle_stand();
refresh();
@@ -541,7 +539,7 @@ select_menu(Menu * menu, int select)
}
void
-goto_menu(Menu * menu, int select, int down)
+goto_menu(Menu *menu, int select, int down)
{
int select_in;
if (select >= menu->nitem)
@@ -551,16 +549,14 @@ goto_menu(Menu * menu, int select, int down)
select_in = select;
while (menu->item[select].type == MENU_NOP) {
if (down > 0) {
- if (++select >= menu->nitem)
- {
+ if (++select >= menu->nitem) {
down_menu(menu, select_in - menu->select);
select = menu->select;
break;
}
}
else if (down < 0) {
- if (--select < 0)
- {
+ if (--select < 0) {
up_menu(menu, menu->select - select_in);
select = menu->select;
break;
@@ -574,7 +570,7 @@ goto_menu(Menu * menu, int select, int down)
}
void
-up_menu(Menu * menu, int n)
+up_menu(Menu *menu, int n)
{
if (n < 0 || menu->offset == 0)
return;
@@ -586,7 +582,7 @@ up_menu(Menu * menu, int n)
}
void
-down_menu(Menu * menu, int n)
+down_menu(Menu *menu, int n)
{
if (n < 0 || menu->offset + menu->height == menu->nitem)
return;
@@ -598,7 +594,7 @@ down_menu(Menu * menu, int n)
}
int
-action_menu(Menu * menu)
+action_menu(Menu *menu)
{
char c;
int select;
@@ -631,7 +627,7 @@ action_menu(Menu * menu)
* defined(USE_SYSMOUSE) */
#endif /* USE_MOUSE */
if (IS_ASCII(c)) { /* Ascii */
- select = (*menu->keymap[(int) c]) (c);
+ select = (*menu->keymap[(int)c]) (c);
if (select != MENU_NOTHING)
break;
}
@@ -662,7 +658,7 @@ action_menu(Menu * menu)
}
void
-popup_menu(Menu * parent, Menu * menu)
+popup_menu(Menu *parent, Menu *menu)
{
int active = 1;
@@ -710,7 +706,7 @@ popup_menu(Menu * parent, Menu * menu)
}
void
-guess_menu_xy(Menu * parent, int width, int *x, int *y)
+guess_menu_xy(Menu *parent, int width, int *x, int *y)
{
*x = parent->x + parent->width + FRAME_WIDTH - 1;
if (*x + width + FRAME_WIDTH > COLS) {
@@ -723,7 +719,7 @@ guess_menu_xy(Menu * parent, int width, int *x, int *y)
}
void
-new_option_menu(Menu * menu, char **label, int *variable, void (*func) ())
+new_option_menu(Menu *menu, char **label, int *variable, void (*func) ())
{
int i, nitem;
char **p;
@@ -732,7 +728,7 @@ new_option_menu(Menu * menu, char **label, int *variable, void (*func) ())
if (label == NULL || *label == NULL)
return;
- for (i = 0, p = label; *p != NULL; i++, p++);
+ for (i = 0, p = label; *p != NULL; i++, p++) ;
nitem = i;
item = New_N(MenuItem, nitem + 1);
@@ -760,8 +756,8 @@ new_option_menu(Menu * menu, char **label, int *variable, void (*func) ())
static int
mPc(char c)
{
- c = getch();
- return(MenuPcKeymap[(int)c](c));
+ c = getch();
+ return (MenuPcKeymap[(int)c] (c));
}
#endif
@@ -769,7 +765,7 @@ static int
mEsc(char c)
{
c = getch();
- return (MenuEscKeymap[(int) c] (c));
+ return (MenuEscKeymap[(int)c] (c));
}
static int
@@ -779,7 +775,7 @@ mEscB(char c)
if (IS_DIGIT(c))
return (mEscD(c));
else
- return (MenuEscBKeymap[(int) c] (c));
+ return (MenuEscBKeymap[(int)c] (c));
}
static int
@@ -787,10 +783,10 @@ mEscD(char c)
{
int d;
- d = (int) c - (int) '0';
+ d = (int)c - (int)'0';
c = getch();
if (IS_DIGIT(c)) {
- d = d * 10 + (int) c - (int) '0';
+ d = d * 10 + (int)c - (int)'0';
c = getch();
}
if (c == '~')
@@ -809,7 +805,7 @@ static int
mSelect(char c)
{
if (IS_ASCII(c))
- return (select_menu(CurrentMenu, CurrentMenu->keyselect[(int) c]));
+ return (select_menu(CurrentMenu, CurrentMenu->keyselect[(int)c]));
else
return (MENU_NOTHING);
}
@@ -875,7 +871,8 @@ mFore(char c)
{
if (CurrentMenu->select >= CurrentMenu->nitem - 1)
return (MENU_NOTHING);
- goto_menu(CurrentMenu, (CurrentMenu->select + CurrentMenu->height - 1), (CurrentMenu->height + 1));
+ goto_menu(CurrentMenu, (CurrentMenu->select + CurrentMenu->height - 1),
+ (CurrentMenu->height + 1));
return (MENU_NOTHING);
}
@@ -884,7 +881,8 @@ mBack(char c)
{
if (CurrentMenu->select <= 0)
return (MENU_NOTHING);
- goto_menu(CurrentMenu, (CurrentMenu->select - CurrentMenu->height + 1), (-1 - CurrentMenu->height));
+ goto_menu(CurrentMenu, (CurrentMenu->select - CurrentMenu->height + 1),
+ (-1 - CurrentMenu->height));
return (MENU_NOTHING);
}
@@ -924,25 +922,25 @@ static char *SearchString = NULL;
int (*menuSearchRoutine) (Menu *, char *, int);
static int
-menuForwardSearch (Menu* menu, char* str, int from)
+menuForwardSearch(Menu *menu, char *str, int from)
{
int i;
- char* p;
- if ((p = regexCompile (str, IgnoreCase)) != NULL) {
- message (p, 0, 0);
+ char *p;
+ if ((p = regexCompile(str, IgnoreCase)) != NULL) {
+ message(p, 0, 0);
return -1;
}
if (from < 0)
- from = 0;
+ from = 0;
for (i = from; i < menu->nitem; i++)
- if (menu->item[i].type != MENU_NOP &&
- regexMatch (menu->item[i].label, 0, 1) == 1)
- return i;
+ if (menu->item[i].type != MENU_NOP &&
+ regexMatch(menu->item[i].label, 0, 1) == 1)
+ return i;
return -1;
}
static int
-menu_search_forward (Menu* menu, int from)
+menu_search_forward(Menu *menu, int from)
{
char *str;
int found;
@@ -950,48 +948,48 @@ menu_search_forward (Menu* menu, int from)
if (str != NULL && *str == '\0')
str = SearchString;
if (str == NULL || *str == '\0')
- return -1;
+ return -1;
SearchString = str;
menuSearchRoutine = menuForwardSearch;
- found = menuForwardSearch (menu, SearchString, from + 1);
+ found = menuForwardSearch(menu, SearchString, from + 1);
if (WrapSearch && found == -1)
- found = menuForwardSearch (menu, SearchString, 0);
+ found = menuForwardSearch(menu, SearchString, 0);
if (found >= 0)
- return found;
+ return found;
disp_message("Not found", TRUE);
return -1;
}
static int
-mSrchF (char c)
+mSrchF(char c)
{
int select;
- select = menu_search_forward (CurrentMenu, CurrentMenu->select);
+ select = menu_search_forward(CurrentMenu, CurrentMenu->select);
if (select >= 0)
- goto_menu (CurrentMenu, select, 1);
+ goto_menu(CurrentMenu, select, 1);
return (MENU_NOTHING);
}
static int
-menuBackwardSearch (Menu* menu, char* str, int from)
+menuBackwardSearch(Menu *menu, char *str, int from)
{
int i;
- char* p;
- if ((p = regexCompile (str, IgnoreCase)) != NULL) {
- message (p, 0, 0);
+ char *p;
+ if ((p = regexCompile(str, IgnoreCase)) != NULL) {
+ message(p, 0, 0);
return -1;
}
if (from >= menu->nitem)
- from = menu->nitem - 1;
+ from = menu->nitem - 1;
for (i = from; i >= 0; i--)
- if (menu->item[i].type != MENU_NOP &&
- regexMatch (menu->item[i].label, 0, 1) == 1)
- return i;
+ if (menu->item[i].type != MENU_NOP &&
+ regexMatch(menu->item[i].label, 0, 1) == 1)
+ return i;
return -1;
}
static int
-menu_search_backward (Menu* menu, int from)
+menu_search_backward(Menu *menu, int from)
{
char *str;
int found;
@@ -1002,37 +1000,35 @@ menu_search_backward (Menu* menu, int from)
return (MENU_NOTHING);
SearchString = str;
menuSearchRoutine = menuBackwardSearch;
- found = menuBackwardSearch (menu, SearchString, from - 1);
+ found = menuBackwardSearch(menu, SearchString, from - 1);
if (WrapSearch && found == -1)
- found = menuBackwardSearch (menu, SearchString, menu->nitem);
+ found = menuBackwardSearch(menu, SearchString, menu->nitem);
if (found >= 0)
- return found;
+ return found;
disp_message("Not found", TRUE);
return -1;
}
static int
-mSrchB (char c)
+mSrchB(char c)
{
int select;
- select = menu_search_backward (CurrentMenu, CurrentMenu->select);
+ select = menu_search_backward(CurrentMenu, CurrentMenu->select);
if (select >= 0)
- goto_menu (CurrentMenu, select, -1);
+ goto_menu(CurrentMenu, select, -1);
return (MENU_NOTHING);
}
static int
-menu_search_next_previous (Menu* menu, int from, int reverse)
+menu_search_next_previous(Menu *menu, int from, int reverse)
{
int found;
- static int (*routine[2]) (Menu *, char *, int) =
- {
- menuForwardSearch, menuBackwardSearch
- };
+ static int (*routine[2]) (Menu *, char *, int) = {
+ menuForwardSearch, menuBackwardSearch};
if (menuSearchRoutine == NULL) {
- disp_message ("No previous regular expression", TRUE);
- return -1;
+ disp_message("No previous regular expression", TRUE);
+ return -1;
}
if (reverse != 0)
reverse = 1;
@@ -1041,30 +1037,31 @@ menu_search_next_previous (Menu* menu, int from, int reverse)
from += reverse ? -1 : 1;
found = (*routine[reverse]) (menu, SearchString, from);
if (WrapSearch && found == -1)
- found = (*routine[reverse]) (menu, SearchString, reverse * menu->nitem);
+ found =
+ (*routine[reverse]) (menu, SearchString, reverse * menu->nitem);
if (found >= 0)
- return found;
+ return found;
disp_message("Not found", TRUE);
return -1;
}
static int
-mSrchN (char c)
+mSrchN(char c)
{
int select;
- select = menu_search_next_previous (CurrentMenu, CurrentMenu->select, 0);
+ select = menu_search_next_previous(CurrentMenu, CurrentMenu->select, 0);
if (select >= 0)
- goto_menu (CurrentMenu, select, 1);
+ goto_menu(CurrentMenu, select, 1);
return (MENU_NOTHING);
}
static int
-mSrchP (char c)
+mSrchP(char c)
{
int select;
- select = menu_search_next_previous (CurrentMenu, CurrentMenu->select, 1);
+ select = menu_search_next_previous(CurrentMenu, CurrentMenu->select, 1);
if (select >= 0)
- goto_menu (CurrentMenu, select, -1);
+ goto_menu(CurrentMenu, select, -1);
return (MENU_NOTHING);
}
@@ -1094,12 +1091,10 @@ process_mMouse(int btn, int x, int y)
return (MENU_NOTHING);
if (btn == MOUSE_BTN_UP) {
- if (press_btn == MOUSE_BTN1_DOWN ||
- press_btn == MOUSE_BTN3_DOWN) {
+ if (press_btn == MOUSE_BTN1_DOWN || press_btn == MOUSE_BTN3_DOWN) {
if (x < menu->x - FRAME_WIDTH ||
x >= menu->x + menu->width + FRAME_WIDTH ||
- y < menu->y - 1 ||
- y >= menu->y + menu->height + 1) {
+ y < menu->y - 1 || y >= menu->y + menu->height + 1) {
return (MENU_CANCEL);
}
else if ((x >= menu->x - FRAME_WIDTH &&
@@ -1137,11 +1132,11 @@ mMouse(char c)
{
int btn, x, y;
- btn = (unsigned char) getch() - 32;
- x = (unsigned char) getch() - 33;
+ btn = (unsigned char)getch() - 32;
+ x = (unsigned char)getch() - 33;
if (x < 0)
x += 0x100;
- y = (unsigned char) getch() - 33;
+ y = (unsigned char)getch() - 33;
if (y < 0)
y += 0x100;
@@ -1247,7 +1242,8 @@ mainMn(void)
return;
menu = w3mMenuList[n].menu;
}
- popupMenu(Currentbuf->cursorX + Currentbuf->rootX, Currentbuf->cursorY, menu);
+ popupMenu(Currentbuf->cursorX + Currentbuf->rootX, Currentbuf->cursorY,
+ menu);
}
/* --- MainMenu (END) --- */
@@ -1285,7 +1281,8 @@ initSelectMenu(void)
case SCM_LOCAL_CGI:
if (strcmp(buf->currentURL.file, "-")) {
Strcat_char(str, ' ');
- Strcat_charp(str, conv_from_system(buf->currentURL.real_file));
+ Strcat_charp(str,
+ conv_from_system(buf->currentURL.real_file));
}
break;
case SCM_UNKNOWN:
@@ -1332,7 +1329,7 @@ smChBuf(void)
if (SelectV < 0 || SelectV >= SelectMenu.nitem)
return;
- for (i = 0, buf = Firstbuf; i < SelectV; i++, buf = buf->nextBuffer);
+ for (i = 0, buf = Firstbuf; i < SelectV; i++, buf = buf->nextBuffer) ;
Currentbuf = buf;
if (clear_buffer) {
for (buf = Firstbuf; buf != NULL; buf = buf->nextBuffer)
@@ -1341,13 +1338,15 @@ smChBuf(void)
}
static int
-smDelBuf(char c) {
+smDelBuf(char c)
+{
int i, x, y, select;
Buffer *buf;
if (CurrentMenu->select < 0 || CurrentMenu->select >= SelectMenu.nitem)
return (MENU_NOTHING);
- for (i = 0, buf = Firstbuf; i < CurrentMenu->select; i++, buf = buf->nextBuffer);
+ for (i = 0, buf = Firstbuf; i < CurrentMenu->select;
+ i++, buf = buf->nextBuffer) ;
if (Currentbuf == buf)
Currentbuf = buf->nextBuffer;
Firstbuf = deleteBuffer(Firstbuf, buf);
@@ -1383,7 +1382,8 @@ smDelBuf(char c) {
/* --- OptionMenu --- */
void
-optionMenu(int x, int y, char **label, int *variable, int initial, void (*func) ())
+optionMenu(int x, int y, char **label, int *variable, int initial,
+ void (*func) ())
{
Menu menu;
@@ -1477,7 +1477,7 @@ initMenu(void)
}
int
-setMenuItem(MenuItem * item, char *type, char *line)
+setMenuItem(MenuItem *item, char *type, char *line)
{
char *label, *func, *popup, *keys, *data;
int f;
@@ -1527,12 +1527,12 @@ setMenuItem(MenuItem * item, char *type, char *line)
}
int
-addMenuList(MenuList ** mlist, char *id)
+addMenuList(MenuList **mlist, char *id)
{
int n;
MenuList *list = *mlist;
- for (n = 0; list->id != NULL; list++, n++);
+ for (n = 0; list->id != NULL; list++, n++) ;
*mlist = New_Reuse(MenuList, *mlist, (n + 2));
list = *mlist + n;
list->id = id;
@@ -1543,7 +1543,7 @@ addMenuList(MenuList ** mlist, char *id)
}
int
-getMenuN(MenuList * list, char *id)
+getMenuN(MenuList *list, char *id)
{
int n;
diff --git a/mimehead.c b/mimehead.c
index a197a06..3fc044c 100644
--- a/mimehead.c
+++ b/mimehead.c
@@ -1,4 +1,4 @@
-/* $Id: mimehead.c,v 1.3 2001/11/20 17:49:23 ukai Exp $ */
+/* $Id: mimehead.c,v 1.4 2001/11/24 02:01:26 ukai Exp $ */
/*
* MIME header support by Akinori ITO
*/
@@ -19,7 +19,7 @@
#define BAD_BASE64 255
static
-unsigned char
+ unsigned char
c2e(char x)
{
if ('A' <= x && x <= 'Z')
@@ -36,7 +36,7 @@ c2e(char x)
}
static
-int
+ int
ha2d(char x, char y)
{
int r = 0;
@@ -129,7 +129,8 @@ decodeU(char **ww)
if (i == 6) {
w += 2;
i = 2;
- } else {
+ }
+ else {
w++;
i += 2;
}
@@ -204,7 +205,7 @@ decodeWord(char **ow)
for (; *w != '?'; w++) {
if (*w == '\0')
goto convert_fail;
- Strcat_char(charset,*w);
+ Strcat_char(charset, *w);
}
if (Strcasecmp_charp(charset, J_CHARSET) != 0) {
/* NOT ISO-2022-JP encoding ... don't convert */
@@ -285,7 +286,8 @@ decodeMIME(char *orgstr)
/* encoding */
-static char Base64Table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
+static char Base64Table[] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
Str
encodeB(char *a)
diff --git a/mktable.c b/mktable.c
index ab9f6ef..bb40ec0 100644
--- a/mktable.c
+++ b/mktable.c
@@ -1,4 +1,4 @@
-/* $Id: mktable.c,v 1.2 2001/11/20 17:49:23 ukai Exp $ */
+/* $Id: mktable.c,v 1.3 2001/11/24 02:01:26 ukai Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
@@ -10,15 +10,14 @@
defhash(HashItem_ss *, int, hss_i)
#define keycomp(x,y) ((x)==(y))
-
- static unsigned int hashfunc(HashItem_ss * x)
+ static unsigned int hashfunc(HashItem_ss * x)
{
- return (unsigned int) x;
+ return (unsigned int)x;
}
defhashfunc(HashItem_ss *, int, hss_i)
- int
- MAIN(int argc, char *argv[], char **envp)
+ int
+ MAIN(int argc, char *argv[], char **envp)
{
FILE *f;
Hash_ss *hash;
@@ -91,20 +90,21 @@ defhashfunc(HashItem_ss *, int, hss_i)
printf("static HashItem_si MyHashItem[] = {\n");
for (i = 0; i < j; i++) {
printf(" /* %d */ {\"%s\",%s,", i,
- hashitems[i]->key,
- hashitems[i]->value);
+ hashitems[i]->key, hashitems[i]->value);
if (hashitems[i]->next == NULL) {
printf("NULL},\n");
}
else {
- printf("&MyHashItem[%d]},\n", getHash_hss_i(rhash, hashitems[i]->next, -1));
+ printf("&MyHashItem[%d]},\n",
+ getHash_hss_i(rhash, hashitems[i]->next, -1));
}
}
printf("};\n\nstatic HashItem_si *MyHashItemTbl[] = {\n");
for (i = 0; i < hash->size; i++) {
if (hash->tab[i])
- printf(" &MyHashItem[%d],\n", getHash_hss_i(rhash, hash->tab[i], -1));
+ printf(" &MyHashItem[%d],\n",
+ getHash_hss_i(rhash, hash->tab[i], -1));
else
printf(" NULL,\n");
}
diff --git a/myctype.c b/myctype.c
index 7173e6f..4bb18ff 100644
--- a/myctype.c
+++ b/myctype.c
@@ -1,51 +1,50 @@
-/* $Id: myctype.c,v 1.3 2001/11/20 17:49:23 ukai Exp $ */
-unsigned char MYCTYPE_MAP[ 0x100 ] = {
-/* NUL SOH STX ETX EOT ENQ ACK BEL BS HT LF VT FF CR SO SI */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 1, 1,
-/* DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-/* SPC ! " # $ % & ' ( ) * + , - . / */
- 18, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
-/* 0 1 2 3 4 5 6 7 8 9 : ; < = > ? */
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 16, 16, 16, 16, 16, 16,
-/* @ A B C D E F G H I J K L M N O */
- 16, 52, 52, 52, 52, 52, 52, 20, 20, 20, 20, 20, 20, 20, 20, 20,
-/* P Q R S T U V W X Y Z [ \ ] ^ _ */
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 16, 16, 16, 16, 16,
-/* ` a b c d e f g h i j k l m n o */
- 16, 52, 52, 52, 52, 52, 52, 20, 20, 20, 20, 20, 20, 20, 20, 20,
-/* p q r s t u v w x y z { | } ~ DEL */
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 16, 16, 16, 16, 1,
+/* $Id: myctype.c,v 1.4 2001/11/24 02:01:26 ukai Exp $ */
+unsigned char MYCTYPE_MAP[0x100] = {
+ /* NUL SOH STX ETX EOT ENQ ACK BEL BS HT LF VT FF CR SO SI */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 1, 1,
+ /* DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US */
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ /* SPC ! " # $ % & ' ( ) * + , - . / */
+ 18, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ /* 0 1 2 3 4 5 6 7 8 9 : ; < = > ? */
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 16, 16, 16, 16, 16, 16,
+ /* @ A B C D E F G H I J K L M N O */
+ 16, 52, 52, 52, 52, 52, 52, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ /* P Q R S T U V W X Y Z [ \ ] ^ _ */
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 16, 16, 16, 16, 16,
+ /* ` a b c d e f g h i j k l m n o */
+ 16, 52, 52, 52, 52, 52, 52, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ /* p q r s t u v w x y z { | } ~ DEL */
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 16, 16, 16, 16, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
-unsigned char INTCTYPE_MAP[ 0x100 ] = {
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+unsigned char INTCTYPE_MAP[0x100] = {
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 6, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
- 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
- 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
- 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
- 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
- 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 4,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 6, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 4,
};
-
diff --git a/parsetagx.c b/parsetagx.c
index a299ff5..fcb3c10 100644
--- a/parsetagx.c
+++ b/parsetagx.c
@@ -1,4 +1,4 @@
-/* $Id: parsetagx.c,v 1.4 2001/11/20 17:49:23 ukai Exp $ */
+/* $Id: parsetagx.c,v 1.5 2001/11/24 02:01:26 ukai Exp $ */
#include "fm.h"
#include "myctype.h"
#include "indep.h"
@@ -16,6 +16,7 @@ static int toLength(char *, int *);
static int toAlign(char *, int *);
static int toVAlign(char *, int *);
+/* *INDENT-OFF* */
static int (*toValFunc[]) () = {
noConv, /* VTYPE_NONE */
noConv, /* VTYPE_STR */
@@ -29,6 +30,7 @@ static int (*toValFunc[]) () = {
noConv, /* VTYPE_MLENGTH */
noConv, /* VTYPE_TYPE */
};
+/* *INDENT-ON* */
static int
noConv(char *oval, char **str)
@@ -79,8 +81,7 @@ toAlign(char *oval, int *align)
static int
toVAlign(char *oval, int *valign)
{
- if (strcasecmp(oval, "top") == 0 ||
- strcasecmp(oval, "baseline") == 0)
+ if (strcasecmp(oval, "top") == 0 || strcasecmp(oval, "baseline") == 0)
*valign = VALIGN_TOP;
else if (strcasecmp(oval, "bottom") == 0)
*valign = VALIGN_BOTTOM;
@@ -110,8 +111,7 @@ parse_tag(char **s, int internal)
*(p++) = *(q++);
SKIP_BLANKS(q);
}
- while (*q && !IS_SPACE(*q) && *q != '>' &&
- p - tagname < MAX_TAG_LEN - 1) {
+ while (*q && !IS_SPACE(*q) && *q != '>' && p - tagname < MAX_TAG_LEN - 1) {
*(p++) = tolower(*(q++));
}
*p = '\0';
@@ -211,10 +211,10 @@ parse_tag(char **s, int internal)
}
}
- skip_parse_tagarg:
+ skip_parse_tagarg:
while (*q != '>' && *q)
- q++;
- done_parse_tag:
+ q++;
+ done_parse_tag:
if (*q == '>')
q++;
*s = q;
@@ -243,10 +243,9 @@ int
parsedtag_get_value(struct parsed_tag *tag, int id, void *value)
{
int i;
- if (!parsedtag_exists(tag, id) ||
- !tag->value[i = tag->map[id]])
+ if (!parsedtag_exists(tag, id) || !tag->value[i = tag->map[id]])
return 0;
- return toValFunc[AttrMAP[id].vtype](tag->value[i], value);
+ return toValFunc[AttrMAP[id].vtype] (tag->value[i], value);
}
Str
@@ -263,8 +262,7 @@ parsedtag2str(struct parsed_tag *tag)
Strcat_char(tagstr, ' ');
Strcat_charp(tagstr, AttrMAP[tag->attrid[i]].name);
if (tag->value[i])
- Strcat(tagstr,
- Sprintf("=\"%s\"", html_quote(tag->value[i])));
+ Strcat(tagstr, Sprintf("=\"%s\"", html_quote(tag->value[i])));
}
}
Strcat_char(tagstr, '>');
diff --git a/parsetagx.h b/parsetagx.h
index 4383c6b..ce4ae47 100644
--- a/parsetagx.h
+++ b/parsetagx.h
@@ -1,4 +1,4 @@
-/* $Id: parsetagx.h,v 1.3 2001/11/20 17:49:23 ukai Exp $ */
+/* $Id: parsetagx.h,v 1.4 2001/11/24 02:01:26 ukai Exp $ */
#ifndef PARSETAGX_H
#define PARSETAGX_H
@@ -8,11 +8,11 @@
/* Parsed Tag structure */
struct parsed_tag {
- unsigned char tagid;
- unsigned char *attrid;
- char **value;
- unsigned char *map;
- char need_reconstruct;
+ unsigned char tagid;
+ unsigned char *attrid;
+ char **value;
+ unsigned char *map;
+ char need_reconstruct;
};
#define parsedtag_accepts(tag, id) ((tag)->map&&(tag)->map[id]!=MAX_TAGATTR)
diff --git a/proto.h b/proto.h
index 9fc35f1..0c36b31 100644
--- a/proto.h
+++ b/proto.h
@@ -1,4 +1,4 @@
-/* $Id: proto.h,v 1.7 2001/11/23 19:00:47 ukai Exp $ */
+/* $Id: proto.h,v 1.8 2001/11/24 02:01:26 ukai Exp $ */
/*
* This file was automatically generated by version 1.7 of cextract.
* Manual editing not recommended.
@@ -104,19 +104,24 @@ extern void setAlarmEvent(int sec, short status, int cmd, void *data);
#else
#define setAlarm nulcmd
#endif
-extern int currentLn(Buffer * buf);
-extern void tmpClearBuffer(Buffer * buf);
+extern int currentLn(Buffer *buf);
+extern void tmpClearBuffer(Buffer *buf);
extern char *filename_extension(char *patch, int is_url);
extern void examineFile(char *path, URLFile *uf);
extern int dir_exist(char *path);
-extern Str convertLine(URLFile * uf, Str line, char *code, int mode);
+extern Str convertLine(URLFile *uf, Str line, char *code, int mode);
extern Buffer *loadFile(char *path);
-extern Buffer *loadGeneralFile(char *path, ParsedURL * current, char *referer, int flag, FormList * request);
+extern Buffer *loadGeneralFile(char *path, ParsedURL *current, char *referer,
+ int flag, FormList *request);
extern int is_boundary(int, int);
extern int is_blank_line(char *line, int indent);
-extern void push_render_image(Str str, int width, int limit, struct html_feed_environ *h_env);
-extern void flushline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent, int force, int width);
-extern void do_blankline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent, int indent_incr, int width);
+extern void push_render_image(Str str, int width, int limit,
+ struct html_feed_environ *h_env);
+extern void flushline(struct html_feed_environ *h_env, struct readbuffer *obuf,
+ int indent, int force, int width);
+extern void do_blankline(struct html_feed_environ *h_env,
+ struct readbuffer *obuf, int indent, int indent_incr,
+ int width);
extern void purgeline(struct html_feed_environ *h_env);
extern void save_fonteffect(struct html_feed_environ *h_env,
struct readbuffer *obuf);
@@ -134,30 +139,35 @@ extern Str process_n_textarea(void);
extern void feed_textarea(char *str);
extern Str process_form(struct parsed_tag *tag);
extern Str process_n_form(void);
-extern int HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env);
-extern void HTMLlineproc2(Buffer * buf, TextLineList * tl);
-extern void HTMLlineproc0(char *istr, struct html_feed_environ *h_env, int internal);
+extern int HTMLtagproc1(struct parsed_tag *tag,
+ struct html_feed_environ *h_env);
+extern void HTMLlineproc2(Buffer *buf, TextLineList *tl);
+extern void HTMLlineproc0(char *istr, struct html_feed_environ *h_env,
+ int internal);
#define HTMLlineproc1(x,y) HTMLlineproc0(x,y,TRUE)
-extern Buffer *loadHTMLBuffer(URLFile * f, Buffer * newBuf);
+extern Buffer *loadHTMLBuffer(URLFile *f, Buffer *newBuf);
extern void showProgress(int *linelen, int *trbyte);
extern void init_henv(struct html_feed_environ *, struct readbuffer *,
struct environment *, int, TextLineList *, int, int);
-extern void completeHTMLstream(struct html_feed_environ *, struct readbuffer *);
-extern void loadHTMLstream(URLFile * f, Buffer * newBuf, FILE * src, int internal);
+extern void completeHTMLstream(struct html_feed_environ *,
+ struct readbuffer *);
+extern void loadHTMLstream(URLFile *f, Buffer *newBuf, FILE * src,
+ int internal);
extern Buffer *loadHTMLString(Str page);
#ifdef USE_GOPHER
-extern Buffer *loadGopherDir(URLFile * uf, Buffer * newBuf);
+extern Buffer *loadGopherDir(URLFile *uf, Buffer *newBuf);
#endif /* USE_GOPHER */
-extern Buffer *loadBuffer(URLFile * uf, Buffer * newBuf);
-extern void saveBuffer(Buffer * buf, FILE * f);
-extern void saveBufferDelNum(Buffer * buf, FILE * f, int del);
+extern Buffer *loadBuffer(URLFile *uf, Buffer *newBuf);
+extern void saveBuffer(Buffer *buf, FILE * f);
+extern void saveBufferDelNum(Buffer *buf, FILE * f, int del);
extern Buffer *getshell(char *cmd);
extern Buffer *getpipe(char *cmd);
-extern Buffer *openPagerBuffer(InputStream stream, Buffer * buf);
+extern Buffer *openPagerBuffer(InputStream stream, Buffer *buf);
extern Buffer *openGeneralPagerBuffer(InputStream stream);
-extern Line *getNextPage(Buffer * buf, int plen);
+extern Line *getNextPage(Buffer *buf, int plen);
extern int save2tmp(URLFile uf, char *tmpf);
-extern int doExternal(URLFile uf, char *path, char *type, Buffer **bufp, Buffer *defaultbuf);
+extern int doExternal(URLFile uf, char *path, char *type, Buffer **bufp,
+ Buffer *defaultbuf);
extern void doFileCopy(char *tmpf, char *defstr);
extern void doFileMove(char *tmpf, char *defstr);
extern void doFileSave(URLFile uf, char *defstr);
@@ -165,30 +175,31 @@ extern int checkCopyFile(char *path1, char *path2);
extern int checkSaveFile(InputStream stream, char *path);
extern int checkOverWrite(char *path);
extern int matchattr(char *p, char *attr, int len, Str *value);
-extern char *checkHeader(Buffer * buf, char *field);
+extern char *checkHeader(Buffer *buf, char *field);
extern Buffer *newBuffer(int width);
extern Buffer *nullBuffer(void);
-extern void clearBuffer(Buffer * buf);
-extern void discardBuffer(Buffer * buf);
-extern Buffer *namedBuffer(Buffer * first, char *name);
-extern Buffer *deleteBuffer(Buffer * first, Buffer * delbuf);
-extern Buffer *replaceBuffer(Buffer * first, Buffer * delbuf, Buffer * newbuf);
-extern Buffer *nthBuffer(Buffer * firstbuf, int n);
-extern void gotoRealLine(Buffer * buf, int n);
-extern void gotoLine(Buffer * buf, int n);
-extern Buffer *selectBuffer(Buffer * firstbuf, Buffer * currentbuf, char *selectchar);
-extern void reshapeBuffer(Buffer * buf);
-extern void copyBuffer(Buffer * a, Buffer * b);
-extern Buffer *prevBuffer(Buffer * first, Buffer * buf);
+extern void clearBuffer(Buffer *buf);
+extern void discardBuffer(Buffer *buf);
+extern Buffer *namedBuffer(Buffer *first, char *name);
+extern Buffer *deleteBuffer(Buffer *first, Buffer *delbuf);
+extern Buffer *replaceBuffer(Buffer *first, Buffer *delbuf, Buffer *newbuf);
+extern Buffer *nthBuffer(Buffer *firstbuf, int n);
+extern void gotoRealLine(Buffer *buf, int n);
+extern void gotoLine(Buffer *buf, int n);
+extern Buffer *selectBuffer(Buffer *firstbuf, Buffer *currentbuf,
+ char *selectchar);
+extern void reshapeBuffer(Buffer *buf);
+extern void copyBuffer(Buffer *a, Buffer *b);
+extern Buffer *prevBuffer(Buffer *first, Buffer *buf);
extern int writeBufferCache(Buffer *buf);
extern int readBufferCache(Buffer *buf);
extern void fmTerm(void);
extern void fmInit(void);
-extern void displayBuffer(Buffer * buf, int mode);
-extern void redrawBuffer(Buffer * buf);
-extern void redrawNLine(Buffer * buf, int n);
-extern Line *redrawLine(Buffer * buf, Line * l, int i);
-extern int redrawLineRegion(Buffer * buf, Line * l, int i, int bpos, int epos);
+extern void displayBuffer(Buffer *buf, int mode);
+extern void redrawBuffer(Buffer *buf);
+extern void redrawNLine(Buffer *buf, int n);
+extern Line *redrawLine(Buffer *buf, Line *l, int i);
+extern int redrawLineRegion(Buffer *buf, Line *l, int i, int bpos, int epos);
extern void do_effects(Lineprop m);
#ifdef USE_ANSI_COLOR
extern void do_color(Linecolor c);
@@ -199,48 +210,50 @@ extern void record_err_message(char *s);
extern Buffer *message_list_panel(void);
extern void message(char *s, int return_x, int return_y);
#define disp_err_message(s, f) (record_err_message((s)), disp_message((s), (f)))
-extern void disp_message_nsec(char *s, int redraw_current, int sec, int purge, int mouse);
+extern void disp_message_nsec(char *s, int redraw_current, int sec, int purge,
+ int mouse);
extern void disp_message(char *s, int redraw_current);
#ifdef USE_MOUSE
extern void disp_message_nomouse(char *s, int redraw_current);
#else
#define disp_message_nomouse disp_message
#endif
-extern void cursorUp(Buffer * buf, int n);
-extern void cursorDown(Buffer * buf, int n);
-extern void cursorUpDown(Buffer * buf, int n);
-extern void cursorRight(Buffer * buf, int n);
-extern void cursorLeft(Buffer * buf, int n);
-extern void cursorHome(Buffer * buf);
-extern void arrangeCursor(Buffer * buf);
-extern void arrangeLine(Buffer * buf);
-extern void cursorXY(Buffer * buf, int x, int y);
+extern void cursorUp(Buffer *buf, int n);
+extern void cursorDown(Buffer *buf, int n);
+extern void cursorUpDown(Buffer *buf, int n);
+extern void cursorRight(Buffer *buf, int n);
+extern void cursorLeft(Buffer *buf, int n);
+extern void cursorHome(Buffer *buf);
+extern void arrangeCursor(Buffer *buf);
+extern void arrangeLine(Buffer *buf);
+extern void cursorXY(Buffer *buf, int x, int y);
extern int arg_is(char *str, char *tag);
-extern int columnSkip(Buffer * buf, int offset);
-extern int columnPos(Line * line, int column);
-extern Line *lineSkip(Buffer * buf, Line * line, int offset, int last);
-extern Line *currentLineSkip(Buffer * buf, Line * line, int offset, int last);
+extern int columnSkip(Buffer *buf, int offset);
+extern int columnPos(Line *line, int column);
+extern Line *lineSkip(Buffer *buf, Line *line, int offset, int last);
+extern Line *currentLineSkip(Buffer *buf, Line *line, int offset, int last);
extern int gethtmlcmd(char **s, int *status);
extern char *getAnchor(char *arg, char **arg_return);
-extern Str checkType(Str s, Lineprop * oprop,
+extern Str checkType(Str s, Lineprop *oprop,
#ifdef USE_ANSI_COLOR
- Linecolor * ocolor, int * check_color,
+ Linecolor *ocolor, int *check_color,
#endif
int len);
-extern int calcPosition(char *l, Lineprop *pr, int len, int pos, int bpos, int mode);
+extern int calcPosition(char *l, Lineprop *pr, int len, int pos, int bpos,
+ int mode);
extern char *lastFileName(char *path);
extern char *mybasename(char *s);
extern char *mydirname(char *s);
extern int next_status(char c, int *status);
extern int read_token(Str buf, char **instr, int *status, int pre, int append);
extern Str correct_irrtag(int status);
-extern int forwardSearch(Buffer * buf, char *str);
-extern int backwardSearch(Buffer * buf, char *str);
-extern void pcmap ( void );
+extern int forwardSearch(Buffer *buf, char *str);
+extern int backwardSearch(Buffer *buf, char *str);
+extern void pcmap(void);
extern void escmap(void);
extern void escbmap(void);
extern void escdmap(char c);
-extern char *inputLineHist(char *prompt, char *def_str, int flag, Hist * hist);
+extern char *inputLineHist(char *prompt, char *def_str, int flag, Hist *hist);
#ifdef USE_HISTORY
extern Buffer *historyBuffer(Hist *hist);
extern void loadHistory(Hist *hist);
@@ -257,44 +270,56 @@ extern void align(TextLine *lbuf, int width, int mode);
extern void print_item(struct table *t, int row, int col, int width, Str buf);
extern void print_sep(struct table *t, int row, int type, int maxcol, Str buf);
extern void do_refill(struct table *tbl, int row, int col, int maxlimit);
-extern void renderTable(struct table *t, int max_width, struct html_feed_environ *h_env);
-extern struct table *begin_table(int border, int spacing, int padding, int vspace);
-extern void end_table(struct table * tbl);
+extern void renderTable(struct table *t, int max_width,
+ struct html_feed_environ *h_env);
+extern struct table *begin_table(int border, int spacing, int padding,
+ int vspace);
+extern void end_table(struct table *tbl);
extern void check_rowcol(struct table *tbl, struct table_mode *mode);
extern int minimum_length(char *line);
-extern int feed_table(struct table *tbl, char *line, struct table_mode *mode, int width, int internal);
-extern void feed_table1(struct table *tbl, Str tok, struct table_mode *mode, int width);
+extern int feed_table(struct table *tbl, char *line, struct table_mode *mode,
+ int width, int internal);
+extern void feed_table1(struct table *tbl, Str tok, struct table_mode *mode,
+ int width);
extern void pushTable(struct table *, struct table *);
-extern struct form_list *newFormList(char *action, char *method, char *charset, char *enctype, char *target, char *name, struct form_list *_next);
-extern struct form_item_list *formList_addInput(struct form_list *fl, struct parsed_tag *tag);
-extern char *form2str(FormItemList * fi);
+extern struct form_list *newFormList(char *action, char *method, char *charset,
+ char *enctype, char *target, char *name,
+ struct form_list *_next);
+extern struct form_item_list *formList_addInput(struct form_list *fl,
+ struct parsed_tag *tag);
+extern char *form2str(FormItemList *fi);
extern int formtype(char *typestr);
-extern void formRecheckRadio(Anchor * a, Buffer * buf, FormItemList * form);
-extern void formResetBuffer(Buffer * buf, AnchorList * formitem);
-extern void formUpdateBuffer(Anchor * a, Buffer * buf, FormItemList * form);
+extern void formRecheckRadio(Anchor *a, Buffer *buf, FormItemList *form);
+extern void formResetBuffer(Buffer *buf, AnchorList *formitem);
+extern void formUpdateBuffer(Anchor *a, Buffer *buf, FormItemList *form);
extern Str textfieldrep(Str s, int width);
-extern void input_textarea(FormItemList * fi);
+extern void input_textarea(FormItemList *fi);
extern void do_internal(char *action, char *data);
extern void form_write_data(FILE * f, char *boundary, char *name, char *value);
-extern void form_write_from_file(FILE * f, char *boundary, char *name, char *filename, char *file);
+extern void form_write_from_file(FILE * f, char *boundary, char *name,
+ char *filename, char *file);
extern void follow_map(struct parsed_tagarg *arg);
#ifdef MENU_MAP
-extern char *follow_map_menu(Buffer * buf, struct parsed_tagarg *arg, int x, int y);
+extern char *follow_map_menu(Buffer *buf, struct parsed_tagarg *arg, int x,
+ int y);
#else
-extern Buffer *follow_map_panel(Buffer * buf, struct parsed_tagarg *arg);
+extern Buffer *follow_map_panel(Buffer *buf, struct parsed_tagarg *arg);
#endif
-extern Buffer *page_info_panel(Buffer * buf);
+extern Buffer *page_info_panel(Buffer *buf);
extern struct frame_body *newFrame(struct parsed_tag *tag, Buffer *buf);
extern struct frameset *newFrameSet(struct parsed_tag *tag);
-extern void addFrameSetElement(struct frameset *f, union frameset_element element);
+extern void addFrameSetElement(struct frameset *f,
+ union frameset_element element);
extern void deleteFrame(struct frame_body *b);
extern void deleteFrameSet(struct frameset *f);
extern void deleteFrameSetElement(union frameset_element e);
extern struct frameset *copyFrameSet(struct frameset *of);
-extern void pushFrameTree(struct frameset_queue **fqpp, struct frameset *fs, Buffer *buf);
+extern void pushFrameTree(struct frameset_queue **fqpp, struct frameset *fs,
+ Buffer *buf);
extern struct frameset *popFrameTree(struct frameset_queue **fqpp);
-extern void resetFrameElement(union frameset_element *f_element, Buffer * buf, char *referer, FormList * request);
-extern Buffer *renderFrame(Buffer * Cbuf, int force_reload);
+extern void resetFrameElement(union frameset_element *f_element, Buffer *buf,
+ char *referer, FormList *request);
+extern Buffer *renderFrame(Buffer *Cbuf, int force_reload);
extern union frameset_element *search_frame(struct frameset *fset, char *name);
extern int set_tty(void);
extern void set_cc(int spec, int val);
@@ -367,17 +392,21 @@ extern char *code_to_str(char code);
extern void put_sjis(Str os, unsigned char ub, unsigned char lb);
#endif /* JP_CHARSET */
extern void free_ssl_ctx();
-extern ParsedURL *baseURL(Buffer * buf);
-extern int openSocket(char *hostname, char *remoteport_name, unsigned short remoteport_num);
-extern void parseURL(char *url, ParsedURL * p_url, ParsedURL * current);
-extern void copyParsedURL(ParsedURL * p, ParsedURL * q);
-extern void parseURL2(char *url, ParsedURL * pu, ParsedURL * current);
-extern Str parsedURL2Str(ParsedURL * pu);
+extern ParsedURL *baseURL(Buffer *buf);
+extern int openSocket(char *hostname, char *remoteport_name,
+ unsigned short remoteport_num);
+extern void parseURL(char *url, ParsedURL *p_url, ParsedURL *current);
+extern void copyParsedURL(ParsedURL *p, ParsedURL *q);
+extern void parseURL2(char *url, ParsedURL *pu, ParsedURL *current);
+extern Str parsedURL2Str(ParsedURL *pu);
extern int getURLScheme(char **url);
extern void init_stream(URLFile *uf, int scheme, InputStream stream);
-extern URLFile openURL(char *url, ParsedURL * pu, ParsedURL * current, URLOption * option, FormList * request, TextList * extra_header, URLFile * ouf, unsigned char *status);
+extern URLFile openURL(char *url, ParsedURL *pu, ParsedURL *current,
+ URLOption *option, FormList *request,
+ TextList *extra_header, URLFile *ouf,
+ unsigned char *status);
extern char *guessContentType(char *filename);
-extern TextList* make_domain_list(char *domain_list);
+extern TextList *make_domain_list(char *domain_list);
extern int check_no_proxy(char *domain);
extern char *filename_extension(char *path, int is_url);
extern int mailcapMatch(struct mailcap *mcap, char *type);
@@ -385,33 +414,38 @@ extern struct mailcap *loadMailcap(char *filename);
extern struct mailcap *searchMailcap(struct mailcap *table, char *type);
extern void initMailcap();
extern struct mailcap *searchExtViewer(char *type);
-extern Str unquote_mailcap(char *qstr, char *type, char *name, char *attr, int *stat);
+extern Str unquote_mailcap(char *qstr, char *type, char *name, char *attr,
+ int *stat);
extern char *guessContentType(char *filename);
extern TextList *make_domain_list(char *domain_list);
extern int check_no_proxy(char *domain);
-extern FILE *openFTP(ParsedURL * pu);
+extern FILE *openFTP(ParsedURL *pu);
extern void closeFTP(FILE * f);
extern int Ftpfclose(FILE * f);
-extern AnchorList * putAnchor(AnchorList * al, char *url, char *target, Anchor ** anchor_return, char *referer, int line, int pos);
-extern Anchor *registerHref(Buffer * buf, char *url, char *target, char *referer, int line, int pos);
-extern Anchor *registerName(Buffer * buf, char *url, int line, int pos);
-extern Anchor *registerImg(Buffer * buf, char *url, int line, int pos);
-extern Anchor *registerForm(Buffer * buf, FormList * flist, struct parsed_tag *tag, int line, int pos);
-extern int onAnchor(Anchor * a, int line, int pos);
-extern Anchor *retrieveAnchor(AnchorList * al, int line, int pos);
-extern Anchor *retrieveCurrentAnchor(Buffer * buf);
-extern Anchor *retrieveCurrentImg(Buffer * buf);
-extern Anchor *retrieveCurrentForm(Buffer * buf);
-extern Anchor *searchAnchor(AnchorList * al, char *str);
-extern Anchor *searchURLLabel(Buffer * buf, char *url);
-extern char *reAnchor(Buffer * buf, char *re);
+extern AnchorList *putAnchor(AnchorList *al, char *url, char *target,
+ Anchor **anchor_return, char *referer, int line,
+ int pos);
+extern Anchor *registerHref(Buffer *buf, char *url, char *target,
+ char *referer, int line, int pos);
+extern Anchor *registerName(Buffer *buf, char *url, int line, int pos);
+extern Anchor *registerImg(Buffer *buf, char *url, int line, int pos);
+extern Anchor *registerForm(Buffer *buf, FormList *flist,
+ struct parsed_tag *tag, int line, int pos);
+extern int onAnchor(Anchor *a, int line, int pos);
+extern Anchor *retrieveAnchor(AnchorList *al, int line, int pos);
+extern Anchor *retrieveCurrentAnchor(Buffer *buf);
+extern Anchor *retrieveCurrentImg(Buffer *buf);
+extern Anchor *retrieveCurrentForm(Buffer *buf);
+extern Anchor *searchAnchor(AnchorList *al, char *str);
+extern Anchor *searchURLLabel(Buffer *buf, char *url);
+extern char *reAnchor(Buffer *buf, char *re);
#ifdef USE_NNTP
-extern char *reAnchorNews(Buffer * buf, char *re);
+extern char *reAnchorNews(Buffer *buf, char *re);
#endif /* USE_NNTP */
extern void addMultirowsForm(Buffer *buf, AnchorList *al);
-extern Anchor *closest_next_anchor(AnchorList * a, Anchor * an, int x, int y);
-extern Anchor *closest_prev_anchor(AnchorList * a, Anchor * an, int x, int y);
-extern HmarkerList *putHmarker(HmarkerList * ml, int line, int pos, int seq);
+extern Anchor *closest_next_anchor(AnchorList *a, Anchor *an, int x, int y);
+extern Anchor *closest_prev_anchor(AnchorList *a, Anchor *an, int x, int y);
+extern HmarkerList *putHmarker(HmarkerList *ml, int line, int pos, int seq);
extern Str decodeB(char **ww);
extern Str decodeQ(char **ww);
extern Str decodeQP(char **ww);
@@ -432,11 +466,11 @@ extern char *helpFile(char *base);
extern void setLocalCookie(void);
extern Buffer *dirBuffer(char *dirname);
extern void set_environ(char *var, char *value);
-extern FILE *localcgi_post(char *, char *, FormList *, char*);
-extern FILE *localcgi_get(char *, char *, char*);
+extern FILE *localcgi_post(char *, char *, FormList *, char *);
+extern FILE *localcgi_get(char *, char *, char *);
extern Str find_auth_cookie(char *host, char *realm);
extern void add_auth_cookie(char *host, char *realm, Str cookie);
-extern char *last_modified(Buffer * buf);
+extern char *last_modified(Buffer *buf);
extern Str romanNumeral(int n);
extern Str romanAlphabet(int n);
extern void mySystem(char *command, int background);
@@ -446,9 +480,9 @@ extern Str tmpfname(int type, char *ext);
#ifdef USE_COOKIE
extern time_t mymktime(char *timestr);
extern char *FQDN(char *host);
-extern Str find_cookie(ParsedURL * pu);
-extern int add_cookie(ParsedURL * pu, Str name, Str value, time_t expires,
- Str domain, Str path, int flag, Str comment, int version,
+extern Str find_cookie(ParsedURL *pu);
+extern int add_cookie(ParsedURL *pu, Str name, Str value, time_t expires,
+ Str domain, Str path, int flag, Str comment, int version,
Str port, Str commentURL);
extern void save_cookies(void);
extern void load_cookies(void);
@@ -488,8 +522,8 @@ extern void msToggle(void);
extern char *searchKeyData(void);
extern void initKeymap(void);
-extern int countFuncList(FuncList * list);
-extern int getFuncList(char *id, FuncList * list, int nlist);
+extern int countFuncList(FuncList *list);
+extern int getFuncList(char *id, FuncList *list, int nlist);
extern int getKey(char *s);
extern void addKeyList(KeyList *list, int key, char *data);
extern KeyListItem *searchKeyList(KeyList *list, int key);
@@ -497,29 +531,31 @@ extern char *getWord(char **str);
extern char *getQWord(char **str);
#ifdef USE_MENU
-extern void new_menu(Menu * menu, MenuItem * item);
-extern void geom_menu(Menu * menu, int x, int y, int select);
-extern void draw_all_menu(Menu * menu);
-extern void draw_menu(Menu * menu);
-extern void draw_menu_item(Menu * menu, int select);
-extern int select_menu(Menu * menu, int select);
-extern void goto_menu(Menu * menu, int select, int down);
-extern void up_menu(Menu * menu, int n);
-extern void down_menu(Menu * menu, int n);
-extern int action_menu(Menu * menu);
-extern void popup_menu(Menu * parent, Menu * menu);
-extern void guess_menu_xy(Menu * menu, int width, int *x, int *y);
-extern void new_option_menu(Menu * menu, char **label, int *variable, void (*func) ());
+extern void new_menu(Menu *menu, MenuItem *item);
+extern void geom_menu(Menu *menu, int x, int y, int select);
+extern void draw_all_menu(Menu *menu);
+extern void draw_menu(Menu *menu);
+extern void draw_menu_item(Menu *menu, int select);
+extern int select_menu(Menu *menu, int select);
+extern void goto_menu(Menu *menu, int select, int down);
+extern void up_menu(Menu *menu, int n);
+extern void down_menu(Menu *menu, int n);
+extern int action_menu(Menu *menu);
+extern void popup_menu(Menu *parent, Menu *menu);
+extern void guess_menu_xy(Menu *menu, int width, int *x, int *y);
+extern void new_option_menu(Menu *menu, char **label, int *variable,
+ void (*func) ());
-extern int setMenuItem(MenuItem * item, char *type, char *line);
-extern int addMenuList(MenuList ** list, char *id);
-extern int getMenuN(MenuList * list, char *id);
+extern int setMenuItem(MenuItem *item, char *type, char *line);
+extern int addMenuList(MenuList **list, char *id);
+extern int getMenuN(MenuList *list, char *id);
extern void popupMenu(int x, int y, Menu *menu);
extern void mainMenu(int x, int y);
extern void mainMn(void);
extern void selMn(void);
-extern void optionMenu(int x, int y, char **label, int *variable, int initial, void (*func) ());
+extern void optionMenu(int x, int y, char **label, int *variable, int initial,
+ void (*func) ());
extern void initMenu(void);
#else /* not USE_MENU */
#define mainMn nulcmd
@@ -534,13 +570,13 @@ extern void dictwordat(void);
#define dictwordat nulcmd
#endif /* not USE_DICT */
-extern void reloadBuffer(Buffer * buf);
+extern void reloadBuffer(Buffer *buf);
extern char *guess_save_name(Buffer *buf, char *file);
extern void wrapToggle(void);
extern void saveBufferInfo(void);
-extern char*get_os2_dft(const char*,char*);
+extern char *get_os2_dft(const char *, char *);
extern void dispVer(void);
diff --git a/rc.c b/rc.c
index 45e3588..4d5dad6 100644
--- a/rc.c
+++ b/rc.c
@@ -1,4 +1,4 @@
-/* $Id: rc.c,v 1.13 2001/11/23 22:07:45 ukai Exp $ */
+/* $Id: rc.c,v 1.14 2001/11/24 02:01:26 ukai Exp $ */
/*
* Initialization file etc.
*/
@@ -287,10 +287,9 @@ struct sel_c {
};
#ifdef JP_CHARSET
-static struct sel_c kcodestr[] =
-{
- {CODE_EUC, "E", STR_EUC},
- {CODE_SJIS, "S", STR_SJIS},
+static struct sel_c kcodestr[] = {
+ {CODE_EUC, "E", STR_EUC},
+ {CODE_SJIS, "S", STR_SJIS},
{CODE_JIS_j, "j", STR_JIS_j},
{CODE_JIS_N, "N", STR_JIS_N},
{CODE_JIS_m, "m", STR_JIS_m},
@@ -298,26 +297,23 @@ static struct sel_c kcodestr[] =
{0, NULL, NULL}
};
-static struct sel_c dcodestr[] =
-{
- {'\0', "0", "auto detect"},
- {CODE_EUC, "E", STR_EUC},
- {CODE_SJIS, "S", STR_SJIS},
+static struct sel_c dcodestr[] = {
+ {'\0', "0", "auto detect"},
+ {CODE_EUC, "E", STR_EUC},
+ {CODE_SJIS, "S", STR_SJIS},
{CODE_INNER_EUC, "I", STR_INNER_EUC},
{0, NULL, NULL}
};
-static struct sel_c scodestr[] =
-{
- {CODE_EUC, "E", STR_EUC},
- {CODE_SJIS, "S", STR_SJIS},
+static struct sel_c scodestr[] = {
+ {CODE_EUC, "E", STR_EUC},
+ {CODE_SJIS, "S", STR_SJIS},
{0, NULL, NULL}
};
#endif /* JP_CHARSET */
#ifdef USE_COLOR
-static struct sel_c colorstr[] =
-{
+static struct sel_c colorstr[] = {
#if LANG == JA
{0, "black", "黒"},
{1, "red", "赤"},
@@ -345,8 +341,7 @@ static struct sel_c colorstr[] =
#endif /* USE_COLOR */
#ifdef INET6
-static struct sel_c dnsorders[] =
-{
+static struct sel_c dnsorders[] = {
{0, "0", "unspec"},
{1, "1", "inet inet6"},
{2, "2", "inet6 inet"},
@@ -356,178 +351,223 @@ static struct sel_c dnsorders[] =
#ifdef USE_COOKIE
static struct sel_c badcookiestr[] = {
- {0, "0", "discard"},
+ {0, "0", "discard"},
#if 0
- {1, "1", "accept"},
+ {1, "1", "accept"},
#endif
- {2, "2", "ask"},
- {0, NULL, NULL}
+ {2, "2", "ask"},
+ {0, NULL, NULL}
};
#endif /* USE_COOKIE */
-struct param_ptr params1[] =
-{
- {"tabstop", P_NZINT, PI_TEXT, (void *) &Tabstop, CMT_TABSTOP, NULL},
- {"pixel_per_char", P_PIXELS, PI_TEXT, (void *) &pixel_per_char, CMT_PIXEL_PER_CHAR, NULL},
+struct param_ptr params1[] = {
+ {"tabstop", P_NZINT, PI_TEXT, (void *)&Tabstop, CMT_TABSTOP, NULL},
+ {"pixel_per_char", P_PIXELS, PI_TEXT, (void *)&pixel_per_char,
+ CMT_PIXEL_PER_CHAR, NULL},
#ifdef JP_CHARSET
- {"kanjicode", P_CODE, PI_SEL_C, (void *) &DisplayCode, CMT_KANJICODE, kcodestr},
- {"document_code", P_CODE, PI_SEL_C, (void *) &DocumentCode, CMT_DOCUMENTCODE, dcodestr},
- {"system_code", P_CODE, PI_SEL_C, (void *) &SystemCode, CMT_SYSTEMCODE, scodestr},
+ {"kanjicode", P_CODE, PI_SEL_C, (void *)&DisplayCode, CMT_KANJICODE,
+ kcodestr},
+ {"document_code", P_CODE, PI_SEL_C, (void *)&DocumentCode,
+ CMT_DOCUMENTCODE, dcodestr},
+ {"system_code", P_CODE, PI_SEL_C, (void *)&SystemCode, CMT_SYSTEMCODE,
+ scodestr},
#endif /* JP_CHARSET */
- {"frame", P_CHARINT, PI_ONOFF, (void *) &RenderFrame, CMT_FRAME, NULL},
- {"target_self", P_CHARINT, PI_ONOFF, (void *) &TargetSelf, CMT_TSELF, NULL},
- {"display_link", P_INT, PI_ONOFF, (void *) &displayLink, CMT_DISPLINK, NULL},
- {"ext_dirlist", P_INT, PI_ONOFF, (void *) &UseExternalDirBuffer, CMT_EXT_DIRLIST, NULL},
- {"dirlist_cmd", P_STRING, PI_TEXT, (void *) &DirBufferCommand, CMT_DIRLIST_CMD, NULL},
- {"multicol", P_INT, PI_ONOFF, (void *) &multicolList, CMT_MULTICOL, NULL},
- {"alt_entity", P_CHARINT, PI_ONOFF, (void *) &UseAltEntity, CMT_ALT_ENTITY, NULL},
- {"ignore_null_img_alt", P_INT, PI_ONOFF, (void *) &ignore_null_img_alt, CMT_IGNORE_NULL_IMG_ALT, NULL},
+ {"frame", P_CHARINT, PI_ONOFF, (void *)&RenderFrame, CMT_FRAME, NULL},
+ {"target_self", P_CHARINT, PI_ONOFF, (void *)&TargetSelf, CMT_TSELF, NULL},
+ {"display_link", P_INT, PI_ONOFF, (void *)&displayLink, CMT_DISPLINK,
+ NULL},
+ {"ext_dirlist", P_INT, PI_ONOFF, (void *)&UseExternalDirBuffer,
+ CMT_EXT_DIRLIST, NULL},
+ {"dirlist_cmd", P_STRING, PI_TEXT, (void *)&DirBufferCommand,
+ CMT_DIRLIST_CMD, NULL},
+ {"multicol", P_INT, PI_ONOFF, (void *)&multicolList, CMT_MULTICOL, NULL},
+ {"alt_entity", P_CHARINT, PI_ONOFF, (void *)&UseAltEntity, CMT_ALT_ENTITY,
+ NULL},
+ {"ignore_null_img_alt", P_INT, PI_ONOFF, (void *)&ignore_null_img_alt,
+ CMT_IGNORE_NULL_IMG_ALT, NULL},
#ifdef VIEW_UNSEENOBJECTS
- {"view_unseenobject", P_INT, PI_ONOFF, (void *) &view_unseenobject, CMT_VIEW_UNSEENOBJECTS, NULL},
+ {"view_unseenobject", P_INT, PI_ONOFF, (void *)&view_unseenobject,
+ CMT_VIEW_UNSEENOBJECTS, NULL},
#endif /* VIEW_UNSEENOBJECTS */
- {"show_lnum", P_INT, PI_ONOFF, (void *) &showLineNum, CMT_SHOW_NUM, NULL},
+ {"show_lnum", P_INT, PI_ONOFF, (void *)&showLineNum, CMT_SHOW_NUM, NULL},
{NULL, 0, 0, NULL, NULL, NULL},
};
#ifdef USE_COLOR
-struct param_ptr params2[] =
-{
- {"color", P_INT, PI_ONOFF, (void *) &useColor, CMT_COLOR, NULL},
- {"basic_color", P_COLOR, PI_SEL_C, (void *) &basic_color, CMT_B_COLOR, colorstr},
- {"anchor_color", P_COLOR, PI_SEL_C, (void *) &anchor_color, CMT_A_COLOR, colorstr},
- {"image_color", P_COLOR, PI_SEL_C, (void *) &image_color, CMT_I_COLOR, colorstr},
- {"form_color", P_COLOR, PI_SEL_C, (void *) &form_color, CMT_F_COLOR, colorstr},
+struct param_ptr params2[] = {
+ {"color", P_INT, PI_ONOFF, (void *)&useColor, CMT_COLOR, NULL},
+ {"basic_color", P_COLOR, PI_SEL_C, (void *)&basic_color, CMT_B_COLOR,
+ colorstr},
+ {"anchor_color", P_COLOR, PI_SEL_C, (void *)&anchor_color, CMT_A_COLOR,
+ colorstr},
+ {"image_color", P_COLOR, PI_SEL_C, (void *)&image_color, CMT_I_COLOR,
+ colorstr},
+ {"form_color", P_COLOR, PI_SEL_C, (void *)&form_color, CMT_F_COLOR,
+ colorstr},
#ifdef USE_BG_COLOR
- {"bg_color", P_COLOR, PI_SEL_C, (void *) &bg_color, CMT_BG_COLOR, colorstr},
+ {"bg_color", P_COLOR, PI_SEL_C, (void *)&bg_color, CMT_BG_COLOR, colorstr},
#endif /* USE_BG_COLOR */
- {"active_style", P_INT, PI_ONOFF, (void *) &useActiveColor, CMT_ACTIVE_STYLE, NULL},
- {"active_color", P_COLOR, PI_SEL_C, (void *) &active_color, CMT_C_COLOR, colorstr},
- {"visited_anchor", P_INT, PI_ONOFF, (void *) &useVisitedColor, CMT_VISITED_ANCHOR, NULL},
- {"visited_color", P_COLOR, PI_SEL_C, (void *) &visited_color, CMT_V_COLOR, colorstr},
+ {"active_style", P_INT, PI_ONOFF, (void *)&useActiveColor,
+ CMT_ACTIVE_STYLE, NULL},
+ {"active_color", P_COLOR, PI_SEL_C, (void *)&active_color, CMT_C_COLOR,
+ colorstr},
+ {"visited_anchor", P_INT, PI_ONOFF, (void *)&useVisitedColor,
+ CMT_VISITED_ANCHOR, NULL},
+ {"visited_color", P_COLOR, PI_SEL_C, (void *)&visited_color, CMT_V_COLOR,
+ colorstr},
{NULL, 0, 0, NULL, NULL, NULL},
};
#endif /* USE_COLOR */
-struct param_ptr params3[] =
-{
- {"pagerline", P_NZINT, PI_TEXT, (void *) &PagerMax, CMT_PAGERLINE, NULL},
+struct param_ptr params3[] = {
+ {"pagerline", P_NZINT, PI_TEXT, (void *)&PagerMax, CMT_PAGERLINE, NULL},
#ifdef USE_HISTORY
- {"history", P_INT, PI_TEXT, (void *) &URLHistSize, CMT_HISTSIZE, NULL},
- {"save_hist", P_INT, PI_ONOFF, (void *) &SaveURLHist, CMT_SAVEHIST, NULL},
+ {"history", P_INT, PI_TEXT, (void *)&URLHistSize, CMT_HISTSIZE, NULL},
+ {"save_hist", P_INT, PI_ONOFF, (void *)&SaveURLHist, CMT_SAVEHIST, NULL},
#endif /* USE_HISTORY */
- {"confirm_qq", P_INT, PI_ONOFF, (void *) &confirm_on_quit, CMT_CONFIRM_QQ, NULL},
+ {"confirm_qq", P_INT, PI_ONOFF, (void *)&confirm_on_quit, CMT_CONFIRM_QQ,
+ NULL},
#ifdef USE_MARK
- {"mark", P_INT, PI_ONOFF, (void *) &use_mark, CMT_USE_MARK, NULL },
+ {"mark", P_INT, PI_ONOFF, (void *)&use_mark, CMT_USE_MARK, NULL},
#endif
#ifdef EMACS_LIKE_LINEEDIT
- {"emacs_like_lineedit", P_INT, PI_ONOFF, (void *) &emacs_like_lineedit, CMT_EMACS_LIKE_LINEEDIT, NULL },
+ {"emacs_like_lineedit", P_INT, PI_ONOFF, (void *)&emacs_like_lineedit,
+ CMT_EMACS_LIKE_LINEEDIT, NULL},
#endif
#ifdef VI_PREC_NUM
- {"vi_prec_num", P_INT, PI_ONOFF, (void *) &vi_prec_num, CMT_VI_PREC_NUM, NULL },
+ {"vi_prec_num", P_INT, PI_ONOFF, (void *)&vi_prec_num, CMT_VI_PREC_NUM,
+ NULL},
#endif
#ifdef LABEL_TOPLINE
- {"label_topline", P_INT, PI_ONOFF, (void *) &label_topline, CMT_LABEL_TOPLINE, NULL },
+ {"label_topline", P_INT, PI_ONOFF, (void *)&label_topline,
+ CMT_LABEL_TOPLINE, NULL},
#endif
#ifdef NEXTPAGE_TOPLINE
- {"nextpage_topline", P_INT, PI_ONOFF, (void *) &nextpage_topline, CMT_NEXTPAGE_TOPLINE, NULL },
+ {"nextpage_topline", P_INT, PI_ONOFF, (void *)&nextpage_topline,
+ CMT_NEXTPAGE_TOPLINE, NULL},
#endif
- {"wrap_search", P_INT, PI_ONOFF, (void *) &WrapDefault, CMT_WRAP, NULL},
- {"ignorecase_search", P_INT, PI_ONOFF, (void *) &IgnoreCase, CMT_IGNORE_CASE, NULL},
+ {"wrap_search", P_INT, PI_ONOFF, (void *)&WrapDefault, CMT_WRAP, NULL},
+ {"ignorecase_search", P_INT, PI_ONOFF, (void *)&IgnoreCase,
+ CMT_IGNORE_CASE, NULL},
#ifdef USE_MOUSE
- {"use_mouse", P_INT, PI_ONOFF, (void *) &use_mouse, CMT_MOUSE, NULL},
- {"reverse_mouse", P_INT, PI_ONOFF, (void *) &reverse_mouse, CMT_REVERSE_MOUSE, NULL},
+ {"use_mouse", P_INT, PI_ONOFF, (void *)&use_mouse, CMT_MOUSE, NULL},
+ {"reverse_mouse", P_INT, PI_ONOFF, (void *)&reverse_mouse,
+ CMT_REVERSE_MOUSE, NULL},
#endif /* USE_MOUSE */
- {"clear_buffer", P_INT, PI_ONOFF, (void *) &clear_buffer, CMT_CLEAR_BUF, NULL},
- {"decode_cte", P_CHARINT, PI_ONOFF, (void *) &DecodeCTE, CMT_DECODE_CTE, NULL},
+ {"clear_buffer", P_INT, PI_ONOFF, (void *)&clear_buffer, CMT_CLEAR_BUF,
+ NULL},
+ {"decode_cte", P_CHARINT, PI_ONOFF, (void *)&DecodeCTE, CMT_DECODE_CTE,
+ NULL},
{NULL, 0, 0, NULL, NULL, NULL},
};
-struct param_ptr params4[] =
-{
- {"http_proxy", P_STRING, PI_TEXT, (void *) &HTTP_proxy, CMT_HTTP_PROXY, NULL},
+struct param_ptr params4[] = {
+ {"http_proxy", P_STRING, PI_TEXT, (void *)&HTTP_proxy, CMT_HTTP_PROXY,
+ NULL},
#ifdef USE_GOPHER
- {"gopher_proxy", P_STRING, PI_TEXT, (void *) &GOPHER_proxy, CMT_GOPHER_PROXY, NULL},
+ {"gopher_proxy", P_STRING, PI_TEXT, (void *)&GOPHER_proxy,
+ CMT_GOPHER_PROXY, NULL},
#endif /* USE_GOPHER */
- {"ftp_proxy", P_STRING, PI_TEXT, (void *) &FTP_proxy, CMT_FTP_PROXY, NULL},
- {"no_proxy", P_STRING, PI_TEXT, (void *) &NO_proxy, CMT_NO_PROXY, NULL},
- {"noproxy_netaddr", P_INT, PI_ONOFF, (void *) &NOproxy_netaddr, CMT_NOPROXY_NETADDR, NULL},
- {"no_cache", P_CHARINT, PI_ONOFF, (void *) &NoCache, CMT_NO_CACHE, NULL},
+ {"ftp_proxy", P_STRING, PI_TEXT, (void *)&FTP_proxy, CMT_FTP_PROXY, NULL},
+ {"no_proxy", P_STRING, PI_TEXT, (void *)&NO_proxy, CMT_NO_PROXY, NULL},
+ {"noproxy_netaddr", P_INT, PI_ONOFF, (void *)&NOproxy_netaddr,
+ CMT_NOPROXY_NETADDR, NULL},
+ {"no_cache", P_CHARINT, PI_ONOFF, (void *)&NoCache, CMT_NO_CACHE, NULL},
{NULL, 0, 0, NULL, NULL, NULL},
};
-struct param_ptr params5[] =
-{
- {"document_root", P_STRING, PI_TEXT, (void *) &document_root, CMT_DROOT, NULL},
- {"personal_document_root", P_STRING, PI_TEXT, (void *) &personal_document_root, CMT_PDROOT, NULL},
- {"cgi_bin", P_STRING, PI_TEXT, (void *) &cgi_bin, CMT_CGIBIN, NULL},
-{"index_file", P_STRING, PI_TEXT, (void *) &index_file, CMT_IFILE, NULL},
+struct param_ptr params5[] = {
+ {"document_root", P_STRING, PI_TEXT, (void *)&document_root, CMT_DROOT,
+ NULL},
+ {"personal_document_root", P_STRING, PI_TEXT,
+ (void *)&personal_document_root, CMT_PDROOT, NULL},
+ {"cgi_bin", P_STRING, PI_TEXT, (void *)&cgi_bin, CMT_CGIBIN, NULL},
+ {"index_file", P_STRING, PI_TEXT, (void *)&index_file, CMT_IFILE, NULL},
{NULL, 0, 0, NULL, NULL, NULL},
};
-struct param_ptr params6[] =
-{
- {"mime_types", P_STRING, PI_TEXT, (void *) &mimetypes_files, CMT_MIMETYPES, NULL},
- {"mailcap", P_STRING, PI_TEXT, (void *) &mailcap_files, CMT_MAILCAP, NULL},
- {"editor", P_STRING, PI_TEXT, (void *) &Editor, CMT_EDITOR, NULL},
- {"mailer", P_STRING, PI_TEXT, (void *) &Mailer, CMT_MAILER, NULL},
-{"extbrowser", P_STRING, PI_TEXT, (void *) &ExtBrowser, CMT_EXTBRZ, NULL},
- {"extbrowser2", P_STRING, PI_TEXT, (void *) &ExtBrowser2, CMT_EXTBRZ2, NULL},
- {"extbrowser3", P_STRING, PI_TEXT, (void *) &ExtBrowser3, CMT_EXTBRZ3, NULL},
- {"bgextviewer", P_INT, PI_ONOFF, (void *) &BackgroundExtViewer, CMT_BGEXTVIEW, NULL},
- {"use_lessopen", P_INT, PI_ONOFF, (void *) &use_lessopen, CMT_USE_LESSOPEN, NULL},
+struct param_ptr params6[] = {
+ {"mime_types", P_STRING, PI_TEXT, (void *)&mimetypes_files, CMT_MIMETYPES,
+ NULL},
+ {"mailcap", P_STRING, PI_TEXT, (void *)&mailcap_files, CMT_MAILCAP, NULL},
+ {"editor", P_STRING, PI_TEXT, (void *)&Editor, CMT_EDITOR, NULL},
+ {"mailer", P_STRING, PI_TEXT, (void *)&Mailer, CMT_MAILER, NULL},
+ {"extbrowser", P_STRING, PI_TEXT, (void *)&ExtBrowser, CMT_EXTBRZ, NULL},
+ {"extbrowser2", P_STRING, PI_TEXT, (void *)&ExtBrowser2, CMT_EXTBRZ2,
+ NULL},
+ {"extbrowser3", P_STRING, PI_TEXT, (void *)&ExtBrowser3, CMT_EXTBRZ3,
+ NULL},
+ {"bgextviewer", P_INT, PI_ONOFF, (void *)&BackgroundExtViewer,
+ CMT_BGEXTVIEW, NULL},
+ {"use_lessopen", P_INT, PI_ONOFF, (void *)&use_lessopen, CMT_USE_LESSOPEN,
+ NULL},
{NULL, 0, 0, NULL, NULL, NULL},
};
#if defined(USE_SSL) && defined(USE_SSL_VERIFY)
-struct param_ptr params7[] =
-{
- {"ssl_verify_server", P_INT, PI_ONOFF, (void *) &ssl_verify_server, CMT_SSL_VERIFY_SERVER, NULL},
- {"ssl_cert_file", P_SSLPATH, PI_TEXT, (void *) &ssl_cert_file, CMT_SSL_CERT_FILE, NULL},
- {"ssl_key_file", P_SSLPATH, PI_TEXT, (void *) &ssl_key_file, CMT_SSL_KEY_FILE, NULL},
- {"ssl_ca_path", P_SSLPATH, PI_TEXT, (void *) &ssl_ca_path, CMT_SSL_CA_PATH, NULL},
- {"ssl_ca_file", P_SSLPATH, PI_TEXT, (void *) &ssl_ca_file, CMT_SSL_CA_FILE, NULL},
+struct param_ptr params7[] = {
+ {"ssl_verify_server", P_INT, PI_ONOFF, (void *)&ssl_verify_server,
+ CMT_SSL_VERIFY_SERVER, NULL},
+ {"ssl_cert_file", P_SSLPATH, PI_TEXT, (void *)&ssl_cert_file,
+ CMT_SSL_CERT_FILE, NULL},
+ {"ssl_key_file", P_SSLPATH, PI_TEXT, (void *)&ssl_key_file,
+ CMT_SSL_KEY_FILE, NULL},
+ {"ssl_ca_path", P_SSLPATH, PI_TEXT, (void *)&ssl_ca_path, CMT_SSL_CA_PATH,
+ NULL},
+ {"ssl_ca_file", P_SSLPATH, PI_TEXT, (void *)&ssl_ca_file, CMT_SSL_CA_FILE,
+ NULL},
{NULL, 0, 0, NULL, NULL, NULL},
};
#endif /* defined(USE_SSL) &&
* defined(USE_SSL_VERIFY) */
#ifdef USE_COOKIE
-struct param_ptr params8[] =
-{
- {"use_cookie", P_INT, PI_ONOFF, (void *) &use_cookie, CMT_USECOOKIE, NULL},
- {"accept_cookie", P_INT, PI_ONOFF, (void *) &accept_cookie, CMT_ACCEPTCOOKIE, NULL},
- {"accept_bad_cookie", P_INT, PI_SEL_C, (void *) &accept_bad_cookie, CMT_ACCEPTBADCOOKIE, badcookiestr},
- {"cookie_reject_domains", P_STRING, PI_TEXT, (void *) &cookie_reject_domains, CMT_COOKIE_REJECT_DOMAINS, NULL},
- {"cookie_accept_domains", P_STRING, PI_TEXT, (void *) &cookie_accept_domains, CMT_COOKIE_ACCEPT_DOMAINS, NULL},
+struct param_ptr params8[] = {
+ {"use_cookie", P_INT, PI_ONOFF, (void *)&use_cookie, CMT_USECOOKIE, NULL},
+ {"accept_cookie", P_INT, PI_ONOFF, (void *)&accept_cookie,
+ CMT_ACCEPTCOOKIE, NULL},
+ {"accept_bad_cookie", P_INT, PI_SEL_C, (void *)&accept_bad_cookie,
+ CMT_ACCEPTBADCOOKIE, badcookiestr},
+ {"cookie_reject_domains", P_STRING, PI_TEXT,
+ (void *)&cookie_reject_domains, CMT_COOKIE_REJECT_DOMAINS, NULL},
+ {"cookie_accept_domains", P_STRING, PI_TEXT,
+ (void *)&cookie_accept_domains, CMT_COOKIE_ACCEPT_DOMAINS, NULL},
{NULL, 0, 0, NULL, NULL, NULL},
};
#endif
-struct param_ptr params9[] =
-{
- {"ftppasswd", P_STRING, PI_TEXT, (void *) &ftppasswd, CMT_FTPPASS, NULL},
+struct param_ptr params9[] = {
+ {"ftppasswd", P_STRING, PI_TEXT, (void *)&ftppasswd, CMT_FTPPASS, NULL},
#ifdef FTPPASS_HOSTNAMEGEN
- {"ftppass_hostnamegen", P_INT, PI_ONOFF, (void *) &ftppass_hostnamegen, CMT_FTPPASS_HOSTNAMEGEN, NULL},
+ {"ftppass_hostnamegen", P_INT, PI_ONOFF, (void *)&ftppass_hostnamegen,
+ CMT_FTPPASS_HOSTNAMEGEN, NULL},
#endif
- {"user_agent", P_STRING, PI_TEXT, (void *) &UserAgent, CMT_USERAGENT, NULL},
- {"no_referer", P_INT, PI_ONOFF, (void *) &NoSendReferer, CMT_NOSENDREFERER, NULL},
- {"accept_language", P_STRING, PI_TEXT, (void *) &AcceptLang, CMT_ACCEPTLANG, NULL},
- {"argv_is_url", P_CHARINT, PI_ONOFF, (void *) &ArgvIsURL, CMT_ARGV_IS_URL, NULL},
- {"retry_http", P_INT, PI_ONOFF, (void *) &retryAsHttp, CMT_RETRY_HTTP, NULL},
- {"follow_redirection", P_INT, PI_TEXT, &FollowRedirection, CMT_FOLLOW_REDIRECTION, NULL},
- {"meta_refresh", P_CHARINT, PI_ONOFF, (void *) &MetaRefresh, CMT_META_REFRESH, NULL},
+ {"user_agent", P_STRING, PI_TEXT, (void *)&UserAgent, CMT_USERAGENT, NULL},
+ {"no_referer", P_INT, PI_ONOFF, (void *)&NoSendReferer, CMT_NOSENDREFERER,
+ NULL},
+ {"accept_language", P_STRING, PI_TEXT, (void *)&AcceptLang, CMT_ACCEPTLANG,
+ NULL},
+ {"argv_is_url", P_CHARINT, PI_ONOFF, (void *)&ArgvIsURL, CMT_ARGV_IS_URL,
+ NULL},
+ {"retry_http", P_INT, PI_ONOFF, (void *)&retryAsHttp, CMT_RETRY_HTTP,
+ NULL},
+ {"follow_redirection", P_INT, PI_TEXT, &FollowRedirection,
+ CMT_FOLLOW_REDIRECTION, NULL},
+ {"meta_refresh", P_CHARINT, PI_ONOFF, (void *)&MetaRefresh,
+ CMT_META_REFRESH, NULL},
#ifdef USE_SSL
- {"ssl_forbid_method", P_STRING, PI_TEXT, (void *) &ssl_forbid_method, CMT_SSL_FORBID_METHOD, NULL},
+ {"ssl_forbid_method", P_STRING, PI_TEXT, (void *)&ssl_forbid_method,
+ CMT_SSL_FORBID_METHOD, NULL},
#endif /* USE_SSL */
#ifdef INET6
- {"dns_order", P_INT, PI_SEL_C, (void *) &DNS_order, CMT_DNS_ORDER, dnsorders},
+ {"dns_order", P_INT, PI_SEL_C, (void *)&DNS_order, CMT_DNS_ORDER,
+ dnsorders},
#endif /* INET6 */
{NULL, 0, 0, NULL, NULL, NULL},
};
-struct param_section sections[] =
-{
+struct param_section sections[] = {
#if LANG == JA
{"表示関係", params1},
#ifdef USE_COLOR
@@ -603,17 +643,13 @@ create_option_search_table()
}
qsort(RC_search_table, RC_table_size, sizeof(struct rc_search_table),
- (int (*)(const void *, const void *)) compare_table);
+ (int (*)(const void *, const void *))compare_table);
diff1 = diff2 = 0;
for (i = 0; i < RC_table_size - 1; i++) {
p = RC_search_table[i].param->name;
q = RC_search_table[i + 1].param->name;
- for (j = 0;
- p[j] != '\0' &&
- q[j] != '\0' &&
- p[j] == q[j];
- j++);
+ for (j = 0; p[j] != '\0' && q[j] != '\0' && p[j] == q[j]; j++) ;
diff1 = j;
if (diff1 > diff2)
RC_search_table[i].uniq_pos = diff1 + 1;
@@ -639,7 +675,8 @@ search_param(char *name)
return RC_search_table[i].param;
}
else {
- while ((cmp = strcmp(name, RC_search_table[i].param->name)) <= 0)
+ while ((cmp =
+ strcmp(name, RC_search_table[i].param->name)) <= 0)
if (!cmp)
return RC_search_table[i].param;
else if (i == 0)
@@ -683,8 +720,9 @@ show_params(FILE * fp)
case P_INT:
case P_SHORT:
case P_CHARINT:
- case P_NZINT:
- t = (sections[j].params[i].inputtype == PI_ONOFF) ? "bool" : "number";
+ case P_NZINT:
+ t = (sections[j].params[i].inputtype ==
+ PI_ONOFF) ? "bool" : "number";
break;
case P_CHAR:
t = "char";
@@ -714,8 +752,7 @@ show_params(FILE * fp)
#ifdef JP_CHARSET
if (InnerCode != DisplayCode)
cmt = conv(sections[j].params[i].comment,
- InnerCode,
- DisplayCode)->ptr;
+ InnerCode, DisplayCode)->ptr;
else
#endif /* JP_CHARSET */
cmt = sections[j].params[i].comment;
@@ -741,17 +778,17 @@ str_to_bool(char *value, int old)
case 'u': /* undef */
return 0;
case 'o':
- if (tolower(value[1]) == 'f') /* off */
- return 0;
- return 1; /* on */
+ if (tolower(value[1]) == 'f') /* off */
+ return 0;
+ return 1; /* on */
case 't':
- if (tolower(value[1]) == 'o') /* toggle */
- return ! old;
- return 1; /* true */
+ if (tolower(value[1]) == 'o') /* toggle */
+ return !old;
+ return 1; /* true */
case '!':
- case 'r': /* reverse */
- case 'x': /* exchange */
- return ! old;
+ case 'r': /* reverse */
+ case 'x': /* exchange */
+ return !old;
}
return 1;
}
@@ -869,52 +906,51 @@ set_param(char *name, char *value)
return 0;
switch (p->type) {
case P_INT:
- if (atoi(value) >= 0)
- *(int *) p->varptr = (p->inputtype == PI_ONOFF)
- ? str_to_bool(value, *(int *) p->varptr) : atoi(value);
- break;
+ if (atoi(value) >= 0)
+ *(int *)p->varptr = (p->inputtype == PI_ONOFF)
+ ? str_to_bool(value, *(int *)p->varptr) : atoi(value);
+ break;
case P_NZINT:
- if (atoi(value) > 0)
- *(int *) p->varptr = atoi(value);
+ if (atoi(value) > 0)
+ *(int *)p->varptr = atoi(value);
break;
case P_SHORT:
- *(short *) p->varptr = (p->inputtype == PI_ONOFF)
- ? str_to_bool(value, *(short *) p->varptr) : atoi(value);
+ *(short *)p->varptr = (p->inputtype == PI_ONOFF)
+ ? str_to_bool(value, *(short *)p->varptr) : atoi(value);
break;
case P_CHARINT:
- *(char *) p->varptr = (p->inputtype == PI_ONOFF)
- ? str_to_bool(value, *(char *) p->varptr) : atoi(value);
+ *(char *)p->varptr = (p->inputtype == PI_ONOFF)
+ ? str_to_bool(value, *(char *)p->varptr) : atoi(value);
break;
case P_CHAR:
- *(char *) p->varptr = value[0];
+ *(char *)p->varptr = value[0];
break;
case P_STRING:
- *(char **) p->varptr = value;
+ *(char **)p->varptr = value;
break;
#if defined(USE_SSL) && defined(USE_SSL_VERIFY)
case P_SSLPATH:
if (value != NULL && value[0] != '\0')
- *(char **) p->varptr = rcFile(value);
+ *(char **)p->varptr = rcFile(value);
else
- *(char **) p->varptr = NULL;
+ *(char **)p->varptr = NULL;
ssl_path_modified = 1;
break;
#endif
#ifdef USE_COLOR
case P_COLOR:
- *(int *) p->varptr = str_to_color(value);
+ *(int *)p->varptr = str_to_color(value);
break;
#endif
#ifdef JP_CHARSET
case P_CODE:
- *(char *) p->varptr = str_to_code(value);
+ *(char *)p->varptr = str_to_code(value);
break;
#endif
case P_PIXELS:
ppc = atof(value);
- if (ppc >= MINIMUM_PIXEL_PER_CHAR &&
- ppc <= MAXIMUM_PIXEL_PER_CHAR)
- *(double *) p->varptr = ppc;
+ if (ppc >= MINIMUM_PIXEL_PER_CHAR && ppc <= MAXIMUM_PIXEL_PER_CHAR)
+ *(double *)p->varptr = ppc;
break;
}
return 1;
@@ -951,7 +987,7 @@ set_param_option(char *option)
if (set_param(q, "0"))
goto option_assigned;
return 0;
- option_assigned:
+ option_assigned:
return 1;
}
@@ -1025,10 +1061,10 @@ do_mkdir(const char *dir, long mode)
_abspath(abs, rc_dir, _MAX_PATH); /* Translate '\\' to '/' */
- if(!(n=strlen(abs)))
+ if (!(n = strlen(abs)))
return -1;
- if(*(r=abs+n-1)=='/') /* Ignore tailing slash if it is */
+ if (*(r = abs + n - 1) == '/') /* Ignore tailing slash if it is */
*r = 0;
return mkdir(abs, mode);
@@ -1115,18 +1151,18 @@ sync_with_option(void)
initMailcap();
initMimeTypes();
}
-
+
void
init_rc(char *config_file)
{
struct stat st;
FILE *f;
- char *tmpdir;
+ char *tmpdir;
if (((tmpdir = getenv("TMP")) == NULL || *tmpdir == '\0')
&& ((tmpdir = getenv("TEMP")) == NULL || *tmpdir == '\0')
&& ((tmpdir = getenv("TMPDIR")) == NULL || *tmpdir == '\0'))
- tmpdir = "/tmp";
+ tmpdir = "/tmp";
if (rc_initialized)
return;
@@ -1175,10 +1211,8 @@ init_rc(char *config_file)
static char optionpanel_src1[] =
-"<html><head><title>Option Setting Panel</title></head>\
-<body><center><b>Option Setting Panel</b><br><b>(w3m version %s)</b></center><p>\n"
-"<a href=\"file:///$LIB/" W3MHELPERPANEL_CMDNAME "?mode=panel\">%s</a>\n"
-"<form method=internal action=option>";
+ "<html><head><title>Option Setting Panel</title></head>\
+<body><center><b>Option Setting Panel</b><br><b>(w3m version %s)</b></center><p>\n" "<a href=\"file:///$LIB/" W3MHELPERPANEL_CMDNAME "?mode=panel\">%s</a>\n" "<form method=internal action=option>";
static Str
to_str(struct param_ptr *p)
@@ -1189,23 +1223,23 @@ to_str(struct param_ptr *p)
case P_COLOR:
#endif
case P_NZINT:
- return Sprintf("%d", *(int *) p->varptr);
+ return Sprintf("%d", *(int *)p->varptr);
case P_SHORT:
- return Sprintf("%d", *(short *) p->varptr);
+ return Sprintf("%d", *(short *)p->varptr);
case P_CHARINT:
- return Sprintf("%d", *(char *) p->varptr);
+ return Sprintf("%d", *(char *)p->varptr);
case P_CHAR:
#ifdef JP_CHARSET
case P_CODE:
#endif
- return Sprintf("%c", *(char *) p->varptr);
+ return Sprintf("%c", *(char *)p->varptr);
case P_STRING:
#if defined(USE_SSL) && defined(USE_SSL_VERIFY)
case P_SSLPATH:
#endif
- return Strnew_charp(*(char **) p->varptr);
+ return Strnew_charp(*(char **)p->varptr);
case P_PIXELS:
- return Sprintf("%g", *(double *) p->varptr);
+ return Sprintf("%g", *(double *)p->varptr);
}
/* not reached */
return NULL;
@@ -1222,22 +1256,19 @@ load_option_panel(void)
Strcat_charp(src, "<table><tr><td>");
for (i = 0; sections[i].name != NULL; i++) {
- Strcat_m_charp(src, "<h1>",
- sections[i].name,
- "</h1>", NULL);
+ Strcat_m_charp(src, "<h1>", sections[i].name, "</h1>", NULL);
p = sections[i].params;
Strcat_charp(src, "<table width=100% cellpadding=0>");
while (p->name) {
Strcat_m_charp(src, "<tr><td>", p->comment, NULL);
Strcat(src, Sprintf("</td><td width=%d>",
- (int)(28 * pixel_per_char)));
+ (int)(28 * pixel_per_char)));
switch (p->inputtype) {
case PI_TEXT:
Strcat_m_charp(src, "<input type=text name=",
p->name,
" value=\"",
- html_quote( to_str(p)->ptr ),
- "\">", NULL);
+ html_quote(to_str(p)->ptr), "\">", NULL);
break;
case PI_ONOFF:
x = atoi(to_str(p)->ptr);
@@ -1248,14 +1279,11 @@ load_option_panel(void)
">ON&nbsp;&nbsp;<input type=radio name=",
p->name,
" value=0",
- (x ? "" : " checked"),
- ">OFF", NULL);
+ (x ? "" : " checked"), ">OFF", NULL);
break;
case PI_SEL_C:
tmp = to_str(p);
- Strcat_m_charp(src, "<select name=",
- p->name,
- ">", NULL);
+ Strcat_m_charp(src, "<select name=", p->name, ">", NULL);
for (s = p->select; s->text != NULL; s++) {
Strcat_charp(src, "<option value=");
Strcat(src, Sprintf("%s\n", s->cvalue));
@@ -1263,12 +1291,13 @@ load_option_panel(void)
#ifdef JP_CHARSET
p->type != P_CODE &&
#endif
- s->value == atoi(tmp->ptr)) ||
- ((p->type == P_CHAR
+ s->value == atoi(tmp->ptr)) || ((p->type == P_CHAR
#ifdef JP_CHARSET
- || p->type == P_CODE
+ || p->type == P_CODE
#endif
- ) && (char) (s->value) == *(tmp->ptr)))
+ )
+ && (char)(s->value) ==
+ *(tmp->ptr)))
Strcat_charp(src, " selected");
Strcat_char(src, '>');
Strcat_charp(src, s->text);
@@ -1278,7 +1307,8 @@ load_option_panel(void)
Strcat_charp(src, "</td></tr>\n");
p++;
}
- Strcat_charp(src, "<tr><td></td><td><p><input type=submit value=\"OK\"></td></tr>");
+ Strcat_charp(src,
+ "<tr><td></td><td><p><input type=submit value=\"OK\"></td></tr>");
Strcat_charp(src, "</table><hr width=50%>");
}
Strcat_charp(src, "</table></form></body></html>");
@@ -1317,8 +1347,9 @@ rcFile(char *base)
{
if (base &&
(base[0] == '/' ||
- (base[0] == '.' && (base[1] == '/' || (base[1] == '.' && base[2] == '/'))) ||
- (base[0] == '~' && base[1] == '/')))
+ (base[0] == '.'
+ && (base[1] == '/' || (base[1] == '.' && base[2] == '/')))
+ || (base[0] == '~' && base[1] == '/')))
return expandName(base);
else {
Str file = Strnew_charp(rc_dir);
diff --git a/regex.c b/regex.c
index 16a1f16..4138b3f 100644
--- a/regex.c
+++ b/regex.c
@@ -1,4 +1,4 @@
-/* $Id: regex.c,v 1.4 2001/11/20 17:49:23 ukai Exp $ */
+/* $Id: regex.c,v 1.5 2001/11/24 02:01:26 ukai Exp $ */
/*
* regex: Regular expression pattern match library
*
@@ -43,7 +43,7 @@ regexCompile(char *ex, int igncase)
}
Regex *
-newRegex(char *ex, int igncase, Regex * regex, char **msg)
+newRegex(char *ex, int igncase, Regex *regex, char **msg)
{
char *p;
longchar *r;
@@ -51,7 +51,7 @@ newRegex(char *ex, int igncase, Regex * regex, char **msg)
int m;
if (regex == 0)
- regex = (Regex *) GC_malloc_atomic(sizeof(Regex));
+ regex = (Regex *)GC_malloc_atomic(sizeof(Regex));
st_ptr = regex->storage;
for (p = ex; *p != '\0'; p++) {
switch (*p) {
@@ -156,7 +156,7 @@ regexMatch(char *str, int len, int firstp)
}
int
-RegexMatch(Regex * re, char *str, int len, int firstp)
+RegexMatch(Regex *re, char *str, int len, int firstp)
{
char *p, *ep;
@@ -165,7 +165,8 @@ RegexMatch(Regex * re, char *str, int len, int firstp)
re->position = NULL;
ep = str + ((len == 0) ? strlen(str) : len);
for (p = str; p < ep; p++) {
- switch (regmatch(re->re, p, ep - p, firstp && (p == str), &re->lposition)) {
+ switch (regmatch
+ (re->re, p, ep - p, firstp && (p == str), &re->lposition)) {
case 1:
re->position = p;
return 1;
@@ -185,7 +186,7 @@ RegexMatch(Regex * re, char *str, int len, int firstp)
* matchedPosition: last matched position
*/
void
-MatchedPosition(Regex * re, char **first, char **last)
+MatchedPosition(Regex *re, char **first, char **last)
{
*first = re->position;
*last = re->lposition;
@@ -219,15 +220,15 @@ regmatch(regexchar * re, char *str, int len, int firstp, char **lastpos)
re++;
}
else if (re->mode & RE_ANYTIME) {
- short matched, ok = 0;
- for (;;) {
- matched = 0;
+ short matched, ok = 0;
+ for (;;) {
+ matched = 0;
if (regmatch(re + 1, p, ep - p, firstp, &lpos) == 1) {
llpos = lpos;
matched = 1;
ok = 1;
}
- if (p >= ep)
+ if (p >= ep)
break;
#ifdef JP_CHARSET
if (IS_KANJI1(*p)) {
@@ -250,9 +251,9 @@ regmatch(regexchar * re, char *str, int len, int firstp, char **lastpos)
*lastpos = llpos;
}
else
- break;
+ break;
}
- }
+ }
if (lastpos != NULL)
*lastpos = llpos;
return ok;
@@ -270,7 +271,7 @@ regmatch(regexchar * re, char *str, int len, int firstp, char **lastpos)
p += 2;
a = regmatch1(re, k);
}
- else
+ else
#endif
{
k = (unsigned char)*(p++);
@@ -385,8 +386,8 @@ lc2c(longchar * x)
void
debugre(re, s)
- regexchar *re;
- char *s;
+ regexchar *re;
+ char *s;
{
for (; !(re->mode & RE_ENDMARK); re++) {
if (re->mode & RE_BEGIN) {
diff --git a/regex.h b/regex.h
index c50a5fa..5a8d986 100644
--- a/regex.h
+++ b/regex.h
@@ -1,4 +1,4 @@
-/* $Id: regex.h,v 1.2 2001/11/20 17:49:23 ukai Exp $ */
+/* $Id: regex.h,v 1.3 2001/11/24 02:01:26 ukai Exp $ */
#define REGEX_MAX 64
#define STORAGE_MAX 256
@@ -42,11 +42,11 @@ typedef struct {
} Regex;
-Regex *newRegex(char *ex, int igncase, Regex * regex, char **error_msg);
+Regex *newRegex(char *ex, int igncase, Regex *regex, char **error_msg);
-int RegexMatch(Regex * re, char *str, int len, int firstp);
+int RegexMatch(Regex *re, char *str, int len, int firstp);
-void MatchedPosition(Regex * re, char **first, char **last);
+void MatchedPosition(Regex *re, char **first, char **last);
/* backward compatibility */
diff --git a/scrsize.c b/scrsize.c
index 3c3c652..b45009a 100644
--- a/scrsize.c
+++ b/scrsize.c
@@ -2,7 +2,7 @@
* Copyright (c) 1999, NBG01720@nifty.ne.jp
*
* To compile this program:
- * gcc -D__ST_MT_ERRNO__ -O2 -s -Zomf -Zmtd -lX11 scrsize.c
+ * gcc -D__ST_MT_ERRNO__ -O2 -s -Zomf -Zmtd -lX11 scrsize.c
*
* When I wrote this routine, I consulted some part of the source code of the
* xwininfo utility by X Consortium.
@@ -36,38 +36,42 @@
#include <stdlib.h>
#include <stdio.h>
-int main(){
- char*cp;
- Display*dpy;
- Window window;
- XWindowAttributes win_attributes;
- XSizeHints hints;
- long longjunk;
- int dst[2];
+int
+main()
+{
+ char *cp;
+ Display *dpy;
+ Window window;
+ XWindowAttributes win_attributes;
+ XSizeHints hints;
+ long longjunk;
+ int dst[2];
- _scrsize(dst);
- cp=getenv("WINDOWID");
- if(cp){
- dpy=XOpenDisplay(NULL);
- if(dpy){
- if(XGetWindowAttributes(dpy,window=atol(cp),&win_attributes))
- if(XGetWMNormalHints(dpy,window,&hints,&longjunk))
- if(hints.flags&PResizeInc&&hints.width_inc&&hints.height_inc){
- if(hints.flags&(PBaseSize|PMinSize)){
- if(hints.flags&PBaseSize){
- win_attributes.width -=hints.base_width;
- win_attributes.height-=hints.base_height;
- }else{
- win_attributes.width -=hints.min_width;
- win_attributes.height-=hints.min_height;
- }
- }
- dst[0]=win_attributes.width /hints.width_inc;
- dst[1]=win_attributes.height/hints.height_inc;
- }
- XCloseDisplay(dpy);
+ _scrsize(dst);
+ cp = getenv("WINDOWID");
+ if (cp) {
+ dpy = XOpenDisplay(NULL);
+ if (dpy) {
+ if (XGetWindowAttributes(dpy, window = atol(cp), &win_attributes))
+ if (XGetWMNormalHints(dpy, window, &hints, &longjunk))
+ if (hints.flags & PResizeInc && hints.width_inc
+ && hints.height_inc) {
+ if (hints.flags & (PBaseSize | PMinSize)) {
+ if (hints.flags & PBaseSize) {
+ win_attributes.width -= hints.base_width;
+ win_attributes.height -= hints.base_height;
+ }
+ else {
+ win_attributes.width -= hints.min_width;
+ win_attributes.height -= hints.min_height;
+ }
+ }
+ dst[0] = win_attributes.width / hints.width_inc;
+ dst[1] = win_attributes.height / hints.height_inc;
+ }
+ XCloseDisplay(dpy);
+ }
}
- }
- printf("%i %i\n",dst[0],dst[1]);
- return 0;
+ printf("%i %i\n", dst[0], dst[1]);
+ return 0;
}
diff --git a/search.c b/search.c
index d4a831c..85357c9 100644
--- a/search.c
+++ b/search.c
@@ -1,9 +1,9 @@
-/* $Id: search.c,v 1.3 2001/11/20 17:49:23 ukai Exp $ */
+/* $Id: search.c,v 1.4 2001/11/24 02:01:26 ukai Exp $ */
#include "fm.h"
#include "regex.h"
int
-forwardSearch(Buffer * buf, char *str)
+forwardSearch(Buffer *buf, char *str)
{
char *p, *first, *last;
Line *l, *begin;
@@ -71,7 +71,7 @@ forwardSearch(Buffer * buf, char *str)
}
int
-backwardSearch(Buffer * buf, char *str)
+backwardSearch(Buffer *buf, char *str)
{
char *p, *q, *found, *first, *last;
Line *l, *begin;
@@ -84,8 +84,8 @@ backwardSearch(Buffer * buf, char *str)
}
l = begin = buf->currentLine;
if (l == NULL) {
- disp_message("Not found", FALSE);
- return FALSE;
+ disp_message("Not found", FALSE);
+ return FALSE;
}
if (buf->pos > 0) {
pos = buf->pos - 1;
diff --git a/table.c b/table.c
index d9e44fa..4793ba8 100644
--- a/table.c
+++ b/table.c
@@ -1,4 +1,4 @@
-/* $Id: table.c,v 1.7 2001/11/23 18:35:06 ukai Exp $ */
+/* $Id: table.c,v 1.8 2001/11/24 02:01:26 ukai Exp $ */
/*
* HTML table
*/
@@ -14,21 +14,27 @@
#ifdef KANJI_SYMBOLS
static char *rule[] =
-{"┼", "├", "┬", "┌", "┤", "│", "┐", "07", "┴", "└", "─", "0B", "┘", "0D", "0E", " "};
+ { "┼", "├", "┬", "┌", "┤", "│", "┐", "07", "┴", "└", "─", "0B",
+ "┘", "0D", "0E", " "
+};
static char *ruleB[] =
-{"00", "┠", "┯", "┏", "┨", "┃", "┓", "07", "┷", "┗", "━", "0B", "┛", "0D", "0E", " "};
+ { "00", "┠", "┯", "┏", "┨", "┃", "┓", "07", "┷", "┗", "━", "0B",
+ "┛", "0D", "0E", " "
+};
#define TN_VERTICALBAR "│"
#define HORIZONTALBAR "━"
#define RULE_WIDTH 2
#else /* not KANJI_SYMBOLS */
char alt_rule[] = {
-'+', '|', '-', '+', '|', '|', '+', ' ', '-', '+', '-', ' ', '+', ' ', ' ', ' '};
+ '+', '|', '-', '+', '|', '|', '+', ' ', '-', '+', '-', ' ', '+', ' ', ' ',
+ ' '
+};
#if defined(__EMX__)&&!defined(JP_CHARSET)
-extern int CodePage;
+extern int CodePage;
-static char *_rule[] =
+static char *_rule[] =
#else
-static char *rule[] =
+static char *rule[] =
#endif
{
"<_RULE TYPE=0>+</_RULE>",
@@ -49,15 +55,17 @@ static char *rule[] =
"<_RULE TYPE=15> </_RULE>"
};
#if defined(__EMX__)&&!defined(JP_CHARSET)
-static char **ruleB = _rule, **rule = _rule;
+static char **ruleB = _rule, **rule = _rule;
static char *rule850[] = {
- "\305", "\303", "\302", "\332", "\264", "\263" , "\277", "07",
- "\301", "\300", "\304", "0B", "\331", "0D", "0E", " " };
+ "\305", "\303", "\302", "\332", "\264", "\263", "\277", "07",
+ "\301", "\300", "\304", "0B", "\331", "0D", "0E", " "
+};
static char *ruleB850[] = {
- "\316", "\314", "\313", "\311" "\271", "\272", "\273", "07",
- "\312", "\310", "\315", "0B", "\274", "0D", "0E", " " };
-#else /* not __EMX__ or JP_CHARSET */
-static char **ruleB = rule;
+ "\316", "\314", "\313", "\311" "\271", "\272", "\273", "07",
+ "\312", "\310", "\315", "0B", "\274", "0D", "0E", " "
+};
+#else /* not __EMX__ or JP_CHARSET */
+static char **ruleB = rule;
#endif /* not __EMX__ or JP_CHARSET */
#define TN_VERTICALBAR "<_RULE TYPE=5>|</_RULE>"
@@ -116,15 +124,15 @@ weight(int x)
{
if (x < COLS)
- return (double) x;
+ return (double)x;
else
- return COLS * (log((double) x / COLS) + 1.);
+ return COLS * (log((double)x / COLS) + 1.);
}
static double
weight2(int a)
{
- return (double) a / COLS * 4 + 1.;
+ return (double)a / COLS * 4 + 1.;
}
#define sigma_td(a) (0.5*weight2(a)) /* <td width=...> */
@@ -139,15 +147,15 @@ weight3(int x)
if (x < 0.1)
return 0.1;
if (x < LOG_MIN)
- return (double) x;
+ return (double)x;
else
- return LOG_MIN * (log((double) x / LOG_MIN) + 1.);
+ return LOG_MIN * (log((double)x / LOG_MIN) + 1.);
}
#endif /* not MATRIX */
static int
bsearch_2short(short e1, short *ent1, short e2, short *ent2, int base,
- char *index, int nent)
+ char *index, int nent)
{
int n = nent;
int k = 0;
@@ -234,7 +242,7 @@ dv2sv(double *dv, short *iv, int size)
edv = NewAtom_N(double, size);
for (i = 0; i < size; i++) {
iv[i] = ceil(dv[i]);
- edv[i] = (double) iv[i] - dv[i];
+ edv[i] = (double)iv[i] - dv[i];
}
w = 0.;
@@ -246,10 +254,10 @@ dv2sv(double *dv, short *iv, int size)
bcopy(index + i, index + i + 1, k - i);
index[i] = k;
}
- iw = min((int) (w + 0.5), size);
+ iw = min((int)(w + 0.5), size);
if (iw == 0)
return;
- x = edv[(int) index[iw - 1]];
+ x = edv[(int)index[iw - 1]];
for (i = 0; i < size; i++) {
k = index[i];
if (i >= iw && abs(edv[k] - x) > 1e-6)
@@ -263,7 +271,7 @@ static int
table_colspan(struct table *t, int row, int col)
{
int i;
- for (i = col + 1; i <= t->maxcol && (t->tabattr[row][i] & HTT_X); i++);
+ for (i = col + 1; i <= t->maxcol && (t->tabattr[row][i] & HTT_X); i++) ;
return i - col;
}
@@ -274,7 +282,7 @@ table_rowspan(struct table *t, int row, int col)
if (!t->tabattr[row])
return 0;
for (i = row + 1; i <= t->maxrow && t->tabattr[i] &&
- (t->tabattr[i][col] & HTT_Y); i++);
+ (t->tabattr[i][col] & HTT_Y); i++) ;
return i - row;
}
@@ -452,7 +460,7 @@ suspend_or_pushdata(struct table *tbl, char *line)
pushText(tbl->suspended_data, line);
}
}
-
+
int visible_length_offset = 0;
int
visible_length(char *str)
@@ -472,7 +480,8 @@ visible_length(char *str)
Strclear(tagbuf);
Strcat_char(tagbuf, *str);
}
- else if (status == R_ST_TAG || status == R_ST_DQUOTE || status == R_ST_QUOTE || status == R_ST_EQL) {
+ else if (status == R_ST_TAG || status == R_ST_DQUOTE
+ || status == R_ST_QUOTE || status == R_ST_EQL) {
Strcat_char(tagbuf, *str);
}
else if (status == R_ST_AMP) {
@@ -504,12 +513,13 @@ visible_length(char *str)
len++;
} while ((visible_length_offset + len) % Tabstop != 0);
}
- else if (*str == '\n' || *str == '\r') {
- if (len > max_len) max_len = len;
- len = 0;
- }
- else if (*str == '\n' || *str == '\r')
- len = 0;
+ else if (*str == '\n' || *str == '\r') {
+ if (len > max_len)
+ max_len = len;
+ len = 0;
+ }
+ else if (*str == '\n' || *str == '\r')
+ len = 0;
str++;
}
if (status == R_ST_AMP) {
@@ -529,7 +539,7 @@ maximum_visible_length(char *str)
int maxlen, len;
char *p;
- for (p = str; *p && *p != '\t'; p++);
+ for (p = str; *p && *p != '\t'; p++) ;
visible_length_offset = 0;
maxlen = visible_length(str);
@@ -591,9 +601,7 @@ align(TextLine *lbuf, int width, int mode)
}
void
-print_item(struct table *t,
- int row, int col, int width,
- Str buf)
+print_item(struct table *t, int row, int col, int width, Str buf)
{
int alignment;
TextLine *lbuf;
@@ -628,18 +636,16 @@ print_item(struct table *t,
#define T_BOTTOM 2
void
-print_sep(struct table *t,
- int row, int type, int maxcol,
- Str buf)
+print_sep(struct table *t, int row, int type, int maxcol, Str buf)
{
int forbid;
char **rulep;
int i, j, k, l, m;
#if defined(__EMX__)&&!defined(JP_CHARSET)
- if(CodePage==850){
+ if (CodePage == 850) {
ruleB = ruleB850;
- rule = rule850;
+ rule = rule850;
}
#endif
if (row >= 0)
@@ -668,15 +674,19 @@ print_sep(struct table *t,
goto do_last_sep;
}
else {
- for (k = row; k >= 0 && t->tabattr[k] && (t->tabattr[k][i] & HTT_Y); k--);
+ for (k = row;
+ k >= 0 && t->tabattr[k] && (t->tabattr[k][i] & HTT_Y);
+ k--) ;
m = t->tabwidth[i] + 2 * t->cellpadding;
- for (l = i + 1; l <= t->maxcol && (t->tabattr[row][l] & HTT_X); l++)
+ for (l = i + 1; l <= t->maxcol && (t->tabattr[row][l] & HTT_X);
+ l++)
m += t->tabwidth[l] + t->cellspacing;
print_item(t, k, i, m, buf);
}
}
else {
- for (j = 0; j < t->tabwidth[i] + 2 * t->cellpadding; j += RULE_WIDTH) {
+ for (j = 0; j < t->tabwidth[i] + 2 * t->cellpadding;
+ j += RULE_WIDTH) {
Strcat_charp(buf, rulep[forbid]);
}
}
@@ -743,8 +753,7 @@ do_refill(struct table *tbl, int row, int col, int maxlimit)
struct environment envs[MAX_ENV_LEVEL];
int colspan, icell;
- if (tbl->tabdata[row] == NULL ||
- tbl->tabdata[row][col] == NULL)
+ if (tbl->tabdata[row] == NULL || tbl->tabdata[row][col] == NULL)
return;
orgdata = (TextList *)tbl->tabdata[row][col];
tbl->tabdata[row][col] = newGeneralList();
@@ -782,8 +791,7 @@ do_refill(struct table *tbl, int row, int col, int maxlimit)
if (alignment != ALIGN_LEFT) {
for (ti = tbl->tables[id].buf->first;
- ti != NULL;
- ti = ti->next)
+ ti != NULL; ti = ti->next)
align(ti->ptr, h_env.limit, alignment);
}
appendTextLineList(h_env.buf, tbl->tables[id].buf);
@@ -938,7 +946,7 @@ set_integered_width(struct table *t, double *dwidth, short *iwidth)
mod = NewAtom_N(double, t->maxcol + 1);
for (i = 0; i <= t->maxcol; i++) {
iwidth[i] = ceil_at_intervals(ceil(dwidth[i]), rulewidth);
- mod[i] = (double) iwidth[i] - dwidth[i];
+ mod[i] = (double)iwidth[i] - dwidth[i];
}
sum = 0.;
@@ -974,7 +982,7 @@ set_integered_width(struct table *t, double *dwidth, short *iwidth)
fixed[ii] = 2;
if (fixed[ii] < 1 &&
iwidth[ii] - rulewidth < t->tabwidth[ii] &&
- (double) rulewidth - mod[ii] > 0.5)
+ (double)rulewidth - mod[ii] > 0.5)
fixed[ii] = 1;
}
idx = NewAtom_N(char, n);
@@ -998,26 +1006,26 @@ set_integered_width(struct table *t, double *dwidth, short *iwidth)
width += iwidth[kk];
w = 0;
for (kk = 0; kk < m; kk++) {
- if (fixed[(int) idx[kk]] < 2)
+ if (fixed[(int)idx[kk]] < 2)
w += rulewidth;
}
if (width - w < cell->minimum_width[j]) {
for (kk = 0; kk < m; kk++) {
- if (fixed[(int) idx[kk]] < 2)
- fixed[(int) idx[kk]] = 2;
+ if (fixed[(int)idx[kk]] < 2)
+ fixed[(int)idx[kk]] = 2;
}
}
w = 0;
for (kk = 0; kk < m; kk++) {
- if (fixed[(int) idx[kk]] < 1 &&
- (double) rulewidth - mod[(int) idx[kk]] > 0.5)
+ if (fixed[(int)idx[kk]] < 1 &&
+ (double)rulewidth - mod[(int)idx[kk]] > 0.5)
w += rulewidth;
}
if (width - w < cell->width[j]) {
for (kk = 0; kk < m; kk++) {
- if (fixed[(int) idx[kk]] < 1 &&
- (double) rulewidth - mod[(int) idx[kk]] > 0.5)
- fixed[(int) idx[kk]] = 1;
+ if (fixed[(int)idx[kk]] < 1 &&
+ (double)rulewidth - mod[(int)idx[kk]] > 0.5)
+ fixed[(int)idx[kk]] = 1;
}
}
}
@@ -1027,7 +1035,7 @@ set_integered_width(struct table *t, double *dwidth, short *iwidth)
if (fixed[ii] <= step)
nn++;
}
- nsum = sum - (double) (nn * rulewidth);
+ nsum = sum - (double)(nn * rulewidth);
if (nsum < 0. && fabs(sum) <= fabs(nsum))
return;
for (k = 0; k < n; k++) {
@@ -1061,7 +1069,7 @@ static double
correlation_coefficient2(double sxx, double syy, double sxy)
{
double coe, tmp;
- tmp = (syy + sxx - 2*sxy) * sxx;
+ tmp = (syy + sxx - 2 * sxy) * sxx;
if (tmp < Tiny)
tmp = Tiny;
coe = (sxx - sxy) / sqrt(tmp);
@@ -1074,13 +1082,11 @@ correlation_coefficient2(double sxx, double syy, double sxy)
static double
recalc_width(double old, double swidth, int cwidth,
- double sxx, double syy, double sxy,
- int is_inclusive)
+ double sxx, double syy, double sxy, int is_inclusive)
{
- double delta = swidth - (double) cwidth;
+ double delta = swidth - (double)cwidth;
double rat = sxy / sxx,
- coe = correlation_coefficient(sxx, syy, sxy),
- w, ww;
+ coe = correlation_coefficient(sxx, syy, sxy), w, ww;
if (old < 0.)
old = 0.;
if (fabs(coe) < 1e-5)
@@ -1132,13 +1138,13 @@ check_compressible_cell(struct table *t, MAT * minv,
if (icol >= 0) {
owidth = newwidth[icol];
- delta = newwidth[icol] - (double) t->tabwidth[icol];
+ delta = newwidth[icol] - (double)t->tabwidth[icol];
bcol = icol;
ecol = bcol + 1;
}
else if (icell >= 0) {
owidth = swidth[icell];
- delta = swidth[icell] - (double) cwidth[icell];
+ delta = swidth[icell] - (double)cwidth[icell];
bcol = cell->col[icell];
ecol = bcol + cell->colspan[icell];
}
@@ -1171,12 +1177,10 @@ check_compressible_cell(struct table *t, MAT * minv,
}
if (sxy > 0.)
dmin = recalc_width(dmin, swidth[j], cwidth[j],
- sxx, Sxx[j], sxy,
- is_inclusive);
+ sxx, Sxx[j], sxy, is_inclusive);
else
dmax = recalc_width(dmax, swidth[j], cwidth[j],
- sxx, Sxx[j], sxy,
- is_inclusive);
+ sxx, Sxx[j], sxy, is_inclusive);
}
for (m = 0; m <= t->maxcol; m++) {
int is_inclusive = 0;
@@ -1192,14 +1196,12 @@ check_compressible_cell(struct table *t, MAT * minv,
}
if (sxy > 0.)
dmin = recalc_width(dmin, newwidth[m], t->tabwidth[m],
- sxx, m_entry(minv, m, m), sxy,
- is_inclusive);
+ sxx, m_entry(minv, m, m), sxy, is_inclusive);
else
dmax = recalc_width(dmax, newwidth[m], t->tabwidth[m],
- sxx, m_entry(minv, m, m), sxy,
- is_inclusive);
+ sxx, m_entry(minv, m, m), sxy, is_inclusive);
}
- _end:
+ _end:
if (dmax > 0. && dmin > dmax)
dmin = dmax;
span = ecol - bcol;
@@ -1261,8 +1263,7 @@ check_table_width(struct table *t, double *newwidth, MAT * minv, int itr)
/* compress table */
corr = check_compressible_cell(t, minv, newwidth, swidth,
- cwidth, twidth, Sxx,
- -1, -1, stotal, corr);
+ cwidth, twidth, Sxx, -1, -1, stotal, corr);
if (itr < MAX_ITERATION && corr > 0)
return corr;
@@ -1270,7 +1271,7 @@ check_table_width(struct table *t, double *newwidth, MAT * minv, int itr)
for (k = cell->maxcell; k >= 0; k--) {
j = cell->index[k];
corr = check_compressible_cell(t, minv, newwidth, swidth,
- cwidth, twidth, Sxx,
+ cwidth, twidth, Sxx,
-1, j, Sxx[j], corr);
if (itr < MAX_ITERATION && corr > 0)
return corr;
@@ -1279,7 +1280,7 @@ check_table_width(struct table *t, double *newwidth, MAT * minv, int itr)
/* compress single column cell */
for (i = 0; i <= t->maxcol; i++) {
corr = check_compressible_cell(t, minv, newwidth, swidth,
- cwidth, twidth, Sxx,
+ cwidth, twidth, Sxx,
i, -1, m_entry(minv, i, i), corr);
if (itr < MAX_ITERATION && corr > 0)
return corr;
@@ -1323,7 +1324,8 @@ check_table_width(struct table *t, double *newwidth, MAT * minv, int itr)
ecol = bcol + cell->colspan[j];
for (i = bcol; i < ecol; i++)
nwidth += corwidth[i];
- mwidth = cell->minimum_width[j] - (cell->colspan[j] - 1) * t->cellspacing;
+ mwidth =
+ cell->minimum_width[j] - (cell->colspan[j] - 1) * t->cellspacing;
if (mwidth > swidth[j] && mwidth == nwidth) {
double w = (sx > 0.5) ? 0.5 : sx * 0.2;
@@ -1411,7 +1413,7 @@ set_table_width(struct table *t, short *newwidth, int maxwidth)
if (!fixed[i])
dwidth[i] = (width - fwidth) * weight3(t->tabwidth[i]) / s;
else
- dwidth[i] = (double) newwidth[i];
+ dwidth[i] = (double)newwidth[i];
}
dv2sv(dwidth, newwidth, cell->colspan[j]);
if (cell->fixed_width[j] > 0) {
@@ -1447,7 +1449,7 @@ set_table_width(struct table *t, short *newwidth, int maxwidth)
if (!fixed[i])
dwidth[i] = (width - fwidth) * weight3(t->tabwidth[i]) / s;
else
- dwidth[i] = (double) newwidth[i];
+ dwidth[i] = (double)newwidth[i];
}
dv2sv(dwidth, newwidth, t->maxcol + 1);
@@ -1502,29 +1504,28 @@ check_table_height(struct table *t)
if (rowspan > 1) {
int c = cell.maxcell + 1;
k = bsearch_2short(rowspan, cell.rowspan,
- j, cell.row, t->maxrow + 1,
- cell.index, c);
+ j, cell.row, t->maxrow + 1, cell.index, c);
if (k <= cell.maxcell) {
int idx = cell.index[k];
- if (cell.row[idx] == j &&
- cell.rowspan[idx] == rowspan)
+ if (cell.row[idx] == j && cell.rowspan[idx] == rowspan)
c = idx;
}
- if (c < MAXCELL) {
- if (c > cell.maxcell) {
- cell.maxcell++;
- cell.row[cell.maxcell] = j;
- cell.rowspan[cell.maxcell] = rowspan;
- cell.height[cell.maxcell] = 0;
- if (cell.maxcell > k)
- bcopy(cell.index + k, cell.index + k + 1, cell.maxcell - k);
- cell.index[k] = cell.maxcell;
- }
-
- if (cell.height[c] < t_dep)
- cell.height[c] = t_dep;
+ if (c < MAXCELL) {
+ if (c > cell.maxcell) {
+ cell.maxcell++;
+ cell.row[cell.maxcell] = j;
+ cell.rowspan[cell.maxcell] = rowspan;
+ cell.height[cell.maxcell] = 0;
+ if (cell.maxcell > k)
+ bcopy(cell.index + k, cell.index + k + 1,
+ cell.maxcell - k);
+ cell.index[k] = cell.maxcell;
+ }
+
+ if (cell.height[c] < t_dep)
+ cell.height[c] = t_dep;
}
- continue;
+ continue;
}
if (t->tabheight[j] < t_dep)
t->tabheight[j] = t_dep;
@@ -1548,8 +1549,7 @@ check_table_height(struct table *t)
#define CHECK_FIXED 2
int
-get_table_width(struct table *t, short *orgwidth, short *cellwidth,
- int flag)
+get_table_width(struct table *t, short *orgwidth, short *cellwidth, int flag)
{
#ifdef __GNUC__
short newwidth[t->maxcol + 1];
@@ -1630,8 +1630,7 @@ renderCoTable(struct table *tbl, int maxlimit)
else if (t->total_width > 0)
maxwidth = t->total_width;
else
- maxwidth = t->total_width =
- -t->total_width * h_env.limit / 100;
+ maxwidth = t->total_width = -t->total_width * h_env.limit / 100;
renderTable(t, maxwidth, &h_env);
}
}
@@ -1648,17 +1647,17 @@ make_caption(struct table *t, struct html_feed_environ *h_env)
return;
if (t->total_width > 0)
- limit = t->total_width;
+ limit = t->total_width;
else
- limit = h_env->limit;
+ limit = h_env->limit;
init_henv(&henv, &obuf, envs, MAX_ENV_LEVEL, newTextLineList(),
- limit, h_env->envs[h_env->envc].indent);
+ limit, h_env->envs[h_env->envc].indent);
HTMLlineproc1("<center>", &henv);
HTMLlineproc0(t->caption->ptr, &henv, FALSE);
HTMLlineproc1("</center>", &henv);
if (t->total_width < henv.maxlimit)
- t->total_width = henv.maxlimit;
+ t->total_width = henv.maxlimit;
limit = h_env->limit;
h_env->limit = t->total_width;
HTMLlineproc1("<center>", h_env);
@@ -1668,9 +1667,7 @@ make_caption(struct table *t, struct html_feed_environ *h_env)
}
void
-renderTable(struct table *t,
- int max_width,
- struct html_feed_environ *h_env)
+renderTable(struct table *t, int max_width, struct html_feed_environ *h_env)
{
int i, j, w, r, h;
Str renderbuf;
@@ -1698,12 +1695,12 @@ renderTable(struct table *t,
max_width = t->sloppy_width;
rulewidth = table_rule_width(t);
-
+
max_width -= table_border_width(t);
if (rulewidth > 1)
max_width = floor_at_intervals(max_width, rulewidth);
-
+
if (max_width < rulewidth)
max_width = rulewidth;
@@ -1801,8 +1798,7 @@ renderTable(struct table *t,
TextLineList *l;
int k;
if ((t->tabattr[j][i] & HTT_Y) ||
- (t->tabattr[j][i] & HTT_TOP) ||
- (t->tabdata[j][i] == NULL))
+ (t->tabattr[j][i] & HTT_TOP) || (t->tabdata[j][i] == NULL))
continue;
h = t->tabheight[j];
for (k = j + 1; k <= t->maxrow; k++) {
@@ -1846,7 +1842,7 @@ renderTable(struct table *t,
case BORDER_THICK:
renderbuf = Strnew();
print_sep(t, -1, T_TOP, t->maxcol, renderbuf);
- push_render_image(renderbuf, width, t->total_width, h_env);
+ push_render_image(renderbuf, width, t->total_width, h_env);
t->total_height += 1;
break;
}
@@ -1865,7 +1861,7 @@ renderTable(struct table *t,
Strcat_charp(vrulec, TK_VERTICALBAR(t->border_mode));
case BORDER_NOWIN:
#if defined(__EMX__)&&!defined(JP_CHARSET)
- Strcat_charp(vruleb, CodePage==850?"\263":TN_VERTICALBAR);
+ Strcat_charp(vruleb, CodePage == 850 ? "\263" : TN_VERTICALBAR);
#else
Strcat_charp(vruleb, TN_VERTICALBAR);
#endif
@@ -1880,7 +1876,8 @@ renderTable(struct table *t,
for (r = 0; r <= t->maxrow; r++) {
for (h = 0; h < t->tabheight[r]; h++) {
renderbuf = Strnew();
- if (t->border_mode == BORDER_THIN || t->border_mode == BORDER_THICK)
+ if (t->border_mode == BORDER_THIN
+ || t->border_mode == BORDER_THICK)
Strcat(renderbuf, vrulea);
#ifdef ID_EXT
if (t->tridvalue[r] != NULL && h == 0) {
@@ -1901,13 +1898,11 @@ renderTable(struct table *t,
if (!(t->tabattr[r][i] & HTT_X)) {
w = t->tabwidth[i];
for (j = i + 1;
- j <= t->maxcol && (t->tabattr[r][j] & HTT_X);
- j++)
+ j <= t->maxcol && (t->tabattr[r][j] & HTT_X); j++)
w += t->tabwidth[j] + t->cellspacing;
if (t->tabattr[r][i] & HTT_Y) {
- for (j = r - 1;
- j >= 0 && t->tabattr[j] && (t->tabattr[j][i] & HTT_Y);
- j--);
+ for (j = r - 1; j >= 0 && t->tabattr[j]
+ && (t->tabattr[j][i] & HTT_Y); j--) ;
print_item(t, j, i, w, renderbuf);
}
else
@@ -1923,12 +1918,12 @@ renderTable(struct table *t,
t->total_height += 1;
break;
}
- push_render_image(renderbuf, width, t->total_width, h_env);
+ push_render_image(renderbuf, width, t->total_width, h_env);
}
if (r < t->maxrow && t->border_mode != BORDER_NONE) {
renderbuf = Strnew();
print_sep(t, r, T_MIDDLE, t->maxcol, renderbuf);
- push_render_image(renderbuf, width, t->total_width, h_env);
+ push_render_image(renderbuf, width, t->total_width, h_env);
}
t->total_height += t->tabheight[r];
}
@@ -1937,7 +1932,7 @@ renderTable(struct table *t,
case BORDER_THICK:
renderbuf = Strnew();
print_sep(t, t->maxrow, T_BOTTOM, t->maxcol, renderbuf);
- push_render_image(renderbuf, width, t->total_width, h_env);
+ push_render_image(renderbuf, width, t->total_width, h_env);
t->total_height += 1;
break;
}
@@ -1945,7 +1940,7 @@ renderTable(struct table *t,
renderbuf = Strnew(" ");
t->total_height++;
t->total_width = 1;
- push_render_image(renderbuf, 1, t->total_width, h_env);
+ push_render_image(renderbuf, 1, t->total_width, h_env);
}
HTMLlineproc1("</pre>", h_env);
}
@@ -2026,7 +2021,7 @@ begin_table(int border, int spacing, int padding, int vspace)
else
t->vcellpadding = 1;
}
-
+
return t;
}
@@ -2037,13 +2032,11 @@ end_table(struct table *tbl)
int i, rulewidth = table_rule_width(tbl);
if (rulewidth > 1) {
if (tbl->total_width > 0)
- tbl->total_width =
- ceil_at_intervals(tbl->total_width, rulewidth);
+ tbl->total_width = ceil_at_intervals(tbl->total_width, rulewidth);
for (i = 0; i <= tbl->maxcol; i++) {
tbl->minimum_width[i] =
ceil_at_intervals(tbl->minimum_width[i], rulewidth);
- tbl->tabwidth[i] =
- ceil_at_intervals(tbl->tabwidth[i], rulewidth);
+ tbl->tabwidth[i] = ceil_at_intervals(tbl->tabwidth[i], rulewidth);
if (tbl->fixed_width[i] > 0)
tbl->fixed_width[i] =
ceil_at_intervals(tbl->fixed_width[i], rulewidth);
@@ -2051,8 +2044,7 @@ end_table(struct table *tbl)
for (i = 0; i <= cell->maxcell; i++) {
cell->minimum_width[i] =
ceil_at_intervals(cell->minimum_width[i], rulewidth);
- cell->width[i] =
- ceil_at_intervals(cell->width[i], rulewidth);
+ cell->width[i] = ceil_at_intervals(cell->width[i], rulewidth);
if (cell->fixed_width[i] > 0)
cell->fixed_width[i] =
ceil_at_intervals(cell->fixed_width[i], rulewidth);
@@ -2085,7 +2077,7 @@ check_minimum0(struct table *t, int min)
cell->minimum_width[cell->icell] = min;
}
for (i = t->col;
- i <= t->maxcol && (i == t->col || (t->tabattr[t->row][i] & HTT_X));
+ i <= t->maxcol && (i == t->col || (t->tabattr[t->row][i] & HTT_X));
i++) {
if (t->minimum_width[i] < ww)
t->minimum_width[i] = ww;
@@ -2178,7 +2170,7 @@ begin_cell(struct table *t, struct table_mode *mode)
t->suspended_data = NULL;
}
}
-
+
void
check_rowcol(struct table *tbl, struct table_mode *mode)
{
@@ -2199,8 +2191,7 @@ check_rowcol(struct table *tbl, struct table_mode *mode)
for (;; tbl->row++) {
check_row(tbl, tbl->row);
for (; tbl->col < MAXCOL &&
- tbl->tabattr[tbl->row][tbl->col] & (HTT_X | HTT_Y);
- tbl->col++);
+ tbl->tabattr[tbl->row][tbl->col] & (HTT_X | HTT_Y); tbl->col++) ;
if (tbl->col < MAXCOL)
break;
tbl->col = 0;
@@ -2294,14 +2285,12 @@ skip_space(struct table *t, char *line, struct table_linfo *linfo,
static void
feed_table_inline_tag(struct table *tbl,
- char *line,
- struct table_mode *mode,
- int width)
+ char *line, struct table_mode *mode, int width)
{
check_rowcol(tbl, mode);
pushdata(tbl, tbl->row, tbl->col, line);
if (width >= 0) {
- check_minimum0(tbl, width);
+ check_minimum0(tbl, width);
addcontentssize(tbl, width);
setwidth(tbl, mode);
}
@@ -2309,10 +2298,7 @@ feed_table_inline_tag(struct table *tbl,
static void
feed_table_block_tag(struct table *tbl,
- char *line,
- struct table_mode *mode,
- int indent,
- int cmd)
+ char *line, struct table_mode *mode, int indent, int cmd)
{
int offset;
if (mode->indent_level <= 0 && indent == -1)
@@ -2370,7 +2356,7 @@ table_close_anchor0(struct table *tbl, struct table_mode *mode)
}
else if (tbl->linfo.prev_spaces > 0 &&
tbl->tabcontentssize - 1 == mode->anchor_offset) {
- if(tbl->linfo.prev_spaces > 0)
+ if (tbl->linfo.prev_spaces > 0)
tbl->linfo.prev_spaces = -1;
}
}
@@ -2400,7 +2386,8 @@ table_close_anchor0(struct table *tbl, struct table_mode *mode)
case HTML_COL
static int
-feed_table_tag(struct table *tbl, char *line, struct table_mode *mode, int width, struct parsed_tag *tag)
+feed_table_tag(struct table *tbl, char *line, struct table_mode *mode,
+ int width, struct parsed_tag *tag)
{
int cmd;
char *p;
@@ -2427,11 +2414,11 @@ feed_table_tag(struct table *tbl, char *line, struct table_mode *mode, int width
}
switch (cmd) {
- CASE_TABLE_TAG:
- if (mode->caption)
+ CASE_TABLE_TAG:
+ if (mode->caption)
mode->caption = 0;
- if (mode->pre_mode & (TBLM_IGNORE|TBLM_XMP|TBLM_LST))
- mode->pre_mode &= ~(TBLM_IGNORE|TBLM_XMP|TBLM_LST);
+ if (mode->pre_mode & (TBLM_IGNORE | TBLM_XMP | TBLM_LST))
+ mode->pre_mode &= ~(TBLM_IGNORE | TBLM_XMP | TBLM_LST);
if (mode->pre_mode & TBLM_INTXTA)
table_close_textarea(tbl, mode, width);
if (mode->pre_mode & TBLM_INSELECT)
@@ -2454,13 +2441,12 @@ feed_table_tag(struct table *tbl, char *line, struct table_mode *mode, int width
table_close_select(tbl, mode, width);
}
- if (
- (mode->pre_mode & TBLM_INSELECT && cmd != HTML_N_SELECT) ||
+ if ((mode->pre_mode & TBLM_INSELECT && cmd != HTML_N_SELECT) ||
(mode->pre_mode & TBLM_INTXTA && cmd != HTML_N_TEXTAREA) ||
(mode->pre_mode & TBLM_XMP && cmd != HTML_N_XMP) ||
(mode->pre_mode & TBLM_LST && cmd != HTML_N_LISTING))
return TAG_ACTION_FEED;
-
+
if (mode->pre_mode & TBLM_PRE) {
switch (cmd) {
case HTML_NOBR:
@@ -2495,7 +2481,7 @@ feed_table_tag(struct table *tbl, char *line, struct table_mode *mode, int width
break;
case ALIGN_RIGHT:
align = (HTT_RIGHT | HTT_TRSET);
- break;
+ break;
case ALIGN_CENTER:
align = (HTT_CENTER | HTT_TRSET);
break;
@@ -2607,7 +2593,7 @@ feed_table_tag(struct table *tbl, char *line, struct table_mode *mode, int width
#ifdef TABLE_EXPAND
if (v > 0) {
if (tbl->real_width > 0)
- v = - (v * 100) / (tbl->real_width * pixel_per_char);
+ v = -(v * 100) / (tbl->real_width * pixel_per_char);
else
v = (int)(v / pixel_per_char);
}
@@ -2632,11 +2618,10 @@ feed_table_tag(struct table *tbl, char *line, struct table_mode *mode, int width
cell->icell = cell->maxcell + 1;
k = bsearch_2short(colspan, cell->colspan, col, cell->col, MAXCOL,
- cell->index, cell->icell);
+ cell->index, cell->icell);
if (k <= cell->maxcell) {
i = cell->index[k];
- if (cell->col[i] == col &&
- cell->colspan[i] == colspan)
+ if (cell->col[i] == col && cell->colspan[i] == colspan)
cell->icell = i;
}
if (cell->icell > cell->maxcell && cell->icell < MAXCELL) {
@@ -2647,7 +2632,8 @@ feed_table_tag(struct table *tbl, char *line, struct table_mode *mode, int width
cell->minimum_width[cell->maxcell] = 0;
cell->fixed_width[cell->maxcell] = 0;
if (cell->maxcell > k)
- bcopy(cell->index + k, cell->index + k + 1, cell->maxcell - k);
+ bcopy(cell->index + k, cell->index + k + 1,
+ cell->maxcell - k);
cell->index[k] = cell->maxcell;
}
if (cell->icell > cell->maxcell)
@@ -2745,9 +2731,9 @@ feed_table_tag(struct table *tbl, char *line, struct table_mode *mode, int width
case HTML_N_XMP:
mode->pre_mode &= ~TBLM_XMP;
break;
- case HTML_PLAINTEXT:
- mode->pre_mode |= TBLM_PLAINTEXT;
- break;
+ case HTML_PLAINTEXT:
+ mode->pre_mode |= TBLM_PLAINTEXT;
+ break;
}
break;
case HTML_DL:
@@ -2888,7 +2874,7 @@ feed_table_tag(struct table *tbl, char *line, struct table_mode *mode, int width
else
v = tbl->fixed_width[tbl->col];
if (v < 0 && tbl->real_width > 0 && tbl1->real_width > 0)
- w = - (tbl1->real_width * 100) / tbl->real_width;
+ w = -(tbl1->real_width * 100) / tbl->real_width;
else
w = tbl1->real_width;
if (w > 0)
@@ -3001,8 +2987,7 @@ feed_table(struct table *tbl, char *line, struct table_mode *mode,
char *q, *r;
if (*p == '&') {
if (!strncasecmp(p, "&amp;", 5) ||
- !strncasecmp(p, "&gt;", 4) ||
- !strncasecmp(p, "&lt;", 4)) {
+ !strncasecmp(p, "&gt;", 4) || !strncasecmp(p, "&lt;", 4)) {
/* do not convert */
Strcat_char(tmp, *p);
p++;
@@ -3010,30 +2995,30 @@ feed_table(struct table *tbl, char *line, struct table_mode *mode,
else {
int ec;
q = p;
- switch (ec = getescapechar(&p)) {
- case '<':
- Strcat_charp(tmp, "&lt;");
- break;
- case '>':
- Strcat_charp(tmp, "&gt;");
- break;
- case '&':
- Strcat_charp(tmp, "&amp;");
- break;
- case '\r':
- Strcat_char(tmp, '\n');
- break;
- default:
- r = conv_entity(ec);
- if (r != NULL && strlen(r) == 1 &&
- ec == (unsigned char)*r) {
- Strcat_char(tmp, *r);
- break;
- }
- case -1:
- Strcat_char(tmp, *q);
- p = q + 1;
- break;
+ switch (ec = getescapechar(&p)) {
+ case '<':
+ Strcat_charp(tmp, "&lt;");
+ break;
+ case '>':
+ Strcat_charp(tmp, "&gt;");
+ break;
+ case '&':
+ Strcat_charp(tmp, "&amp;");
+ break;
+ case '\r':
+ Strcat_char(tmp, '\n');
+ break;
+ default:
+ r = conv_entity(ec);
+ if (r != NULL && strlen(r) == 1 &&
+ ec == (unsigned char)*r) {
+ Strcat_char(tmp, *r);
+ break;
+ }
+ case -1:
+ Strcat_char(tmp, *q);
+ p = q + 1;
+ break;
}
}
}
@@ -3091,8 +3076,9 @@ feed_table1(struct table *tbl, Str tok, struct table_mode *mode, int width)
tokbuf = Strnew();
status = R_ST_NORMAL;
line = tok->ptr;
- while (read_token(tokbuf, &line, &status, mode->pre_mode & TBLM_PREMODE, 0))
- feed_table(tbl, tokbuf->ptr, mode, width, TRUE);
+ while (read_token
+ (tokbuf, &line, &status, mode->pre_mode & TBLM_PREMODE, 0))
+ feed_table(tbl, tokbuf->ptr, mode, width, TRUE);
}
void
@@ -3119,8 +3105,7 @@ pushTable(struct table *tbl, struct table *tbl1)
tbl->tables[tbl->ntable].indent = tbl->indent;
tbl->tables[tbl->ntable].buf = newTextLineList();
check_row(tbl, row);
- if (col + 1 <= tbl->maxcol &&
- tbl->tabattr[row][col + 1] & HTT_X)
+ if (col + 1 <= tbl->maxcol && tbl->tabattr[row][col + 1] & HTT_X)
tbl->tables[tbl->ntable].cell = tbl->cell.icell;
else
tbl->tables[tbl->ntable].cell = -1;
@@ -3168,7 +3153,8 @@ correct_table_matrix2(struct table *t, int col, int cspan, double s, double b)
}
static void
-correct_table_matrix3(struct table *t, int col, char *flags, double s, double b)
+correct_table_matrix3(struct table *t, int col, char *flags, double s,
+ double b)
{
int i, j;
double ss;
@@ -3220,7 +3206,7 @@ set_table_matrix0(struct table *t, int maxwidth)
if (cell->necell == 0) {
for (i = 0; i < size; i++) {
s = we[i] / w0;
- b = sigma_td_nw((int) (s * maxwidth));
+ b = sigma_td_nw((int)(s * maxwidth));
correct_table_matrix2(t, i, 1, s, b);
}
return;
@@ -3243,7 +3229,7 @@ set_table_matrix0(struct table *t, int maxwidth)
for (i = bcol; i < ecol; i++)
w1 += we[i];
s = w / (w0 + w - w1);
- a = (int) (s * maxwidth);
+ a = (int)(s * maxwidth);
b = sigma_td_nw(a);
correct_table_matrix2(t, bcol, cell->colspan[j], s, b);
}
@@ -3255,7 +3241,7 @@ set_table_matrix0(struct table *t, int maxwidth)
for (i = 0; i < size; i++) {
if (expand[i] == 0) {
s = we[i] / max(w1, 1.);
- b = sigma_td_nw((int) (s * maxwidth));
+ b = sigma_td_nw((int)(s * maxwidth));
}
else {
s = we[i] / max(w0 - w1, 1.);
@@ -3292,8 +3278,8 @@ set_table_matrix(struct table *t, int width)
correct_table_matrix(t, i, 1, a, b);
}
else if (t->fixed_width[i] < 0) {
- s = -(double) t->fixed_width[i] / 100.;
- b = sigma_td((int) (s * width));
+ s = -(double)t->fixed_width[i] / 100.;
+ b = sigma_td((int)(s * width));
correct_table_matrix2(t, i, 1, s, b);
}
}
@@ -3302,14 +3288,12 @@ set_table_matrix(struct table *t, int width)
if (cell->fixed_width[j] > 0) {
a = max(cell->fixed_width[j], cell->minimum_width[j]);
b = sigma_td(a);
- correct_table_matrix(t, cell->col[j],
- cell->colspan[j], a, b);
+ correct_table_matrix(t, cell->col[j], cell->colspan[j], a, b);
}
else if (cell->fixed_width[j] < 0) {
- s = -(double) cell->fixed_width[j] / 100.;
- b = sigma_td((int) (s * width));
- correct_table_matrix2(t, cell->col[j],
- cell->colspan[j], s, b);
+ s = -(double)cell->fixed_width[j] / 100.;
+ b = sigma_td((int)(s * width));
+ correct_table_matrix2(t, cell->col[j], cell->colspan[j], s, b);
}
}
diff --git a/table.h b/table.h
index 6076b4b..74b55a1 100644
--- a/table.h
+++ b/table.h
@@ -1,4 +1,4 @@
-/* $Id: table.h,v 1.3 2001/11/15 00:32:13 a-ito Exp $ */
+/* $Id: table.h,v 1.4 2001/11/24 02:01:26 ukai Exp $ */
#if (defined(MESCHACH) && !defined(MATRIX))
#define MATRIX
#endif /* (defined(MESCHACH) && !defined(MATRIX))
@@ -106,7 +106,7 @@ struct table {
short ntable;
short tables_size;
TextList *suspended_data;
-/* use for counting skipped spaces */
+ /* use for counting skipped spaces */
struct table_linfo linfo;
#ifdef MATRIX
MAT *matrix;
diff --git a/terms.c b/terms.c
index ba707c2..8721c3d 100644
--- a/terms.c
+++ b/terms.c
@@ -1,4 +1,4 @@
-/* $Id: terms.c,v 1.15 2001/11/22 19:44:33 ukai Exp $ */
+/* $Id: terms.c,v 1.16 2001/11/24 02:01:26 ukai Exp $ */
/*
* An original curses library for EUC-kanji by Akinori ITO, December 1989
* revised by Akinori ITO, January 1995
@@ -48,7 +48,7 @@ static int tty;
#include <os2.h>
#ifndef JP_CHARSET
-extern int CodePage;
+extern int CodePage;
#endif /* !JP_CHARSET */
#endif /* __EMX__ */
@@ -86,7 +86,7 @@ init_win32_console_handle(void)
check_win32_console();
winVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- if (GetVersionEx (&winVersionInfo) == 0) {
+ if (GetVersionEx(&winVersionInfo) == 0) {
fprintf(stderr, "can't get Windows version information.\n");
exit(1);
}
@@ -101,9 +101,8 @@ init_win32_console_handle(void)
}
else {
hConIn = CreateFile("CONIN$", GENERIC_READ,
- FILE_SHARE_READ,
- NULL, OPEN_EXISTING,
- 0, NULL);
+ FILE_SHARE_READ,
+ NULL, OPEN_EXISTING, 0, NULL);
}
}
}
@@ -112,10 +111,10 @@ init_win32_console_handle(void)
static int
read_win32_console_input(void)
{
- INPUT_RECORD *p;
- DWORD nevents;
+ INPUT_RECORD *p;
+ DWORD nevents;
- if (nConIn >= nConInMax) {
+ if (nConIn >= nConInMax) {
INPUT_RECORD *oldv;
nConInMax = (nConInMax / 2 + 1) * 3;
@@ -129,11 +128,11 @@ read_win32_console_input(void)
if (ReadConsoleInput(hConIn, p, 1, &nevents) && nevents) {
switch (p->EventType) {
case KEY_EVENT:
- if (p->Event.KeyEvent.bKeyDown
+ if (p->Event.KeyEvent.bKeyDown
|| !p->Event.KeyEvent.uChar.AsciiChar)
- break;
+ break;
#ifdef USE_MOUSE
- event_found:
+ event_found:
#endif
++nConIn;
return 1;
@@ -162,7 +161,7 @@ read_win32_console(char *s, int n)
if (hConIn == INVALID_HANDLE_VALUE)
return read(tty, s, n);
- for (i = 0 ; i < n ;)
+ for (i = 0; i < n;)
#ifdef USE_MOUSE
if (iMouseConToXTerm) {
s[i++] = MouseConToXTerm[iMouseConToXTerm++];
@@ -172,47 +171,51 @@ read_win32_console(char *s, int n)
}
else
#endif
- if (iConIn < nConIn)
- switch (ConInV[iConIn].EventType) {
+ if (iConIn < nConIn)
+ switch (ConInV[iConIn].EventType) {
#ifdef USE_MOUSE
- case MOUSE_EVENT:
- if (mouseActive) {
- mer = &ConInV[iConIn++].Event.MouseEvent;
- MouseConToXTerm[0] = '\033';
- MouseConToXTerm[1] = '[';
- MouseConToXTerm[2] = 'M';
- MouseConToXTerm[4] = mer->dwMousePosition.X + '!';
- MouseConToXTerm[5] = mer->dwMousePosition.Y + '!';
- if (~(mer->dwButtonState) & lastConMouse.dwButtonState)
- MouseConToXTerm[3] = MOUSE_BTN_UP + ' ';
- else if (!(down = mer->dwButtonState & ~lastConMouse.dwButtonState & ~(~0 << 5))) {
- lastConMouse = *mer;
- break;
- }
- else
- MouseConToXTerm[3] = (down & (1 << 0) ? MOUSE_BTN1_DOWN :
- down & (1 << 1) ? MOUSE_BTN3_DOWN :
- down & (1 << 2) ? MOUSE_BTN2_DOWN :
- down & (1 << 3) ? MOUSE_BTN4_DOWN_XTERM :
- MOUSE_BTN5_DOWN_XTERM) + ' ';
-
- s[i++] = MouseConToXTerm[iMouseConToXTerm++];
+ case MOUSE_EVENT:
+ if (mouseActive) {
+ mer = &ConInV[iConIn++].Event.MouseEvent;
+ MouseConToXTerm[0] = '\033';
+ MouseConToXTerm[1] = '[';
+ MouseConToXTerm[2] = 'M';
+ MouseConToXTerm[4] = mer->dwMousePosition.X + '!';
+ MouseConToXTerm[5] = mer->dwMousePosition.Y + '!';
+ if (~(mer->dwButtonState) & lastConMouse.dwButtonState)
+ MouseConToXTerm[3] = MOUSE_BTN_UP + ' ';
+ else if (!
+ (down =
+ mer->dwButtonState & ~lastConMouse.
+ dwButtonState & ~(~0 << 5))) {
lastConMouse = *mer;
+ break;
}
else
- ++iConIn;
- break;
-#endif
- default:
- s[i++] = ConInV[iConIn++].Event.KeyEvent.uChar.AsciiChar;
- break;
+ MouseConToXTerm[3] =
+ (down & (1 << 0) ? MOUSE_BTN1_DOWN : down &
+ (1 << 1) ? MOUSE_BTN3_DOWN : down & (1 << 2) ?
+ MOUSE_BTN2_DOWN : down & (1 << 3) ?
+ MOUSE_BTN4_DOWN_XTERM : MOUSE_BTN5_DOWN_XTERM) +
+ ' ';
+
+ s[i++] = MouseConToXTerm[iMouseConToXTerm++];
+ lastConMouse = *mer;
}
- else {
- iConIn = nConIn = 0;
-
- if (!read_win32_console_input())
- break;
+ else
+ ++iConIn;
+ break;
+#endif
+ default:
+ s[i++] = ConInV[iConIn++].Event.KeyEvent.uChar.AsciiChar;
+ break;
}
+ else {
+ iConIn = nConIn = 0;
+
+ if (!read_win32_console_input())
+ break;
+ }
if (iConIn >= nConIn)
iConIn = nConIn = 0;
@@ -349,8 +352,8 @@ static
char bp[1024], funcstr[256];
char *T_cd, *T_ce, *T_kr, *T_kl, *T_cr, *T_bt, *T_ta, *T_sc, *T_rc,
-*T_so, *T_se, *T_us, *T_ue, *T_cl, *T_cm, *T_al, *T_sr, *T_md, *T_me,
-*T_ti, *T_te, *T_nd, *T_as, *T_ae, *T_eA, *T_ac, *T_op;
+ *T_so, *T_se, *T_us, *T_ue, *T_cl, *T_cm, *T_al, *T_sr, *T_md, *T_me,
+ *T_ti, *T_te, *T_nd, *T_as, *T_ae, *T_eA, *T_ac, *T_op;
int LINES, COLS;
#if defined(CYGWIN) && LANG == JA
@@ -393,8 +396,8 @@ writestr(char *s)
#ifdef USE_MOUSE
static char *xterm_mouse_term[] = {
- "xterm", "kterm", "rxvt", "cygwin",
- NULL
+ "xterm", "kterm", "rxvt", "cygwin",
+ NULL
};
#endif
@@ -422,10 +425,10 @@ set_tty(void)
char *term = getenv("TERM");
char **p;
for (p = xterm_mouse_term; *p != NULL; p++) {
- if (!strncmp(term, *p, strlen(*p))) {
- is_xterm = 1;
- break;
- }
+ if (!strncmp(term, *p, strlen(*p))) {
+ is_xterm = 1;
+ break;
+ }
}
}
#endif
@@ -444,7 +447,8 @@ ttymode_set(int mode, int imode)
#endif /* not HAVE_SGTTY_H */
while (TerminalSet(tty, &ioval) == -1) {
- if (errno == EINTR || errno == EAGAIN) continue;
+ if (errno == EINTR || errno == EAGAIN)
+ continue;
printf("Error occured while set %x: errno=%d\n", mode, errno);
reset_exit(SIGNAL_ARGLIST);
}
@@ -462,7 +466,8 @@ ttymode_reset(int mode, int imode)
#endif /* not HAVE_SGTTY_H */
while (TerminalSet(tty, &ioval) == -1) {
- if (errno == EINTR || errno == EAGAIN) continue;
+ if (errno == EINTR || errno == EAGAIN)
+ continue;
printf("Error occured while reset %x: errno=%d\n", mode, errno);
reset_exit(SIGNAL_ARGLIST);
}
@@ -477,7 +482,8 @@ set_cc(int spec, int val)
TerminalGet(tty, &ioval);
ioval.c_cc[spec] = val;
while (TerminalSet(tty, &ioval) == -1) {
- if (errno == EINTR || errno == EAGAIN) continue;
+ if (errno == EINTR || errno == EAGAIN)
+ continue;
printf("Error occured: errno=%d\n", errno);
reset_exit(SIGNAL_ARGLIST);
}
@@ -495,9 +501,9 @@ reset_tty(void)
{
if (DisplayCode != CODE_EUC && DisplayCode != CODE_SJIS)
#if defined(__EMX__)&&!defined(JP_CHARSET)
- if(!CodePage)
+ if (!CodePage)
#endif
- writestr("\033(B"); /* designate US_ASCII */
+ writestr("\033(B"); /* designate US_ASCII */
writestr(T_op); /* turn off */
writestr(T_me);
if (!Do_not_use_ti_te) {
@@ -546,7 +552,7 @@ set_int(void)
#ifdef SIGBUS
signal(SIGBUS, error_dump);
#endif /* SIGBUS */
-/* signal(SIGSEGV, error_dump); */
+ /* signal(SIGSEGV, error_dump); */
}
@@ -556,14 +562,14 @@ setgraphchar(void)
int c, i, n;
for (c = 0; c < 96; c++)
- gcmap[c] = (char) (c + ' ');
+ gcmap[c] = (char)(c + ' ');
if (!T_ac)
return;
n = strlen(T_ac);
for (i = 0; i < n - 1; i += 2) {
- c = (unsigned) T_ac[i] - ' ';
+ c = (unsigned)T_ac[i] - ' ';
if (c >= 0 && c < 96)
gcmap[c] = T_ac[i + 1];
}
@@ -632,12 +638,13 @@ getTCstr(void)
GETSTR(T_op, "op"); /* set default color pair to its original
* * * * * * * value */
#if defined( CYGWIN ) && CYGWIN < 1
-/* for TERM=pcansi on MS-DOS prompt.
+ /* for TERM=pcansi on MS-DOS prompt. */
+#if 0
T_eA = "";
T_as = "\033[12m";
T_ae = "\033[10m";
T_ac = "l\001k\002m\003j\004x\005q\006n\020a\024v\025w\026u\027t\031";
-*/
+#endif
T_eA = "";
T_as = "";
T_ae = "";
@@ -673,11 +680,11 @@ setlinescols(void)
}
}
#ifndef JP_CHARSET
- else{
- ULONG CpList[8],CpSize;
- CodePage=-1;
- if(!DosQueryCp(sizeof(CpList),CpList,&CpSize))
- CodePage=*CpList;
+ else {
+ ULONG CpList[8], CpSize;
+ CodePage = -1;
+ if (!DosQueryCp(sizeof(CpList), CpList, &CpSize))
+ CodePage = *CpList;
}
#endif
}
@@ -689,14 +696,10 @@ setlinescols(void)
LINES = wins.ws_row;
COLS = wins.ws_col;
}
-#endif /* defined(HAVE-TERMIOS_H) && defined(TIOCGWINSZ) */
- if (LINES <= 0 &&
- (p = getenv("LINES")) != NULL &&
- (i = atoi(p)) >= 0)
+#endif /* defined(HAVE-TERMIOS_H) && defined(TIOCGWINSZ) */
+ if (LINES <= 0 && (p = getenv("LINES")) != NULL && (i = atoi(p)) >= 0)
LINES = i;
- if (COLS <= 0 &&
- (p = getenv("COLUMNS")) != NULL &&
- (i = atoi(p)) >= 0)
+ if (COLS <= 0 && (p = getenv("COLUMNS")) != NULL && (i = atoi(p)) >= 0)
COLS = i;
if (LINES <= 0)
LINES = tgetnum("li"); /* number of line */
@@ -779,7 +782,7 @@ write1(char c)
break;
case C_WCHAR1:
wmode = C_WCHAR2;
- putchars((unsigned char) wbuf, (unsigned char) c, ttyf);
+ putchars((unsigned char)wbuf, (unsigned char)c, ttyf);
break;
}
}
@@ -860,7 +863,7 @@ putchars(unsigned char c1, unsigned char c2, FILE * f)
put_sjis(s, c1 & 0x7f, c2 & 0x7f);
break;
}
- if (! s->length) {
+ if (!s->length) {
putc('?', f);
putc('?', f);
return;
@@ -960,10 +963,12 @@ addch(char c)
touch_column(CurColumn + 1);
if (pr[CurColumn + 1] & S_EOL) {
p[CurColumn + 1] = ' ';
- SETPROP(pr[CurColumn + 1], (pr[CurColumn + 1] & M_CEOL) | C_ASCII);
+ SETPROP(pr[CurColumn + 1],
+ (pr[CurColumn + 1] & M_CEOL) | C_ASCII);
}
#ifdef JP_CHARSET
- else if (CHMODE(pr[CurColumn + 1]) == C_WCHAR1 && CurColumn < COLS - 2)
+ else if (CHMODE(pr[CurColumn + 1]) == C_WCHAR1
+ && CurColumn < COLS - 2)
touch_column(CurColumn + 2);
#endif /* JP_CHARSET */
}
@@ -973,7 +978,8 @@ addch(char c)
if (CurColumn >= 1 && CHMODE(pr[CurColumn - 1]) == C_WCHAR1 &&
CHMODE(CurrentMode) != C_WCHAR2) {
p[CurColumn - 1] = ' ';
- SETPROP(pr[CurColumn - 1], (pr[CurColumn - 1] & ~C_WHICHCHAR) | C_ASCII);
+ SETPROP(pr[CurColumn - 1],
+ (pr[CurColumn - 1] & ~C_WHICHCHAR) | C_ASCII);
touch_line();
touch_column(CurColumn - 1);
}
@@ -981,7 +987,8 @@ addch(char c)
if (CurColumn < COLS - 1 && CHMODE(pr[CurColumn + 1]) == C_WCHAR2 &&
CHMODE(CurrentMode) != C_WCHAR1) {
p[CurColumn + 1] = ' ';
- SETPROP(pr[CurColumn + 1], (pr[CurColumn + 1] & ~C_WHICHCHAR) | C_ASCII);
+ SETPROP(pr[CurColumn + 1],
+ (pr[CurColumn + 1] & ~C_WHICHCHAR) | C_ASCII);
touch_line();
touch_column(CurColumn + 1);
}
@@ -1035,8 +1042,7 @@ addch(char c)
else if (c == '\b' && CurColumn > 0) { /* Backspace */
CurColumn--;
#ifdef JP_CHARSET
- if (CurColumn > 0 &&
- CHMODE(pr[CurColumn]) == C_WCHAR2)
+ if (CurColumn > 0 && CHMODE(pr[CurColumn]) == C_WCHAR2)
CurColumn--;
#endif /* JP_CHARSET */
}
@@ -1265,9 +1271,9 @@ refresh(void)
#if defined(__CYGWIN__) && LANG == JA
if (isWinConsole)
#endif /* defined(__CYGWIN__) && LANG == JA */
- if (line == LINES - 1 && col == COLS - 1)
- break;
-#endif /* !defined(USE_BG_COLOR) || defined(__CYGWIN__) */
+ if (line == LINES - 1 && col == COLS - 1)
+ break;
+#endif /* !defined(USE_BG_COLOR) || defined(__CYGWIN__) */
if ((!(pr[col] & S_STANDOUT) && (mode & S_STANDOUT)) ||
(!(pr[col] & S_UNDERLINE) && (mode & S_UNDERLINE)) ||
(!(pr[col] & S_BOLD) && (mode & S_BOLD)) ||
@@ -1276,19 +1282,20 @@ refresh(void)
|| (!(pr[col] & S_BCOLORED) && (mode & S_BCOLORED))
#endif /* USE_BG_COLOR */
|| (!(pr[col] & S_GRAPHICS) && (mode & S_GRAPHICS))) {
- if ((mode & S_COLORED)
+ if ((mode & S_COLORED)
#ifdef USE_BG_COLOR
- || (mode & S_BCOLORED)
+ || (mode & S_BCOLORED)
#endif /* USE_BG_COLOR */
)
writestr(T_op);
- if (mode & S_GRAPHICS)
+ if (mode & S_GRAPHICS)
writestr(T_ae);
writestr(T_me);
mode &= ~M_MEND;
}
if ((*dirty & L_NEED_CE && col >= ScreenImage[line]->eol) ?
- need_redraw(pc[col], pr[col], ' ', 0) : (pr[col] & S_DIRTY)) {
+ need_redraw(pc[col], pr[col], ' ',
+ 0) : (pr[col] & S_DIRTY)) {
if (pcol == col - 1)
writestr(T_nd);
else if (pcol != col)
@@ -1306,18 +1313,19 @@ refresh(void)
writestr(T_md);
mode |= S_BOLD;
}
- if ((pr[col] & S_COLORED) && (pr[col] ^ mode) & COL_FCOLOR) {
- color = (pr[col] & COL_FCOLOR);
- mode = ((mode & ~COL_FCOLOR) | color);
- writestr(color_seq(color));
- }
+ if ((pr[col] & S_COLORED) && (pr[col] ^ mode) & COL_FCOLOR) {
+ color = (pr[col] & COL_FCOLOR);
+ mode = ((mode & ~COL_FCOLOR) | color);
+ writestr(color_seq(color));
+ }
#ifdef USE_BG_COLOR
- if ((pr[col] & S_BCOLORED) && (pr[col] ^ mode) & COL_BCOLOR) {
- bcolor = (pr[col] & COL_BCOLOR);
- mode = ((mode & ~COL_BCOLOR) | bcolor);
- writestr(bcolor_seq(bcolor));
- }
-#endif /* USE_BG_COLOR */
+ if ((pr[col] & S_BCOLORED)
+ && (pr[col] ^ mode) & COL_BCOLOR) {
+ bcolor = (pr[col] & COL_BCOLOR);
+ mode = ((mode & ~COL_BCOLOR) | bcolor);
+ writestr(bcolor_seq(bcolor));
+ }
+#endif /* USE_BG_COLOR */
if ((pr[col] & S_GRAPHICS) && !(mode & S_GRAPHICS)) {
if (!graph_enabled) {
graph_enabled = 1;
@@ -1326,7 +1334,8 @@ refresh(void)
writestr(T_as);
mode |= S_GRAPHICS;
}
- write1((pr[col] & S_GRAPHICS) ? graphchar(pc[col]) : pc[col]);
+ write1((pr[col] & S_GRAPHICS) ? graphchar(pc[col]) :
+ pc[col]);
pcol = col + 1;
}
}
@@ -1719,7 +1728,7 @@ term_cooked(void)
/* On XFree86/OS2, some scrambled characters
* will appear when asserting IEXTEN flag.
*/
- ttymode_set((TTY_MODE)&~IEXTEN,0);
+ ttymode_set((TTY_MODE) & ~IEXTEN, 0);
#else
ttymode_set(TTY_MODE, 0);
#endif
@@ -1749,15 +1758,16 @@ getch(void)
while (
#ifdef __CYGWIN__
- read_win32_console(&c, 1)
+ read_win32_console(&c, 1)
#else
- read(tty, &c, 1)
+ read(tty, &c, 1)
#endif
- < (int)1) {
- if (errno == EINTR || errno == EAGAIN) continue;
- /* error happend on read(2) */
- quitfm();
- break; /* unreachable */
+ < (int)1) {
+ if (errno == EINTR || errno == EAGAIN)
+ continue;
+ /* error happend on read(2) */
+ quitfm();
+ break; /* unreachable */
}
return c;
}
@@ -1807,7 +1817,7 @@ sysm_getch()
int
do_getch()
{
- if (is_xterm || ! sysm_handler)
+ if (is_xterm || !sysm_handler)
return getch();
else
return sysm_getch();
@@ -1850,14 +1860,14 @@ skip_escseq(void)
c = getch();
#ifdef USE_MOUSE
if (is_xterm && c == 'M') {
- getch();
- getch();
- getch();
+ getch();
+ getch();
+ getch();
}
else
-#endif
- while (IS_DIGIT(c))
- c = getch();
+#endif
+ while (IS_DIGIT(c))
+ c = getch();
}
}
@@ -1911,7 +1921,7 @@ mouse_init()
conn.maxMod = 0;
conn.minMod = 0;
if (Gpm_Open(&conn, 0) == -2) {
- /*
+ /*
* If Gpm_Open() success, returns >= 0
* Gpm_Open() returns -2 in case of xterm.
* Gpm_Close() is necessary here. Otherwise,
@@ -1920,7 +1930,8 @@ mouse_init()
*/
Gpm_Close();
is_xterm = 1;
- } else {
+ }
+ else {
gpm_handler = gpm_process_mouse;
}
if (is_xterm) {
@@ -1974,7 +1985,7 @@ mouse_init()
mi.operation = MOUSE_MODE;
mi.u.mode.mode = 0;
mi.u.mode.signal = SIGUSR2;
- sysm_handler = NULL;
+ sysm_handler = NULL;
if (ioctl(tty, CONS_MOUSECTL, &mi) != -1) {
signal(SIGUSR2, sysmouse);
mi.operation = MOUSE_SHOW;
@@ -2015,7 +2026,7 @@ mouse_init()
#ifdef __CYGWIN__
&& hConIn == INVALID_HANDLE_VALUE
#endif
- ) {
+ ) {
XTERM_ON;
}
mouseActive = 1;
@@ -2030,7 +2041,7 @@ mouse_end()
#ifdef __CYGWIN__
&& hConIn == INVALID_HANDLE_VALUE
#endif
- ) {
+ ) {
XTERM_OFF;
}
mouseActive = 0;
diff --git a/textlist.c b/textlist.c
index 4b61173..8445a20 100644
--- a/textlist.c
+++ b/textlist.c
@@ -1,4 +1,4 @@
-/* $Id: textlist.c,v 1.3 2001/11/15 00:32:13 a-ito Exp $ */
+/* $Id: textlist.c,v 1.4 2001/11/24 02:01:26 ukai Exp $ */
#include "textlist.h"
#include "indep.h"
#include "Str.h"
@@ -7,7 +7,7 @@
/* General doubly linked list */
ListItem *
-newListItem(void *s, ListItem * n, ListItem * p)
+newListItem(void *s, ListItem *n, ListItem *p)
{
ListItem *it;
it = New(ListItem);
@@ -27,7 +27,7 @@ newGeneralList()
}
void
-pushValue(GeneralList * tl, void *s)
+pushValue(GeneralList *tl, void *s)
{
ListItem *it;
if (s == NULL)
@@ -46,7 +46,7 @@ pushValue(GeneralList * tl, void *s)
}
void *
-popValue(GeneralList * tl)
+popValue(GeneralList *tl)
{
ListItem *f;
@@ -63,7 +63,7 @@ popValue(GeneralList * tl)
}
void *
-rpopValue(GeneralList * tl)
+rpopValue(GeneralList *tl)
{
ListItem *f;
@@ -80,7 +80,7 @@ rpopValue(GeneralList * tl)
}
GeneralList *
-appendGeneralList(GeneralList * tl, GeneralList * tl2)
+appendGeneralList(GeneralList *tl, GeneralList *tl2)
{
if (tl && tl2) {
if (tl2->first) {
@@ -118,8 +118,8 @@ newTextLine(Str line, int pos)
return lbuf;
}
-void
-appendTextLine(TextLineList * tl, Str line, int pos)
+void
+appendTextLine(TextLineList *tl, Str line, int pos)
{
TextLine *lbuf;
@@ -135,5 +135,3 @@ appendTextLine(TextLineList * tl, Str line, int pos)
lbuf->pos += pos;
}
}
-
-
diff --git a/textlist.h b/textlist.h
index 00f5754..55a2e65 100644
--- a/textlist.h
+++ b/textlist.h
@@ -1,4 +1,4 @@
-/* $Id: textlist.h,v 1.2 2001/11/20 17:49:23 ukai Exp $ */
+/* $Id: textlist.h,v 1.3 2001/11/24 02:01:26 ukai Exp $ */
#ifndef TEXTLIST_H
#define TEXTLIST_H
#include "Str.h"
@@ -17,11 +17,11 @@ typedef struct _generallist {
short nitem;
} GeneralList;
-extern ListItem *newListItem(void *s, ListItem * n, ListItem * p);
+extern ListItem *newListItem(void *s, ListItem *n, ListItem *p);
extern GeneralList *newGeneralList(void);
-extern void pushValue(GeneralList * tl, void *s);
-extern void *popValue(GeneralList * tl);
-extern void *rpopValue(GeneralList * tl);
+extern void pushValue(GeneralList *tl, void *s);
+extern void *popValue(GeneralList *tl);
+extern void *rpopValue(GeneralList *tl);
extern GeneralList *appendGeneralList(GeneralList *, GeneralList *);
/* Text list */
@@ -64,7 +64,7 @@ typedef struct _textlinelist {
} TextLineList;
extern TextLine *newTextLine(Str line, int pos);
-extern void appendTextLine(TextLineList * tl, Str line, int pos);
+extern void appendTextLine(TextLineList *tl, Str line, int pos);
#define newTextLineList() ((TextLineList *)newGeneralList())
#define pushTextLine(tl,lbuf) pushValue((GeneralList *)(tl),(void *)(lbuf))
#define popTextLine(tl) ((TextLine *)popValue((GeneralList *)(tl)))
diff --git a/ucs_eucjp.h b/ucs_eucjp.h
index 6dd4bcd..78c6e5c 100644
--- a/ucs_eucjp.h
+++ b/ucs_eucjp.h
@@ -1,120 +1,119 @@
-/* $Id: ucs_eucjp.h,v 1.2 2001/11/20 17:49:23 ukai Exp $ */
-static entity_map ucs_eucjp_map[] =
-{
- { 0x0152, "OE" },
- { 0x0153, "oe" },
- { 0x0178, "Y:" },
- { 0x0192, "f" },
- { 0x02C6, "^" },
- { 0x02DC, "~" },
- { 0x0391, "Α" },
- { 0x0392, "Β" },
- { 0x0393, "Γ" },
- { 0x0394, "Δ" },
- { 0x0395, "Ε" },
- { 0x0396, "Ζ" },
- { 0x0397, "Η" },
- { 0x0398, "Θ" },
- { 0x0399, "Ι" },
- { 0x039A, "Κ" },
- { 0x039B, "Λ" },
- { 0x039C, "Μ" },
- { 0x039D, "Ν" },
- { 0x039E, "Ξ" },
- { 0x039F, "Ο" },
- { 0x03A0, "Π" },
- { 0x03A1, "Ρ" },
- { 0x03A3, "Σ" },
- { 0x03A4, "Τ" },
- { 0x03A5, "Υ" },
- { 0x03A6, "Φ" },
- { 0x03A7, "Χ" },
- { 0x03A8, "Ψ" },
- { 0x03A9, "Ω" },
- { 0x03B1, "α" },
- { 0x03B2, "β" },
- { 0x03B3, "γ" },
- { 0x03B4, "δ" },
- { 0x03B5, "ε" },
- { 0x03B6, "ζ" },
- { 0x03B7, "η" },
- { 0x03B8, "θ" },
- { 0x03B9, "ι" },
- { 0x03BA, "κ" },
- { 0x03BB, "λ" },
- { 0x03BC, "μ" },
- { 0x03BD, "ν" },
- { 0x03BE, "ξ" },
- { 0x03BF, "ο" },
- { 0x03C0, "π" },
- { 0x03C1, "ρ" },
- { 0x03C2, "σ" },
- { 0x03C3, "σ" },
- { 0x03C4, "τ" },
- { 0x03C5, "υ" },
- { 0x03C6, "φ" },
- { 0x03C7, "χ" },
- { 0x03C8, "ψ" },
- { 0x03C9, "ω" },
- { 0x2002, " " },
- { 0x2003, " " },
- { 0x2013, "‐" },
- { 0x2014, "−" },
- { 0x2018, "‘" },
- { 0x2019, "’" },
- { 0x201A, "," },
- { 0x201C, "“" },
- { 0x201D, "”" },
- { 0x201E, ",," },
- { 0x2020, "†" },
- { 0x2021, "‡" },
- { 0x2022, "・" },
- { 0x2026, "…" },
- { 0x2030, "‰" },
- { 0x2032, "′" },
- { 0x2033, "″" },
- { 0x2039, "<" },
- { 0x203A, ">" },
- { 0x203E, " ̄" },
- { 0x2044, "/" },
- { 0x20AC, "=C=" },
- { 0x2122, "TM" },
- { 0x2190, "←" },
- { 0x2191, "↑" },
- { 0x2192, "→" },
- { 0x2193, "↓" },
- { 0x21D2, "⇒" },
- { 0x21D4, "⇔" },
- { 0x2200, "∀" },
- { 0x2202, "∂" },
- { 0x2203, "∃" },
- { 0x2205, "φ" },
- { 0x2207, "∇" },
- { 0x2208, "∈" },
- { 0x220B, "∋" },
- { 0x220F, "Π" },
- { 0x2211, "Σ" },
- { 0x2212, "−" },
- { 0x221A, "√" },
- { 0x221D, "∝" },
- { 0x221E, "∞" },
- { 0x2220, "∠" },
- { 0x2227, "∧" },
- { 0x2228, "∨" },
- { 0x2229, "∩" },
- { 0x222A, "∪" },
- { 0x222B, "∫" },
- { 0x2234, "∴" },
- { 0x223C, "〜" },
- { 0x2260, "≠" },
- { 0x2261, "≡" },
- { 0x2264, "≦" },
- { 0x2265, "≧" },
- { 0x2282, "⊂" },
- { 0x2283, "⊃" },
- { 0x2286, "⊆" },
- { 0x2287, "⊇" },
- { 0x22A5, "⊥" },
- { 0x25CA, "◇" },
- { 0x2666, "◆" },
+/* $Id: ucs_eucjp.h,v 1.3 2001/11/24 02:01:26 ukai Exp $ */
+static entity_map ucs_eucjp_map[] = {
+ {0x0152, "OE"},
+ {0x0153, "oe"},
+ {0x0178, "Y:"},
+ {0x0192, "f"},
+ {0x02C6, "^"},
+ {0x02DC, "~"},
+ {0x0391, "Α"},
+ {0x0392, "Β"},
+ {0x0393, "Γ"},
+ {0x0394, "Δ"},
+ {0x0395, "Ε"},
+ {0x0396, "Ζ"},
+ {0x0397, "Η"},
+ {0x0398, "Θ"},
+ {0x0399, "Ι"},
+ {0x039A, "Κ"},
+ {0x039B, "Λ"},
+ {0x039C, "Μ"},
+ {0x039D, "Ν"},
+ {0x039E, "Ξ"},
+ {0x039F, "Ο"},
+ {0x03A0, "Π"},
+ {0x03A1, "Ρ"},
+ {0x03A3, "Σ"},
+ {0x03A4, "Τ"},
+ {0x03A5, "Υ"},
+ {0x03A6, "Φ"},
+ {0x03A7, "Χ"},
+ {0x03A8, "Ψ"},
+ {0x03A9, "Ω"},
+ {0x03B1, "α"},
+ {0x03B2, "β"},
+ {0x03B3, "γ"},
+ {0x03B4, "δ"},
+ {0x03B5, "ε"},
+ {0x03B6, "ζ"},
+ {0x03B7, "η"},
+ {0x03B8, "θ"},
+ {0x03B9, "ι"},
+ {0x03BA, "κ"},
+ {0x03BB, "λ"},
+ {0x03BC, "μ"},
+ {0x03BD, "ν"},
+ {0x03BE, "ξ"},
+ {0x03BF, "ο"},
+ {0x03C0, "π"},
+ {0x03C1, "ρ"},
+ {0x03C2, "σ"},
+ {0x03C3, "σ"},
+ {0x03C4, "τ"},
+ {0x03C5, "υ"},
+ {0x03C6, "φ"},
+ {0x03C7, "χ"},
+ {0x03C8, "ψ"},
+ {0x03C9, "ω"},
+ {0x2002, " "},
+ {0x2003, " "},
+ {0x2013, "‐"},
+ {0x2014, "−"},
+ {0x2018, "‘"},
+ {0x2019, "’"},
+ {0x201A, ","},
+ {0x201C, "“"},
+ {0x201D, "”"},
+ {0x201E, ",,"},
+ {0x2020, "†"},
+ {0x2021, "‡"},
+ {0x2022, "・"},
+ {0x2026, "…"},
+ {0x2030, "‰"},
+ {0x2032, "′"},
+ {0x2033, "″"},
+ {0x2039, "<"},
+ {0x203A, ">"},
+ {0x203E, " ̄"},
+ {0x2044, "/"},
+ {0x20AC, "=C="},
+ {0x2122, "TM"},
+ {0x2190, "←"},
+ {0x2191, "↑"},
+ {0x2192, "→"},
+ {0x2193, "↓"},
+ {0x21D2, "⇒"},
+ {0x21D4, "⇔"},
+ {0x2200, "∀"},
+ {0x2202, "∂"},
+ {0x2203, "∃"},
+ {0x2205, "φ"},
+ {0x2207, "∇"},
+ {0x2208, "∈"},
+ {0x220B, "∋"},
+ {0x220F, "Π"},
+ {0x2211, "Σ"},
+ {0x2212, "−"},
+ {0x221A, "√"},
+ {0x221D, "∝"},
+ {0x221E, "∞"},
+ {0x2220, "∠"},
+ {0x2227, "∧"},
+ {0x2228, "∨"},
+ {0x2229, "∩"},
+ {0x222A, "∪"},
+ {0x222B, "∫"},
+ {0x2234, "∴"},
+ {0x223C, "〜"},
+ {0x2260, "≠"},
+ {0x2261, "≡"},
+ {0x2264, "≦"},
+ {0x2265, "≧"},
+ {0x2282, "⊂"},
+ {0x2283, "⊃"},
+ {0x2286, "⊆"},
+ {0x2287, "⊇"},
+ {0x22A5, "⊥"},
+ {0x25CA, "◇"},
+ {0x2666, "◆"},
};
diff --git a/ucs_latin1.h b/ucs_latin1.h
index e92b685..b8627b1 100644
--- a/ucs_latin1.h
+++ b/ucs_latin1.h
@@ -1,37 +1,36 @@
-/* $Id: ucs_latin1.h,v 1.2 2001/11/20 17:49:23 ukai Exp $ */
-static entity_map ucs_latin1_map[] =
-{
- { 0x0152, "OE" },
- { 0x0153, "oe" },
- { 0x0178, "Y:" },
- { 0x0192, "f" },
- { 0x02C6, "^" },
- { 0x02DC, "~" },
- { 0x03BC, "\xB5" },
- { 0x2002, " " },
- { 0x2003, " " },
- { 0x2013, "\xAD" },
- { 0x2014, "-" },
- { 0x2018, "`" },
- { 0x2019, "'" },
- { 0x201A, "\xB8" },
- { 0x201C, "\"" },
- { 0x201D, "\"" },
- { 0x201E, ",," },
- { 0x2022, "*" },
- { 0x2030, "0/00" },
- { 0x2032, "'" },
- { 0x2033, "\"" },
- { 0x2039, "<" },
- { 0x203A, ">" },
- { 0x2044, "/" },
- { 0x20AC, "=C=" },
- { 0x2122, "TM" },
- { 0x2205, "\xF8" },
- { 0x2212, "-" },
- { 0x223C, "~" },
- { 0x2260, "!=" },
- { 0x2261, "=" },
- { 0x2264, "<=" },
- { 0x2265, ">=" },
+/* $Id: ucs_latin1.h,v 1.3 2001/11/24 02:01:26 ukai Exp $ */
+static entity_map ucs_latin1_map[] = {
+ {0x0152, "OE"},
+ {0x0153, "oe"},
+ {0x0178, "Y:"},
+ {0x0192, "f"},
+ {0x02C6, "^"},
+ {0x02DC, "~"},
+ {0x03BC, "\xB5"},
+ {0x2002, " "},
+ {0x2003, " "},
+ {0x2013, "\xAD"},
+ {0x2014, "-"},
+ {0x2018, "`"},
+ {0x2019, "'"},
+ {0x201A, "\xB8"},
+ {0x201C, "\""},
+ {0x201D, "\""},
+ {0x201E, ",,"},
+ {0x2022, "*"},
+ {0x2030, "0/00"},
+ {0x2032, "'"},
+ {0x2033, "\""},
+ {0x2039, "<"},
+ {0x203A, ">"},
+ {0x2044, "/"},
+ {0x20AC, "=C="},
+ {0x2122, "TM"},
+ {0x2205, "\xF8"},
+ {0x2212, "-"},
+ {0x223C, "~"},
+ {0x2260, "!="},
+ {0x2261, "="},
+ {0x2264, "<="},
+ {0x2265, ">="},
};
diff --git a/url.c b/url.c
index f97aa26..a608522 100644
--- a/url.c
+++ b/url.c
@@ -1,4 +1,4 @@
-/* $Id: url.c,v 1.9 2001/11/23 20:06:40 ukai Exp $ */
+/* $Id: url.c,v 1.10 2001/11/24 02:01:26 ukai Exp $ */
#include "fm.h"
#include <sys/types.h>
#include <sys/socket.h>
@@ -12,7 +12,7 @@
#include <sys/stat.h>
#ifdef __EMX__
-#include <io.h> /* ?? */
+#include <io.h> /* ?? */
#endif /* __EMX__ */
#include "html.h"
@@ -33,8 +33,7 @@
#ifdef INET6
/* see rc.c, "dns_order" and dnsorders[] */
-int ai_family_order_table[3][3] =
-{
+int ai_family_order_table[3][3] = {
{PF_UNSPEC, PF_UNSPEC, PF_UNSPEC}, /* 0:unspec */
{PF_INET, PF_INET6, PF_UNSPEC}, /* 1:inet inet6 */
{PF_INET6, PF_INET, PF_UNSPEC} /* 2:inet6 inet */
@@ -45,14 +44,13 @@ static JMP_BUF AbortLoading;
/* XXX: note html.h SCM_ */
static int
- DefaultPort[] =
-{
+ DefaultPort[] = {
80, /* http */
70, /* gopher */
21, /* ftp */
21, /* ftpdir */
0, /* local - not defined */
- 0, /* local-CGI - not defined? */
+ 0, /* local-CGI - not defined? */
0, /* exec - not defined? */
119, /* nntp */
119, /* news */
@@ -62,14 +60,13 @@ static int
#endif /* USE_SSL */
};
-struct cmdtable schemetable[] =
-{
+struct cmdtable schemetable[] = {
{"http", SCM_HTTP},
{"gopher", SCM_GOPHER},
{"ftp", SCM_FTP},
{"local", SCM_LOCAL},
{"file", SCM_LOCAL},
-/* {"exec", SCM_EXEC}, */
+ /* {"exec", SCM_EXEC}, */
{"nntp", SCM_NNTP},
{"news", SCM_NEWS},
{"mailto", SCM_MAILTO},
@@ -79,8 +76,7 @@ struct cmdtable schemetable[] =
{NULL, SCM_UNKNOWN},
};
-static struct table2 DefaultGuess[] =
-{
+static struct table2 DefaultGuess[] = {
{"html", "text/html"},
{"HTML", "text/html"},
{"htm", "text/html"},
@@ -112,7 +108,7 @@ static struct table2 DefaultGuess[] =
{NULL, NULL}
};
-static void add_index_file(ParsedURL * pu, URLFile *uf);
+static void add_index_file(ParsedURL *pu, URLFile *uf);
/* #define HTTP_DEFAULT_FILE "/index.html" */
@@ -124,7 +120,7 @@ static void add_index_file(ParsedURL * pu, URLFile *uf);
#include <stdarg.h>
static void
-sock_log(char *message,...)
+sock_log(char *message, ...)
{
FILE *f = fopen("zzzsocklog", "a");
va_list va;
@@ -194,12 +190,12 @@ init_PRNG()
}
if (RAND_status())
goto seeded;
- srand48((long) time(NULL));
+ srand48((long)time(NULL));
while (!RAND_status()) {
l = lrand48();
RAND_seed((unsigned char *)&l, sizeof(long));
}
- seeded:
+ seeded:
if (file)
RAND_write_file(file);
}
@@ -215,7 +211,7 @@ openSSLHandle(int sock)
static int old_ssl_verify_server = -1;
#endif
- if (! old_ssl_forbid_method || ! ssl_forbid_method ||
+ if (!old_ssl_forbid_method || !ssl_forbid_method ||
strcmp(old_ssl_forbid_method, ssl_forbid_method)) {
old_ssl_forbid_method = ssl_forbid_method;
#ifdef USE_SSL_VERIFY
@@ -245,23 +241,33 @@ openSSLHandle(int sock)
SSLeay_add_ssl_algorithms();
SSL_load_error_strings();
if (!(ssl_ctx = SSL_CTX_new(SSLv23_client_method())))
- goto eend;
+ goto eend;
option = SSL_OP_ALL;
if (ssl_forbid_method) {
- if (strchr(ssl_forbid_method, '2')) option |= SSL_OP_NO_SSLv2;
- if (strchr(ssl_forbid_method, '3')) option |= SSL_OP_NO_SSLv3;
- if (strchr(ssl_forbid_method, 't')) option |= SSL_OP_NO_TLSv1;
- if (strchr(ssl_forbid_method, 'T')) option |= SSL_OP_NO_TLSv1;
+ if (strchr(ssl_forbid_method, '2'))
+ option |= SSL_OP_NO_SSLv2;
+ if (strchr(ssl_forbid_method, '3'))
+ option |= SSL_OP_NO_SSLv3;
+ if (strchr(ssl_forbid_method, 't'))
+ option |= SSL_OP_NO_TLSv1;
+ if (strchr(ssl_forbid_method, 'T'))
+ option |= SSL_OP_NO_TLSv1;
}
SSL_CTX_set_options(ssl_ctx, option);
#ifdef USE_SSL_VERIFY
/* derived from openssl-0.9.5/apps/s_{client,cb}.c */
- SSL_CTX_set_verify(ssl_ctx, ssl_verify_server ? SSL_VERIFY_PEER : SSL_VERIFY_NONE, NULL);
+ SSL_CTX_set_verify(ssl_ctx,
+ ssl_verify_server ? SSL_VERIFY_PEER :
+ SSL_VERIFY_NONE, NULL);
if (ssl_cert_file != NULL && *ssl_cert_file != '\0') {
int ng = 1;
- if (SSL_CTX_use_certificate_file(ssl_ctx, ssl_cert_file, SSL_FILETYPE_PEM) > 0) {
- char *key_file = (ssl_key_file == NULL || *ssl_key_file == '\0') ? ssl_cert_file : ssl_key_file;
- if (SSL_CTX_use_PrivateKey_file(ssl_ctx, key_file, SSL_FILETYPE_PEM) > 0)
+ if (SSL_CTX_use_certificate_file
+ (ssl_ctx, ssl_cert_file, SSL_FILETYPE_PEM) > 0) {
+ char *key_file = (ssl_key_file == NULL
+ || *ssl_key_file ==
+ '\0') ? ssl_cert_file : ssl_key_file;
+ if (SSL_CTX_use_PrivateKey_file
+ (ssl_ctx, key_file, SSL_FILETYPE_PEM) > 0)
if (SSL_CTX_check_private_key(ssl_ctx))
ng = 0;
}
@@ -284,10 +290,11 @@ openSSLHandle(int sock)
init_PRNG();
#endif /* SSLEAY_VERSION_NUMBER >= 0x00905100 */
if (SSL_connect(handle) <= 0)
- goto eend;
+ goto eend;
return handle;
-eend:
- emsg = Sprintf("SSL error: %s", ERR_error_string(ERR_get_error(), NULL))->ptr;
+ eend:
+ emsg =
+ Sprintf("SSL error: %s", ERR_error_string(ERR_get_error(), NULL))->ptr;
disp_err_message(emsg, FALSE);
return NULL;
}
@@ -327,7 +334,7 @@ write_from_file(int sock, char *file)
}
ParsedURL *
-baseURL(Buffer * buf)
+baseURL(Buffer *buf)
{
if (buf->bufferprop & BP_NO_URL) {
/* no URL is defined for the buffer */
@@ -343,8 +350,7 @@ baseURL(Buffer * buf)
int
openSocket(char *hostname,
- char *remoteport_name,
- unsigned short remoteport_num)
+ char *remoteport_name, unsigned short remoteport_num)
{
int sock = -1;
#ifdef INET6
@@ -362,8 +368,8 @@ openSocket(char *hostname,
MySignalHandler(*trap) ();
if (fmInitialized) {
- message(Sprintf("Opening socket...")->ptr, 0, 0);
- refresh();
+ message(Sprintf("Opening socket...")->ptr, 0, 0);
+ refresh();
}
if (SETJMP(AbortLoading) != 0) {
#ifdef SOCK_DEBUG
@@ -378,7 +384,8 @@ openSocket(char *hostname,
term_cbreak();
if (hostname == NULL) {
#ifdef SOCK_DEBUG
- sock_log("openSocket() failed. reason: Bad hostname \"%s\"\n", hostname);
+ sock_log("openSocket() failed. reason: Bad hostname \"%s\"\n",
+ hostname);
#endif
goto error;
}
@@ -386,8 +393,8 @@ openSocket(char *hostname,
#ifdef INET6
/* rfc2732 compliance */
if (hostname != NULL && hostname[0] == '[' &&
- hostname[strlen(hostname)-1] == ']' ) {
- hostname[strlen(hostname)-1] = '\0';
+ hostname[strlen(hostname) - 1] == ']') {
+ hostname[strlen(hostname) - 1] = '\0';
hostname++;
if (strspn(hostname, "0123456789abcdefABCDEF:.") != strlen(hostname))
goto error;
@@ -440,7 +447,7 @@ openSocket(char *hostname,
}
#else /* not INET6 */
s_port = htons(remoteport_num);
- bzero((char *) &hostaddr, sizeof(struct sockaddr_in));
+ bzero((char *)&hostaddr, sizeof(struct sockaddr_in));
if ((proto = getprotobyname("tcp")) == NULL) {
/* protocol number of TCP is 6 */
proto = New(struct protoent);
@@ -456,17 +463,18 @@ openSocket(char *hostname,
if (regexMatch(hostname, 0, 1)) {
sscanf(hostname, "%d.%d.%d.%d", &a1, &a2, &a3, &a4);
adr = htonl((a1 << 24) | (a2 << 16) | (a3 << 8) | a4);
- bcopy((void *) &adr, (void *) &hostaddr.sin_addr, sizeof(long));
+ bcopy((void *)&adr, (void *)&hostaddr.sin_addr, sizeof(long));
hostaddr.sin_family = AF_INET;
hostaddr.sin_port = s_port;
if (fmInitialized) {
message(Sprintf("Connecting to %s", hostname)->ptr, 0, 0);
refresh();
}
- if (connect(sock, (struct sockaddr *) &hostaddr,
+ if (connect(sock, (struct sockaddr *)&hostaddr,
sizeof(struct sockaddr_in)) < 0) {
#ifdef SOCK_DEBUG
- sock_log("openSocket: connect() failed. reason: %s\n", strerror(errno));
+ sock_log("openSocket: connect() failed. reason: %s\n",
+ strerror(errno));
#endif
goto error;
}
@@ -475,38 +483,40 @@ openSocket(char *hostname,
char **h_addr_list;
int result;
if (fmInitialized) {
- message(Sprintf("Performing hostname lookup on %s", hostname)->ptr, 0, 0);
+ message(Sprintf("Performing hostname lookup on %s", hostname)->ptr,
+ 0, 0);
refresh();
}
if ((entry = gethostbyname(hostname)) == NULL) {
#ifdef SOCK_DEBUG
- sock_log("openSocket: gethostbyname() failed. reason: %s\n", strerror(errno));
+ sock_log("openSocket: gethostbyname() failed. reason: %s\n",
+ strerror(errno));
#endif
goto error;
}
hostaddr.sin_family = AF_INET;
hostaddr.sin_port = s_port;
for (h_addr_list = entry->h_addr_list; *h_addr_list; h_addr_list++) {
- bcopy((void *) h_addr_list[0], (void *) &hostaddr.sin_addr, entry->h_length);
+ bcopy((void *)h_addr_list[0], (void *)&hostaddr.sin_addr,
+ entry->h_length);
#ifdef SOCK_DEBUG
- adr = ntohl(*(long *) &hostaddr.sin_addr);
+ adr = ntohl(*(long *)&hostaddr.sin_addr);
sock_log("openSocket: connecting %d.%d.%d.%d\n",
(adr >> 24) & 0xff,
- (adr >> 16) & 0xff,
- (adr >> 8) & 0xff,
- adr & 0xff);
+ (adr >> 16) & 0xff, (adr >> 8) & 0xff, adr & 0xff);
#endif
if (fmInitialized) {
message(Sprintf("Connecting to %s", hostname)->ptr, 0, 0);
refresh();
}
- if ((result = connect(sock, (struct sockaddr *) &hostaddr,
+ if ((result = connect(sock, (struct sockaddr *)&hostaddr,
sizeof(struct sockaddr_in))) == 0) {
break;
}
#ifdef SOCK_DEBUG
else {
- sock_log("openSocket: connect() failed. reason: %s\n", strerror(errno));
+ sock_log("openSocket: connect() failed. reason: %s\n",
+ strerror(errno));
}
#endif
}
@@ -539,21 +549,21 @@ copyPath(char *orgpath, int length, int option)
{
Str tmp = Strnew();
while (*orgpath && length != 0) {
- if (IS_SPACE(*orgpath)) {
- switch(option) {
+ if (IS_SPACE(*orgpath)) {
+ switch (option) {
case COPYPATH_SPC_ALLOW:
- Strcat_char(tmp,*orgpath);
- break;
+ Strcat_char(tmp, *orgpath);
+ break;
case COPYPATH_SPC_IGNORE:
- /* do nothing */
- break;
+ /* do nothing */
+ break;
case COPYPATH_SPC_REPLACE:
- Strcat_charp(tmp,"%20");
- break;
+ Strcat_charp(tmp, "%20");
+ break;
}
- }
+ }
else
- Strcat_char(tmp,*orgpath);
+ Strcat_char(tmp, *orgpath);
orgpath++;
length--;
}
@@ -561,7 +571,7 @@ copyPath(char *orgpath, int length, int option)
}
void
-parseURL(char *url, ParsedURL * p_url, ParsedURL * current)
+parseURL(char *url, ParsedURL *p_url, ParsedURL *current)
{
char *p, *q;
Str tmp;
@@ -587,9 +597,9 @@ parseURL(char *url, ParsedURL * p_url, ParsedURL * current)
}
#if defined( __EMX__ ) || defined( __CYGWIN__ )
if (!strncmp(url, "file://localhost/", 17)) {
- p_url->scheme = SCM_LOCAL;
- p += 17 - 1;
- url += 17 - 1;
+ p_url->scheme = SCM_LOCAL;
+ p += 17 - 1;
+ url += 17 - 1;
}
#endif
#ifdef SUPPORT_DOS_DRIVE_PREFIX
@@ -597,32 +607,33 @@ parseURL(char *url, ParsedURL * p_url, ParsedURL * current)
p_url->scheme = SCM_LOCAL;
goto analyze_file;
}
-#endif /* SUPPORT_DOS_DRIVE_PREFIX */
+#endif /* SUPPORT_DOS_DRIVE_PREFIX */
/* search for scheme */
p_url->scheme = getURLScheme(&p);
if (p_url->scheme == SCM_MISSING) {
- /* scheme part is not found in the url. This means either
- (a) the url is relative to the current or (b) the url
- denotes a filename (therefore the scheme is SCM_LOCAL).
- */
- if (current) {
- copyParsedURL(p_url, current);
- if (p_url->scheme == SCM_LOCAL_CGI)
- p_url->scheme = SCM_LOCAL;
- /* label part and query part don't inherit */
- p_url->label = NULL;
- p_url->query = NULL;
- } else
- p_url->scheme = SCM_LOCAL;
- p = url;
- if (!strncmp(p,"//",2)) {
- /* URL begins with // */
- /* it means that 'scheme:' is abbreviated */
- p += 2;
- goto analyze_url;
- }
- /* the url doesn't begin with '//' */
- goto analyze_file;
+ /* scheme part is not found in the url. This means either
+ * (a) the url is relative to the current or (b) the url
+ * denotes a filename (therefore the scheme is SCM_LOCAL).
+ */
+ if (current) {
+ copyParsedURL(p_url, current);
+ if (p_url->scheme == SCM_LOCAL_CGI)
+ p_url->scheme = SCM_LOCAL;
+ /* label part and query part don't inherit */
+ p_url->label = NULL;
+ p_url->query = NULL;
+ }
+ else
+ p_url->scheme = SCM_LOCAL;
+ p = url;
+ if (!strncmp(p, "//", 2)) {
+ /* URL begins with // */
+ /* it means that 'scheme:' is abbreviated */
+ p += 2;
+ goto analyze_url;
+ }
+ /* the url doesn't begin with '//' */
+ goto analyze_file;
}
/* scheme part has been found */
/* get host and port */
@@ -640,25 +651,25 @@ parseURL(char *url, ParsedURL * p_url, ParsedURL * current)
p += 2;
goto analyze_file;
#else
- if (p[2] == '/' || p[2] == '~'
- /* <A HREF="file:///foo">file:///foo</A> or <A HREF="file://~user">file://~user</A> */
+ if (p[2] == '/' || p[2] == '~'
+ /* <A HREF="file:///foo">file:///foo</A> or <A HREF="file://~user">file://~user</A> */
#ifdef SUPPORT_DOS_DRIVE_PREFIX
- || (IS_ALPHA(p[2]) && (p[3] == ':' || p[3] == '|'))
- /* <A HREF="file://DRIVE/foo">file://DRIVE/foo</A> */
-#endif /* SUPPORT_DOS_DRIVE_PREFIX */
- ) {
- p += 2;
+ || (IS_ALPHA(p[2]) && (p[3] == ':' || p[3] == '|'))
+ /* <A HREF="file://DRIVE/foo">file://DRIVE/foo</A> */
+#endif /* SUPPORT_DOS_DRIVE_PREFIX */
+ ) {
+ p += 2;
goto analyze_file;
}
-#endif /* __EMX__ */
+#endif /* __EMX__ */
}
p += 2; /* scheme://foo */
- /* ^p is here */
+ /* ^p is here */
analyze_url:
q = p;
- while (*p && strchr(":/@?#",*p) == NULL) {
+ while (*p && strchr(":/@?#", *p) == NULL) {
#ifdef INET6
- if (*p == '[') { /* rfc2732 compliance */
+ if (*p == '[') { /* rfc2732 compliance */
char *p_colon = NULL;
do {
p++;
@@ -686,11 +697,11 @@ parseURL(char *url, ParsedURL * p_url, ParsedURL * current)
return;
case ':':
/* scheme://user:pass@host or
- scheme://host:port
+ * scheme://host:port
*/
p_url->host = copyPath(q, p - q, COPYPATH_SPC_IGNORE);
q = ++p;
- while (*p && strchr("@/?#",*p) == NULL)
+ while (*p && strchr("@/?#", *p) == NULL)
p++;
if (*p == '@') {
/* scheme://user:pass@... */
@@ -729,14 +740,14 @@ parseURL(char *url, ParsedURL * p_url, ParsedURL * current)
if (p_url->scheme == SCM_LOCAL && p_url->user == NULL &&
p_url->host != NULL && strcmp(p_url->host, "localhost")) {
/*
- In the environments other than CYGWIN, a URL like
- file://host/file is regarded as ftp://host/file.
- On the other hand, file://host/file on CYGWIN is
- regarded as local access to the file //host/file.
- `host' is a netbios-hostname, drive, or any other
- name; It is CYGWIN system call who interprets that.
- */
-
+ * In the environments other than CYGWIN, a URL like
+ * file://host/file is regarded as ftp://host/file.
+ * On the other hand, file://host/file on CYGWIN is
+ * regarded as local access to the file //host/file.
+ * `host' is a netbios-hostname, drive, or any other
+ * name; It is CYGWIN system call who interprets that.
+ */
+
p_url->scheme = SCM_FTP; /* ftp://host/... */
if (p_url->port == 0)
p_url->port = DefaultPort[SCM_FTP];
@@ -744,17 +755,17 @@ parseURL(char *url, ParsedURL * p_url, ParsedURL * current)
#endif
#ifdef SUPPORT_DOS_DRIVE_PREFIX
if (p_url->scheme == SCM_LOCAL) {
- q = p;
- if (*q == '/')
- q++;
- if (IS_ALPHA(q[0]) && (q[1] == ':' || q[1] == '|')) {
- if (q[1] == '|') {
- p = allocStr(q, 0);
- p[1] = ':';
- }
- else
- p = q;
- }
+ q = p;
+ if (*q == '/')
+ q++;
+ if (IS_ALPHA(q[0]) && (q[1] == ':' || q[1] == '|')) {
+ if (q[1] == '|') {
+ p = allocStr(q, 0);
+ p[1] = ':';
+ }
+ else
+ p = q;
+ }
}
#endif
@@ -828,9 +839,9 @@ parseURL(char *url, ParsedURL * p_url, ParsedURL * current)
q = ++p;
while (*p && *p != '#')
p++;
- p_url->query = copyPath(q,p-q,COPYPATH_SPC_ALLOW);
+ p_url->query = copyPath(q, p - q, COPYPATH_SPC_ALLOW);
}
- do_label:
+ do_label:
if (p_url->scheme == SCM_MISSING) {
p_url->scheme = SCM_LOCAL;
p_url->file = allocStr(p, 0);
@@ -846,7 +857,7 @@ parseURL(char *url, ParsedURL * p_url, ParsedURL * current)
#define ALLOC_STR(s) ((s)==NULL?NULL:allocStr(s,0))
void
-copyParsedURL(ParsedURL * p, ParsedURL * q)
+copyParsedURL(ParsedURL *p, ParsedURL *q)
{
p->scheme = q->scheme;
p->port = q->port;
@@ -861,7 +872,7 @@ copyParsedURL(ParsedURL * p, ParsedURL * q)
}
void
-parseURL2(char *url, ParsedURL * pu, ParsedURL * current)
+parseURL2(char *url, ParsedURL *pu, ParsedURL *current)
{
char *p;
Str tmp;
@@ -888,17 +899,18 @@ parseURL2(char *url, ParsedURL * pu, ParsedURL * current)
if (pu->file) {
if (
#ifdef USE_GOPHER
- pu->scheme != SCM_GOPHER &&
+ pu->scheme != SCM_GOPHER &&
#endif /* USE_GOPHER */
#ifdef USE_NNTP
- pu->scheme != SCM_NEWS &&
+ pu->scheme != SCM_NEWS &&
#endif /* USE_NNTP */
- pu->file[0] != '/'
+ pu->file[0] != '/'
#ifdef SUPPORT_DOS_DRIVE_PREFIX
- && !(pu->scheme == SCM_LOCAL && IS_ALPHA(pu->file[0]) && pu->file[1] == ':')
+ && !(pu->scheme == SCM_LOCAL && IS_ALPHA(pu->file[0])
+ && pu->file[1] == ':')
#endif
) {
- /* file is relative [process 1]*/
+ /* file is relative [process 1] */
p = pu->file;
if (current->file) {
tmp = Strnew_charp(current->file);
@@ -913,8 +925,7 @@ parseURL2(char *url, ParsedURL * pu, ParsedURL * current)
}
}
#ifdef USE_GOPHER
- else if (pu->scheme == SCM_GOPHER &&
- pu->file[0] == '/') {
+ else if (pu->scheme == SCM_GOPHER && pu->file[0] == '/') {
p = pu->file;
pu->file = allocStr(p + 1, 0);
}
@@ -925,7 +936,7 @@ parseURL2(char *url, ParsedURL * pu, ParsedURL * current)
pu->file = current->file;
}
/* comment: query part need not to be completed
- from the current URL. */
+ * from the current URL. */
}
if (pu->file) {
#ifdef __EMX__
@@ -933,14 +944,14 @@ parseURL2(char *url, ParsedURL * pu, ParsedURL * current)
if (strncmp(pu->file, "/$LIB/", 6)) {
char abs[_MAX_PATH];
- _abspath(abs, pu->file, _MAX_PATH);
- pu->file = cleanupName(abs);
+ _abspath(abs, pu->file, _MAX_PATH);
+ pu->file = cleanupName(abs);
}
}
#else
if (pu->scheme == SCM_LOCAL && pu->file[0] != '/' &&
-#ifdef SUPPORT_DOS_DRIVE_PREFIX /* for 'drive:' */
- ! (IS_ALPHA(pu->file[0]) && pu->file[1] == ':') &&
+#ifdef SUPPORT_DOS_DRIVE_PREFIX /* for 'drive:' */
+ !(IS_ALPHA(pu->file[0]) && pu->file[1] == ':') &&
#endif
strcmp(pu->file, "-")) {
/* local file, relative path */
@@ -951,44 +962,44 @@ parseURL2(char *url, ParsedURL * pu, ParsedURL * current)
pu->file = cleanupName(tmp->ptr);
}
#endif
- else if (pu->scheme == SCM_HTTP
+ else if (pu->scheme == SCM_HTTP
#ifdef USE_SSL
- || pu->scheme == SCM_HTTPS
+ || pu->scheme == SCM_HTTPS
#endif
- ) {
- if (relative_uri) {
- /* In this case, pu->file is created by [process 1] above.
- pu->file may contain relative path (for example,
- "/foo/../bar/./baz.html"), cleanupName() must be applied.
- When the entire abs_path is given, it still may contain
- elements like `//', `..' or `.' in the pu->file. It is
- server's responsibility to canonicalize such path.
- */
- pu->file = cleanupName(pu->file);
- }
- } else if (
+ ) {
+ if (relative_uri) {
+ /* In this case, pu->file is created by [process 1] above.
+ * pu->file may contain relative path (for example,
+ * "/foo/../bar/./baz.html"), cleanupName() must be applied.
+ * When the entire abs_path is given, it still may contain
+ * elements like `//', `..' or `.' in the pu->file. It is
+ * server's responsibility to canonicalize such path.
+ */
+ pu->file = cleanupName(pu->file);
+ }
+ }
+ else if (
#ifdef USE_GOPHER
- pu->scheme != SCM_GOPHER &&
+ pu->scheme != SCM_GOPHER &&
#endif /* USE_GOPHER */
#ifdef USE_NNTP
- pu->scheme != SCM_NEWS &&
+ pu->scheme != SCM_NEWS &&
#endif /* USE_NNTP */
- pu->file[0] == '/') {
+ pu->file[0] == '/') {
/*
- this happens on the following conditions:
- (1) ftp scheme (2) local, looks like absolute path.
- In both case, there must be no side effect with
- cleanupName(). (I hope so...)
- */
+ * this happens on the following conditions:
+ * (1) ftp scheme (2) local, looks like absolute path.
+ * In both case, there must be no side effect with
+ * cleanupName(). (I hope so...)
+ */
pu->file = cleanupName(pu->file);
}
if (pu->scheme == SCM_LOCAL) {
#ifdef SUPPORT_NETBIOS_SHARE
- if (pu->host && strcmp(pu->host,"localhost") != 0) {
+ if (pu->host && strcmp(pu->host, "localhost") != 0) {
Str tmp = Strnew_charp("//");
- Strcat_m_charp(tmp, pu->host,
- cleanupName(file_unquote(pu->file)),
- NULL);
+ Strcat_m_charp(tmp, pu->host,
+ cleanupName(file_unquote(pu->file)), NULL);
pu->real_file = tmp->ptr;
}
else
@@ -999,12 +1010,12 @@ parseURL2(char *url, ParsedURL * pu, ParsedURL * current)
}
static Str
-_parsedURL2Str(ParsedURL * pu, int pass)
+_parsedURL2Str(ParsedURL *pu, int pass)
{
Str tmp;
- static char *scheme_str[] =
- {
- "http", "gopher", "ftp", "ftp", "file", "file", "exec", "nntp", "news", "mailto",
+ static char *scheme_str[] = {
+ "http", "gopher", "ftp", "ftp", "file", "file", "exec", "nntp", "news",
+ "mailto",
#ifdef USE_SSL
"https",
#endif /* USE_SSL */
@@ -1017,7 +1028,7 @@ _parsedURL2Str(ParsedURL * pu, int pass)
/* local label */
return Sprintf("#%s", pu->label);
}
- if (pu->scheme == SCM_LOCAL && ! strcmp(pu->file, "-")) {
+ if (pu->scheme == SCM_LOCAL && !strcmp(pu->file, "-")) {
tmp = Strnew_charp("-");
if (pu->label) {
Strcat_char(tmp, '#');
@@ -1054,18 +1065,20 @@ _parsedURL2Str(ParsedURL * pu, int pass)
}
if (
#ifdef USE_NNTP
- pu->scheme != SCM_NEWS &&
+ pu->scheme != SCM_NEWS &&
#endif /* USE_NNTP */
- (pu->file == NULL || (pu->file[0] != '/'
+ (pu->file == NULL || (pu->file[0] != '/'
#ifdef SUPPORT_DOS_DRIVE_PREFIX
- && !(IS_ALPHA(pu->file[0]) && pu->file[1] == ':' && pu->host == NULL)
+ && !(IS_ALPHA(pu->file[0])
+ && pu->file[1] == ':'
+ && pu->host == NULL)
#endif
- )))
+ )))
Strcat_char(tmp, '/');
Strcat_charp(tmp, pu->file);
if (pu->query) {
- Strcat_char(tmp,'?');
- Strcat_charp(tmp,pu->query);
+ Strcat_char(tmp, '?');
+ Strcat_charp(tmp, pu->query);
}
if (pu->label) {
Strcat_char(tmp, '#');
@@ -1075,7 +1088,7 @@ _parsedURL2Str(ParsedURL * pu, int pass)
}
Str
-parsedURL2Str(ParsedURL * pu)
+parsedURL2Str(ParsedURL *pu)
{
return _parsedURL2Str(pu, FALSE);
}
@@ -1104,7 +1117,7 @@ getURLScheme(char **url)
}
static char *
-otherinfo(ParsedURL * target, ParsedURL * current, char *referer)
+otherinfo(ParsedURL *target, ParsedURL *current, char *referer)
{
Str s = Strnew();
@@ -1114,8 +1127,10 @@ otherinfo(ParsedURL * target, ParsedURL * current, char *referer)
else
Strcat_charp(s, UserAgent);
Strcat_charp(s, "\r\n");
- Strcat_charp(s, "Accept: text/*, image/*, audio/*, video/*, application/*\r\n");
- Strcat_charp(s, "Accept-Encoding: gzip, compress, bzip, bzip2, deflate\r\n");
+ Strcat_charp(s,
+ "Accept: text/*, image/*, audio/*, video/*, application/*\r\n");
+ Strcat_charp(s,
+ "Accept-Encoding: gzip, compress, bzip, bzip2, deflate\r\n");
Strcat_charp(s, "Accept-Language: ");
if (AcceptLang != NULL && *AcceptLang != '\0') {
Strcat_charp(s, AcceptLang);
@@ -1157,7 +1172,7 @@ otherinfo(ParsedURL * target, ParsedURL * current, char *referer)
}
static Str
-HTTPrequest(ParsedURL * pu, ParsedURL * current, HRequest * hr, TextList * extra)
+HTTPrequest(ParsedURL *pu, ParsedURL *current, HRequest *hr, TextList *extra)
{
Str tmp;
TextListItem *i;
@@ -1185,8 +1200,8 @@ HTTPrequest(ParsedURL * pu, ParsedURL * current, HRequest * hr, TextList * extra
else if (hr->flag & HR_FLAG_LOCAL) {
Strcat_charp(tmp, pu->file);
if (pu->query) {
- Strcat_char(tmp,'?');
- Strcat_charp(tmp,pu->query);
+ Strcat_char(tmp, '?');
+ Strcat_charp(tmp, pu->query);
}
}
else {
@@ -1216,24 +1231,27 @@ HTTPrequest(ParsedURL * pu, ParsedURL * current, HRequest * hr, TextList * extra
Strcat_charp(tmp, "Content-type: multipart/form-data; boundary=");
Strcat_charp(tmp, hr->request->boundary);
Strcat_charp(tmp, "\r\n");
- Strcat(tmp, Sprintf("Content-length: %ld\r\n", hr->request->length));
+ Strcat(tmp,
+ Sprintf("Content-length: %ld\r\n", hr->request->length));
Strcat_charp(tmp, "\r\n");
}
else {
- if (!override_content_type) {
- Strcat_charp(tmp, "Content-type: application/x-www-form-urlencoded\r\n");
- }
- Strcat(tmp, Sprintf("Content-length: %ld\r\n", hr->request->length));
- if (header_string)
- Strcat (tmp, header_string);
+ if (!override_content_type) {
+ Strcat_charp(tmp,
+ "Content-type: application/x-www-form-urlencoded\r\n");
+ }
+ Strcat(tmp,
+ Sprintf("Content-length: %ld\r\n", hr->request->length));
+ if (header_string)
+ Strcat(tmp, header_string);
Strcat_charp(tmp, "\r\n");
- Strcat_charp_n(tmp, hr->request->body, hr->request->length);
+ Strcat_charp_n(tmp, hr->request->body, hr->request->length);
Strcat_charp(tmp, "\r\n");
}
}
else {
- if (header_string)
- Strcat (tmp, header_string);
+ if (header_string)
+ Strcat(tmp, header_string);
Strcat_charp(tmp, "\r\n");
}
#ifdef DEBUG
@@ -1255,15 +1273,15 @@ init_stream(URLFile *uf, int scheme, InputStream stream)
}
static InputStream
-openFTPStream(ParsedURL * pu)
+openFTPStream(ParsedURL *pu)
{
return newFileStream(openFTP(pu), closeFTP);
}
URLFile
-openURL(char *url, ParsedURL * pu, ParsedURL * current,
- URLOption * option, FormList * request, TextList * extra_header,
- URLFile * ouf, unsigned char *status)
+openURL(char *url, ParsedURL *pu, ParsedURL *current,
+ URLOption *option, FormList *request, TextList *extra_header,
+ URLFile *ouf, unsigned char *status)
{
Str tmp;
int i, sock, scheme;
@@ -1289,8 +1307,8 @@ openURL(char *url, ParsedURL * pu, ParsedURL * current,
u = url;
scheme = getURLScheme(&u);
- if (current == NULL && scheme == SCM_MISSING && ! ArgvIsURL)
- u = file_to_url(url); /* force to local file */
+ if (current == NULL && scheme == SCM_MISSING && !ArgvIsURL)
+ u = file_to_url(url); /* force to local file */
else
u = url;
retry:
@@ -1336,7 +1354,7 @@ openURL(char *url, ParsedURL * pu, ParsedURL * current,
pu->query,
request,
option->referer),
- (void (*)()) pclose);
+ (void (*)())pclose);
if (uf.stream == NULL)
goto ordinary_local_file;
uf.is_cgi = TRUE;
@@ -1345,7 +1363,8 @@ openURL(char *url, ParsedURL * pu, ParsedURL * current,
else if (pu->query != NULL) {
/* lodal CGI: GET */
uf.stream = newFileStream(localcgi_get(pu->real_file, pu->query,
- option->referer), (void (*)()) pclose);
+ option->referer),
+ (void (*)())pclose);
if (uf.stream == NULL) {
pu->file = p;
goto ordinary_local_file;
@@ -1354,11 +1373,11 @@ openURL(char *url, ParsedURL * pu, ParsedURL * current,
uf.scheme = pu->scheme = SCM_LOCAL_CGI;
}
else if ((i = strlen(pu->file)) > extlen &&
- !strncmp(pu->file + i - extlen, CGI_EXTENSION, extlen))
- {
+ !strncmp(pu->file + i - extlen, CGI_EXTENSION, extlen)) {
/* lodal CGI: GET */
uf.stream = newFileStream(localcgi_get(pu->real_file, "",
- option->referer), (void (*)()) pclose);
+ option->referer),
+ (void (*)())pclose);
if (uf.stream == NULL)
goto ordinary_local_file;
uf.is_cgi = TRUE;
@@ -1411,10 +1430,9 @@ openURL(char *url, ParsedURL * pu, ParsedURL * current,
pu->file = allocStr("/", 0);
if (non_null(FTP_proxy) &&
!Do_not_use_proxy &&
- pu->host != NULL &&
- !check_no_proxy(pu->host)) {
+ pu->host != NULL && !check_no_proxy(pu->host)) {
sock = openSocket(FTP_proxy_parsed.host,
- schemetable[FTP_proxy_parsed.scheme].cmdname,
+ schemetable[FTP_proxy_parsed.scheme].cmdname,
FTP_proxy_parsed.port);
if (sock < 0)
return uf;
@@ -1440,8 +1458,7 @@ openURL(char *url, ParsedURL * pu, ParsedURL * current,
hr.command = HR_COMMAND_HEAD;
if (non_null(HTTP_proxy) &&
!Do_not_use_proxy &&
- pu->host != NULL &&
- !check_no_proxy(pu->host)) {
+ pu->host != NULL && !check_no_proxy(pu->host)) {
char *save_label;
#ifdef USE_SSL
if (pu->scheme == SCM_HTTPS && *status == HTST_CONNECT) {
@@ -1453,13 +1470,13 @@ openURL(char *url, ParsedURL * pu, ParsedURL * current,
}
else {
sock = openSocket(HTTP_proxy_parsed.host,
- schemetable[HTTP_proxy_parsed.scheme].cmdname,
- HTTP_proxy_parsed.port);
+ schemetable[HTTP_proxy_parsed.scheme].
+ cmdname, HTTP_proxy_parsed.port);
sslh = NULL;
}
#else
sock = openSocket(HTTP_proxy_parsed.host,
- schemetable[HTTP_proxy_parsed.scheme].cmdname,
+ schemetable[HTTP_proxy_parsed.scheme].cmdname,
HTTP_proxy_parsed.port);
#endif
if (sock < 0) {
@@ -1493,8 +1510,7 @@ openURL(char *url, ParsedURL * pu, ParsedURL * current,
}
else {
sock = openSocket(pu->host,
- schemetable[pu->scheme].cmdname,
- pu->port);
+ schemetable[pu->scheme].cmdname, pu->port);
if (sock < 0) {
*status = HTST_MISSING;
return uf;
@@ -1547,10 +1563,9 @@ openURL(char *url, ParsedURL * pu, ParsedURL * current,
case SCM_GOPHER:
if (non_null(GOPHER_proxy) &&
!Do_not_use_proxy &&
- pu->host != NULL &&
- !check_no_proxy(pu->host)) {
+ pu->host != NULL && !check_no_proxy(pu->host)) {
sock = openSocket(GOPHER_proxy_parsed.host,
- schemetable[GOPHER_proxy_parsed.scheme].cmdname,
+ schemetable[GOPHER_proxy_parsed.scheme].cmdname,
GOPHER_proxy_parsed.port);
if (sock < 0)
return uf;
@@ -1559,8 +1574,7 @@ openURL(char *url, ParsedURL * pu, ParsedURL * current,
}
else {
sock = openSocket(pu->host,
- schemetable[pu->scheme].cmdname,
- pu->port);
+ schemetable[pu->scheme].cmdname, pu->port);
if (sock < 0)
return uf;
if (pu->file == NULL)
@@ -1577,7 +1591,8 @@ openURL(char *url, ParsedURL * pu, ParsedURL * current,
case SCM_NEWS:
if (pu->scheme == SCM_NNTP) {
p = pu->host;
- } else {
+ }
+ else {
p = getenv("NNTPSERVER");
}
r = getenv("NNTPMODE");
@@ -1626,7 +1641,8 @@ openURL(char *url, ParsedURL * pu, ParsedURL * current,
if (i != 211)
goto nntp_error;
fprintf(fw, "ARTICLE %s\r\n", p);
- } else {
+ }
+ else {
fprintf(fw, "ARTICLE <%s>\r\n", url_unquote(pu->file));
}
fflush(fw);
@@ -1636,7 +1652,7 @@ openURL(char *url, ParsedURL * pu, ParsedURL * current,
sscanf(tmp->ptr, "%d", &i);
if (i != 220)
goto nntp_error;
- uf.scheme = SCM_NEWS; /* XXX */
+ uf.scheme = SCM_NEWS; /* XXX */
uf.stream = stream;
return uf;
nntp_error:
@@ -1654,7 +1670,7 @@ openURL(char *url, ParsedURL * pu, ParsedURL * current,
/* add index_file if exists */
static void
-add_index_file(ParsedURL * pu, URLFile *uf)
+add_index_file(ParsedURL *pu, URLFile *uf)
{
char *p, *q;
@@ -1705,11 +1721,12 @@ guessContentType(char *filename)
goto no_user_mimetypes;
for (i = 0; i < mimetypes_list->nitem; i++) {
- if ((ret = guessContentTypeFromTable(UserMimeTypes[i], filename)) != NULL)
+ if ((ret =
+ guessContentTypeFromTable(UserMimeTypes[i], filename)) != NULL)
return ret;
}
- no_user_mimetypes:
+ no_user_mimetypes:
return guessContentTypeFromTable(DefaultGuess, filename);
}
@@ -1786,8 +1803,8 @@ check_no_proxy(char *domain)
he = gethostbyname(domain);
if (!he)
return (0);
- for (h_addr_list = (unsigned char **) he->h_addr_list
- ; *h_addr_list; h_addr_list++) {
+ for (h_addr_list = (unsigned char **)he->h_addr_list; *h_addr_list;
+ h_addr_list++) {
sprintf(addr, "%d", h_addr_list[0][0]);
for (n = 1; n < he->h_length; n++) {
sprintf(buf, ".%d", h_addr_list[0][n]);
@@ -1820,13 +1837,13 @@ check_no_proxy(char *domain)
switch (res->ai_family) {
case AF_INET:
inet_ntop(AF_INET,
- &((struct sockaddr_in *) res->ai_addr)->sin_addr,
+ &((struct sockaddr_in *)res->ai_addr)->sin_addr,
addr, sizeof(addr));
break;
case AF_INET6:
inet_ntop(AF_INET6,
- &((struct sockaddr_in6 *) res->ai_addr)->sin6_addr,
- addr, sizeof(addr));
+ &((struct sockaddr_in6 *)res->ai_addr)->
+ sin6_addr, addr, sizeof(addr));
break;
default:
/* unknown */
@@ -1860,19 +1877,19 @@ filename_extension(char *path, int is_url)
if (*p == '.')
p++;
for (; *p; p++) {
- if (*p == '.') {
- last_dot = p;
- }
- else if (is_url && *p == '?')
- break;
+ if (*p == '.') {
+ last_dot = p;
+ }
+ else if (is_url && *p == '?')
+ break;
}
if (*last_dot == '.') {
- for (i = 1; last_dot[i] && i < 8; i++) {
+ for (i = 1; last_dot[i] && i < 8; i++) {
if (is_url && !IS_ALNUM(last_dot[i]))
break;
}
- return allocStr(last_dot, i);
+ return allocStr(last_dot, i);
}
else
- return last_dot;
+ return last_dot;
}
diff --git a/w3mbookmark.c b/w3mbookmark.c
index 2d0191c..49adff4 100644
--- a/w3mbookmark.c
+++ b/w3mbookmark.c
@@ -1,4 +1,4 @@
-/* $Id: w3mbookmark.c,v 1.4 2001/11/21 16:29:47 ukai Exp $ */
+/* $Id: w3mbookmark.c,v 1.5 2001/11/24 02:01:26 ukai Exp $ */
#ifdef __EMX__
#include <stdlib.h>
#endif
@@ -13,13 +13,12 @@
#if LANG == JA
static char *bkmark_src1 = "<html><head><title>Bookmark Registration</title>\n\
-<body><h1>ブックマークの登録</h1>\n\n"
-"<form method=get action=\"file://%s/" W3MBOOKMARK_CMDNAME "\">\n\n"
-"<input type=hidden name=mode value=register>\n\
+<body><h1>ブックマークの登録</h1>\n\n" "<form method=get action=\"file://%s/" W3MBOOKMARK_CMDNAME "\">\n\n" "<input type=hidden name=mode value=register>\n\
<input type=hidden name=bmark value=\"%s\">\n\
<table cellpadding=0>\n";
-static char *bkmark_src2 = "<tr><td>New Section:</td><td><input type=text name=newsection width=60></td></tr>\n\
+static char *bkmark_src2 =
+ "<tr><td>New Section:</td><td><input type=text name=newsection width=60></td></tr>\n\
<tr><td>URL:</td><td><input type=text name=url value=\"%s\" width=60></td></tr>\n\
<tr><td>Title:</td><td><input type=text name=title value=\"%s\" width=60></td></tr>\n\
<tr><td><input type=submit name=submit value=\"登録\"></td>\n\
@@ -30,13 +29,12 @@ static char *bkmark_src2 = "<tr><td>New Section:</td><td><input type=text name=n
static char *default_section = "未分類";
#else /* LANG != JA */
static char *bkmark_src1 = "<html><head><title>Bookmark Registration</title>\n\
-<body><h1>Register to my bookmark</h1>\n\n"
-"<form method=get action=\"file://%s/" W3MBOOKMARK_CMDNAME "\">\n\n"
-"<input type=hidden name=mode value=register>\n\
+<body><h1>Register to my bookmark</h1>\n\n" "<form method=get action=\"file://%s/" W3MBOOKMARK_CMDNAME "\">\n\n" "<input type=hidden name=mode value=register>\n\
<input type=hidden name=bmark value=\"%s\">\n\
<table cellpadding=0>\n";
-static char *bkmark_src2 = "<tr><td>New Section:</td><td><input type=text name=newsection width=60></td></tr>\n\
+static char *bkmark_src2 =
+ "<tr><td>New Section:</td><td><input type=text name=newsection width=60></td></tr>\n\
<tr><td>URL:</td><td><input type=text name=url value=\"%s\" width=60></td></tr>\n\
<tr><td>Title:</td><td><input type=text name=title value=\"%s\" width=60></td></tr>\n\
<tr><td><input type=submit name=submit value=\"ADD\"></td>\n\
@@ -50,7 +48,8 @@ static char *default_section = "Miscellaneous";
#define FALSE 0
#define T 1
-static char end_section[] = "<!--End of section (do not delete this comment)-->\n";
+static char end_section[] =
+ "<!--End of section (do not delete this comment)-->\n";
char *Local_cookie;
@@ -66,28 +65,30 @@ print_bookmark_panel(char *bmark, char *url, char *title)
if ((f = fopen(bmark, "r")) != NULL) {
printf("<tr><td>Section:<td><select name=\"section\">\n");
while (tmp = Strfgets(f), tmp->length > 0) {
- Strremovefirstspaces(tmp);
+ Strremovefirstspaces(tmp);
if (Strncasecmp_charp(tmp, "<h2>", 4) == 0) {
p = tmp->ptr + 4;
tmp2 = Strnew();
while (*p && *p != '<')
Strcat_char(tmp2, *p++);
- printf("<option value=\"%s\">%s</option>", tmp2->ptr, tmp2->ptr);
+ printf("<option value=\"%s\">%s</option>", tmp2->ptr,
+ tmp2->ptr);
}
}
printf("</select>\n");
}
- printf(bkmark_src2, html_quote(url), html_quote(title),Local_cookie);
+ printf(bkmark_src2, html_quote(url), html_quote(title), Local_cookie);
}
/* create new bookmark */
static int
-create_new_bookmark(char *bmark, char *section, char *title, char *url, char *mode)
+create_new_bookmark(char *bmark, char *section, char *title, char *url,
+ char *mode)
{
FILE *f;
f = fopen(bmark, mode);
if (f == NULL) {
- printf("\nCan't open bookmark %s\n",bmark);
+ printf("\nCan't open bookmark %s\n", bmark);
return FALSE;
}
else {
@@ -118,10 +119,9 @@ insert_bookmark(char *bmark, struct parsed_tagarg *data)
if (section == NULL || *section == '\0')
section = tag_get_value(data, "section");
if (section == NULL || *section == '\0')
- section = default_section;
+ section = default_section;
- if (url == NULL || *url == '\0' ||
- title == NULL || *title == '\0') {
+ if (url == NULL || *url == '\0' || title == NULL || *title == '\0') {
/* Bookmark not added */
return FALSE;
}
@@ -131,7 +131,7 @@ insert_bookmark(char *bmark, struct parsed_tagarg *data)
f = fopen(bmark, "r");
if (f == NULL)
- return create_new_bookmark(bmark,section,title,url,"w");
+ return create_new_bookmark(bmark, section, title, url, "w");
section_tmp = Sprintf("<h2>%s</h2>\n", section);
for (;;) {
@@ -140,19 +140,22 @@ insert_bookmark(char *bmark, struct parsed_tagarg *data)
break;
if (Strcasecmp(tmp, section_tmp) == 0)
section_found = 1;
- if (section_found && !bmark_added) {
- Strremovefirstspaces(tmp);
- if (Strcmp_charp(tmp, end_section) == 0) {
- pushText(tl, Sprintf("<li><a href=\"%s\">%s</a>\n", url, title)->ptr);
- bmark_added = 1;
- }
+ if (section_found && !bmark_added) {
+ Strremovefirstspaces(tmp);
+ if (Strcmp_charp(tmp, end_section) == 0) {
+ pushText(tl,
+ Sprintf("<li><a href=\"%s\">%s</a>\n", url,
+ title)->ptr);
+ bmark_added = 1;
+ }
}
if (!bmark_added && Strcasecmp_charp(tmp, "</body>\n") == 0) {
pushText(tl, Sprintf("<h2>%s</h2>\n<ul>\n", section)->ptr);
- pushText(tl, Sprintf("<li><a href=\"%s\">%s</a>\n", url, title)->ptr);
+ pushText(tl,
+ Sprintf("<li><a href=\"%s\">%s</a>\n", url, title)->ptr);
pushText(tl, end_section);
pushText(tl, "</ul>\n");
- bmark_added = 1;
+ bmark_added = 1;
}
pushText(tl, tmp->ptr);
}
@@ -160,7 +163,7 @@ insert_bookmark(char *bmark, struct parsed_tagarg *data)
if (!bmark_added) {
/* Bookmark not added; perhaps the bookmark file is ill-formed */
/* In this case, a new bookmark is appeneded after the bookmark file */
- return create_new_bookmark(bmark,section,title,url,"a");
+ return create_new_bookmark(bmark, section, title, url, "a");
}
f = fopen(bmark, "w");
while (tl->nitem) {
@@ -196,11 +199,11 @@ MAIN(int argc, char *argv[], char **envp)
if (bmark == NULL || url == NULL) {
/* incomplete request */
printf("Content-Type: text/plain\n\n");
- printf("Incomplete Request: QUERY_STRING=%s\n",qs);
+ printf("Incomplete Request: QUERY_STRING=%s\n", qs);
exit(1);
}
Local_cookie = getenv("LOCAL_COOKIE");
- sent_cookie = tag_get_value(cgiarg,"cookie");
+ sent_cookie = tag_get_value(cgiarg, "cookie");
if (Local_cookie == NULL) {
/* Local cookie not provided: maybe illegal invocation */
Local_cookie = "";
@@ -213,7 +216,7 @@ MAIN(int argc, char *argv[], char **envp)
else if (mode && !strcmp(mode, "register")) {
printf("Content-Type: text/plain\n");
if (sent_cookie == NULL || Local_cookie[0] == '\0' ||
- strcmp(sent_cookie,Local_cookie) != 0) {
+ strcmp(sent_cookie, Local_cookie) != 0) {
/* local cookie doesn't match: It may be an illegal invocation */
printf("\nBookmark not added: local cookie doesn't match\n");
}
diff --git a/w3mhelperpanel.c b/w3mhelperpanel.c
index ab7e145..6186a61 100644
--- a/w3mhelperpanel.c
+++ b/w3mhelperpanel.c
@@ -1,4 +1,4 @@
-/* $Id: w3mhelperpanel.c,v 1.5 2001/11/21 16:29:47 ukai Exp $ */
+/* $Id: w3mhelperpanel.c,v 1.6 2001/11/24 02:01:26 ukai Exp $ */
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
@@ -38,8 +38,9 @@ extractMailcapEntry(char *mcap_entry, char **type, char **cmd)
while (*mcap_entry && IS_SPACE(*mcap_entry))
mcap_entry++;
- for (j = 0; mcap_entry[j] && mcap_entry[j] != ';' && !IS_SPACE(mcap_entry[j]);
- j++);
+ for (j = 0;
+ mcap_entry[j] && mcap_entry[j] != ';' && !IS_SPACE(mcap_entry[j]);
+ j++) ;
*type = allocStr(mcap_entry, j);
if (mcap_entry[j] == ';')
j++;
@@ -49,8 +50,9 @@ extractMailcapEntry(char *mcap_entry, char **type, char **cmd)
}
static void
-bye(const char*action,const char*mailcap)
-{ printf("Content-Type: text/plain\n\n%s %s\n", action, mailcap);
+bye(const char *action, const char *mailcap)
+{
+ printf("Content-Type: text/plain\n\n%s %s\n", action, mailcap);
exit(1);
}
@@ -62,43 +64,51 @@ printMailcapPanel(char *mailcap)
char *type, *viewer;
if ((f = fopen(mailcap, "rt")) == NULL) {
- if(errno!=ENOENT)
- bye("Can't open",mailcap);
+ if (errno != ENOENT)
+ bye("Can't open", mailcap);
- if(!(f=fopen(mailcap,"a+"))) /* if $HOME/.mailcap is not found, make it now! */
- bye("Can't open",mailcap);
+ if (!(f = fopen(mailcap, "a+"))) /* if $HOME/.mailcap is not found, make it now! */
+ bye("Can't open", mailcap);
- { char* SysMailcap=getenv("SYS_MAILCAP");
- FILE* s = fopen(SysMailcap?SysMailcap:"/etc/mailcap","r");
+ {
+ char *SysMailcap = getenv("SYS_MAILCAP");
+ FILE *s = fopen(SysMailcap ? SysMailcap : "/etc/mailcap", "r");
if (s) {
char buffer[256];
- while(fgets(buffer,sizeof buffer,s)) /* Copy system mailcap to */
- fputs(buffer,f); /* users' new one */
+ while (fgets(buffer, sizeof buffer, s)) /* Copy system mailcap to */
+ fputs(buffer, f); /* users' new one */
fclose(s);
rewind(f);
}
}
}
printf("Content-Type: text/html\n\n");
- printf("<html><head><title>External Viewer Setup</title></head><body><h1>%s</h1>\n", MSG_TITLE);
- printf("<form method=get action=\"file:///$LIB/" W3MHELPERPANEL_CMDNAME "\">\n");
+ printf
+ ("<html><head><title>External Viewer Setup</title></head><body><h1>%s</h1>\n",
+ MSG_TITLE);
+ printf("<form method=get action=\"file:///$LIB/" W3MHELPERPANEL_CMDNAME
+ "\">\n");
printf("<input type=hidden name=mode value=edit>\n");
- printf("<input type=hidden name=cookie value=\"%s\">\n",local_cookie);
- printf("%s: %s=<input type=text name=newtype><br>%s=<input type=text name=newcmd><br><input type=submit name=submit value=\"%s\">\n",
- MSG_NEW_ENTRY, MSG_TYPE, MSG_COMMAND, MSG_REGISTER);
- printf("<p><hr width=50%%><p><table border='0' cellpadding='0'><tr><th>&nbsp;&nbsp;<th><b>%s</b><th><b>%s</b>\n",
- MSG_TYPE, MSG_COMMAND);
+ printf("<input type=hidden name=cookie value=\"%s\">\n", local_cookie);
+ printf
+ ("%s: %s=<input type=text name=newtype><br>%s=<input type=text name=newcmd><br><input type=submit name=submit value=\"%s\">\n",
+ MSG_NEW_ENTRY, MSG_TYPE, MSG_COMMAND, MSG_REGISTER);
+ printf
+ ("<p><hr width=50%%><p><table border='0' cellpadding='0'><tr><th>&nbsp;&nbsp;<th><b>%s</b><th><b>%s</b>\n",
+ MSG_TYPE, MSG_COMMAND);
while (tmp = Strfgets(f), tmp->length > 0) {
if (tmp->ptr[0] == '#')
continue;
Strchop(tmp);
extractMailcapEntry(tmp->ptr, &type, &viewer);
- printf("<tr valign=top><td><td>%s<td>%s<td>", html_quote(type), html_quote(viewer));
+ printf("<tr valign=top><td><td>%s<td>%s<td>", html_quote(type),
+ html_quote(viewer));
printf("<input type=checkbox name=delete value=\"%s\">%s\n",
html_quote(type), MSG_DELETE);
}
- printf("</table><input type=submit name=submit value=\"%s\"></form></body></html>\n",
- MSG_DOIT);
+ printf
+ ("</table><input type=submit name=submit value=\"%s\"></form></body></html>\n",
+ MSG_DOIT);
}
void
@@ -113,7 +123,7 @@ editMailcap(char *mailcap, struct parsed_tagarg *args)
int delete_it;
if ((f = fopen(mailcap, "rt")) == NULL)
- bye("Can't open",mailcap);
+ bye("Can't open", mailcap);
while (tmp = Strfgets(f), tmp->length > 0) {
if (tmp->ptr[0] == '#')
@@ -136,7 +146,7 @@ editMailcap(char *mailcap, struct parsed_tagarg *args)
pushText(t, Sprintf("%s;\t%s\n", type, viewer)->ptr);
fclose(f);
if ((f = fopen(mailcap, "w")) == NULL)
- bye("Can't write to",mailcap);
+ bye("Can't write to", mailcap);
for (ti = t->first; ti != NULL; ti = ti->next)
fputs(ti->ptr, f);
@@ -169,17 +179,18 @@ MAIN(int argc, char *argv[], char **envp)
char *referer;
/* check if I can edit my mailcap */
if ((referer = getenv("HTTP_REFERER")) != NULL) {
- if (strncmp(referer,"file://",7) != 0 &&
- strncmp(referer,"exec://",7) != 0) {
+ if (strncmp(referer, "file://", 7) != 0 &&
+ strncmp(referer, "exec://", 7) != 0) {
/* referer is not file: nor exec: */
- bye("It may be an illegal execution\n referer=",referer);
+ bye("It may be an illegal execution\n referer=", referer);
}
}
- sent_cookie = tag_get_value(cgiarg,"cookie");
+ sent_cookie = tag_get_value(cgiarg, "cookie");
if (local_cookie == NULL || sent_cookie == NULL ||
- strcmp(local_cookie,sent_cookie) != 0) {
+ strcmp(local_cookie, sent_cookie) != 0) {
/* Local cookie doesn't match */
- bye("Local cookie doesn't match: It may be an illegal execution","");
+ bye("Local cookie doesn't match: It may be an illegal execution",
+ "");
}
/* edit mailcap */
editMailcap(mailcapfile->ptr, cgiarg);