[w3m-dev 02584] code cleanup again

From: Fumitoshi UKAI <ukai@debian.or.jp>
This commit is contained in:
Fumitoshi UKAI
2001-11-29 09:34:14 +00:00
parent aa7ba2dc6a
commit c33cdfcd56
23 changed files with 324 additions and 223 deletions
+97
View File
@@ -1,3 +1,100 @@
2001-11-29 Fumitoshi UKAI <ukai@debian.or.jp>
* [w3m-dev 02584] code cleanup
* linein.c (_esc): fix #ifdef EMACS_LIKE_LINEEDIT
* fix shadow variables (partially)
* version.c: s/version/w3m_version/
* configure: ditto
* fm.h: ditto
* local.c (set_environ): ditto
* main.c (fusage): ditto
* main.c (MAIN): ditto
* main.c (dispVer): ditto
* rc.c (load_option_panel): ditto
* url.c (otherinfo): ditto
* file.c (readHeader): s/tmp/tmp2/
* file.c (loadGeneralFile): s/tmp/cmd/
* file.c (flushline): s/f/df/
* file.c (doExternal): s/stat/mc_stat/
* proto.h: ditto
* mailcap.c (unquote_mailcap_loop): ditto
* mailcap.c (unquote_mailcap): ditto
* main.c (cmd_loadBuffer): s/link/linkid/
* main.c (sig_chld): s/stat/p_stat/
* fm.h: remove config_file
* main.c (MAIN): s/config_file/config_filename/
* rc.c (init_rc): ditto
* proto.h: ditto
* rc.c: add config_file
* menu.c (goem_menu): s/select/mselect/
* menu.c (draw_menu_item): ditto
* menu.c (select_menu): ditto
* menu.c (goto_menu): ditto
* menu.c (action_menu): ditto
* menu.c (mNext): ditto
* menu.c (mPrev): ditto
* menu.c (mOk): ditto
* menu.c (mSrchF): ditto
* menu.c (mSrchB): ditto
* menu.c (mSrchN): ditto
* menu.c (mSrchP): ditto
* menu.c (process_mMouse): ditto
* menu.c (smDelBuf): ditto
* proto.h: ditto
* printf format
* display.c (redrawLine): use %*ld instead of %*d
* require parentheses
* ftp.c (FtpLogin): add paren
* fix variable might be clobbered by `longjmp' or `vfork'
* file.c (loadGeneralFile): add volatile
* file.c (loadHTMLString): ditto
* file.c (loadBuffer): ditto
* file.c (doExternal): ditto
* frame.c (createFrameFile): ditto
* main.c (srchfor): ditto
* main.c (srchbak): ditto
* main.c (srch_nxtprv): ditto
* url.c (openSocket): ditto
* fix unused variables
* file.c (readHeader): emssg if USE_COOKIE defined
* file.c (HTMLlineproc2body: remove tmp
* file.c (saveBufferDelNum): remove p
* linein.c (_esc): c2 if JP_CHARSET defined
* fix uninitialized variables
* Str.c (Sprintf): initialize p
* buffer.c (readBufferCache): initialize prevl
* conv.c (cConvSE): initialize ub
* conv.c (_cConvEE): initialize ub
* conv.c (cConvES): initialize ub
* file.c (loadGeneralFile): initialize proc, t, prevtral, ss, realm
* file.c (HTMLlineproc2body): initialize debug
* file.c (HTMLlineproc0): initialize tbl_mode, tbl_width
* file.c (loadHTMLstream): initialize prevtrap
* file.c (loadHTMLString): initialize prevtrap
* file.c (loadBuffer): initialize prevtrap
* form.c (formUpdateBuffer): initialize col
* ftp.c (openFTP): initialize pwd
* local.c (dirBuffer): initialize nrow
* main.c (gpm_process_mouse): initialize btn
* menu.c (gpm_process_menu_mouse): ditto
* menu.c (initMenu): initialize nmenu, nitem, item
* parsetagx.c (parse_tag): initialize attr_id
* rc.c (show_params): initialize t
* table.c (visible_length): initialize amp_len
* table.c (set_integered_width): initialize x
* table.c (check_table_height): initialize space
* table.c (renderTable): initialize vrulea, vruleb, vrulec
* terms.c (putchars): initialize s
* url.c (openSocket): initialize trap, result
* url.c (openURL): initialize sslh
2001-11-28 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp> 2001-11-28 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
* [w3m-dev 02579] * [w3m-dev 02579]
+2 -2
View File
@@ -1,4 +1,4 @@
/* $Id: Str.c,v 1.5 2001/11/24 02:01:26 ukai Exp $ */ /* $Id: Str.c,v 1.6 2001/11/29 09:34:14 ukai Exp $ */
/* /*
* String manipulation library for Boehm GC * String manipulation library for Boehm GC
* *
@@ -428,7 +428,7 @@ Sprintf(char *fmt, ...)
{ {
int len = 0; int len = 0;
int status = SP_NORMAL; int status = SP_NORMAL;
int p; int p = 0;
char *f; char *f;
Str s; Str s;
va_list ap; va_list ap;
+2 -2
View File
@@ -1,4 +1,4 @@
/* $Id: buffer.c,v 1.6 2001/11/24 02:01:26 ukai Exp $ */ /* $Id: buffer.c,v 1.7 2001/11/29 09:34:14 ukai Exp $ */
#include "fm.h" #include "fm.h"
#ifdef USE_MOUSE #ifdef USE_MOUSE
@@ -630,7 +630,7 @@ int
readBufferCache(Buffer *buf) readBufferCache(Buffer *buf)
{ {
FILE *cache; FILE *cache;
Line *l = NULL, *prevl; Line *l = NULL, *prevl = NULL;
long lnum = 0, clnum, tlnum; long lnum = 0, clnum, tlnum;
#ifdef USE_ANSI_COLOR #ifdef USE_ANSI_COLOR
int colorflag; int colorflag;
Vendored
+2 -2
View File
@@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
# $Id: configure,v 1.24 2001/11/28 12:23:40 ukai Exp $ # $Id: configure,v 1.25 2001/11/29 09:34:14 ukai Exp $
# Configuration. # Configuration.
# #
@@ -1839,7 +1839,7 @@ cat > extrvers.c << EOF
#include "version.c" #include "version.c"
main() main()
{ {
char *p = strchr(version,'/'); char *p = strchr(w3m_version,'/');
if (p == NULL) if (p == NULL)
printf("unknown\n"); printf("unknown\n");
else else
+4 -4
View File
@@ -1,4 +1,4 @@
/* $Id: conv.c,v 1.5 2001/11/27 18:23:33 ukai Exp $ */ /* $Id: conv.c,v 1.6 2001/11/29 09:34:14 ukai Exp $ */
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "fm.h" #include "fm.h"
@@ -268,7 +268,7 @@ cConvSE(Str is)
static Str static Str
cConvJE(Str is) cConvJE(Str is)
{ /* Convert ISO-2022-JP to EUC-JP */ { /* Convert ISO-2022-JP to EUC-JP */
uchar *p, ub; uchar *p, ub = 0;
char cset = CSET_ASCII; char cset = CSET_ASCII;
int state = ISO_NOSTATE; int state = ISO_NOSTATE;
Str os = Strnew_size(is->length); Str os = Strnew_size(is->length);
@@ -354,7 +354,7 @@ static Str
_cConvEE(Str is, char is_euc) _cConvEE(Str is, char is_euc)
{ /* Convert EUC-JP to EUC-JP / ISO-2022-JP { /* Convert EUC-JP to EUC-JP / ISO-2022-JP
* (no JIS X 0201-Kana, 0212, 0213-2) */ * (no JIS X 0201-Kana, 0212, 0213-2) */
uchar *p, ub, euc = 0; uchar *p, ub = 0, euc = 0;
int state = EUC_NOSTATE; int state = EUC_NOSTATE;
char cset = CSET_ASCII; char cset = CSET_ASCII;
Str os; Str os;
@@ -462,7 +462,7 @@ put_sjis(Str os, uchar ub, uchar lb)
static Str static Str
cConvES(Str is) cConvES(Str is)
{ /* Convert EUC-JP to Shift-JIS */ { /* Convert EUC-JP to Shift-JIS */
uchar *p, ub; uchar *p, ub = 0;
int state = EUC_NOSTATE; int state = EUC_NOSTATE;
Str os = Strnew_size(is->length); Str os = Strnew_size(is->length);
uchar *endp = (uchar *) & is->ptr[is->length]; uchar *endp = (uchar *) & is->ptr[is->length];
+2 -2
View File
@@ -1,4 +1,4 @@
/* $Id: display.c,v 1.9 2001/11/24 16:32:10 inu Exp $ */ /* $Id: display.c,v 1.10 2001/11/29 09:34:14 ukai Exp $ */
#include <signal.h> #include <signal.h>
#include "fm.h" #include "fm.h"
@@ -402,7 +402,7 @@ redrawLine(Buffer *buf, Line *l, int i)
buf->COLS = COLS - buf->rootX; buf->COLS = COLS - buf->rootX;
} }
if (l->real_linenumber) if (l->real_linenumber)
sprintf(tmp, "%*d:", buf->rootX - 1, l->real_linenumber); sprintf(tmp, "%*ld:", buf->rootX - 1, l->real_linenumber);
else else
sprintf(tmp, "%*s ", buf->rootX - 1, ""); sprintf(tmp, "%*s ", buf->rootX - 1, "");
addstr(tmp); addstr(tmp);
+56 -55
View File
@@ -1,4 +1,4 @@
/* $Id: file.c,v 1.16 2001/11/27 18:23:33 ukai Exp $ */ /* $Id: file.c,v 1.17 2001/11/29 09:34:14 ukai Exp $ */
#include "fm.h" #include "fm.h"
#include <sys/types.h> #include <sys/types.h>
#include "myctype.h" #include "myctype.h"
@@ -413,7 +413,10 @@ matchattr(char *p, char *attr, int len, Str *value)
void void
readHeader(URLFile *uf, Buffer *newBuf, int thru, ParsedURL *pu) readHeader(URLFile *uf, Buffer *newBuf, int thru, ParsedURL *pu)
{ {
char *p, *q, *emsg; char *p, *q;
#ifdef USE_COOKIE
char *emsg;
#endif
char c; char c;
Str lineBuf2 = NULL; Str lineBuf2 = NULL;
Str tmp; Str tmp;
@@ -552,7 +555,7 @@ readHeader(URLFile *uf, Buffer *newBuf, int thru, ParsedURL *pu)
(!strncasecmp(lineBuf2->ptr, "Set-Cookie:", 11) || (!strncasecmp(lineBuf2->ptr, "Set-Cookie:", 11) ||
!strncasecmp(lineBuf2->ptr, "Set-Cookie2:", 12))) { !strncasecmp(lineBuf2->ptr, "Set-Cookie2:", 12))) {
Str name = Strnew(), value = Strnew(), domain = NULL, path = NULL, Str name = Strnew(), value = Strnew(), domain = NULL, path = NULL,
comment = NULL, commentURL = NULL, port = NULL, tmp; comment = NULL, commentURL = NULL, port = NULL, tmp2;
int version, quoted, flag = 0; int version, quoted, flag = 0;
time_t expires = (time_t) - 1; time_t expires = (time_t) - 1;
@@ -589,36 +592,36 @@ readHeader(URLFile *uf, Buffer *newBuf, int thru, ParsedURL *pu)
while (*p == ';') { while (*p == ';') {
p++; p++;
SKIP_BLANKS(p); SKIP_BLANKS(p);
if (matchattr(p, "expires", 7, &tmp)) { if (matchattr(p, "expires", 7, &tmp2)) {
/* version 0 */ /* version 0 */
expires = mymktime(tmp->ptr); expires = mymktime(tmp2->ptr);
} }
else if (matchattr(p, "max-age", 7, &tmp)) { else if (matchattr(p, "max-age", 7, &tmp2)) {
/* XXX Is there any problem with max-age=0? (RFC 2109 ss. 4.2.1, 4.2.2 */ /* XXX Is there any problem with max-age=0? (RFC 2109 ss. 4.2.1, 4.2.2 */
expires = time(NULL) + atol(tmp->ptr); expires = time(NULL) + atol(tmp2->ptr);
} }
else if (matchattr(p, "domain", 6, &tmp)) { else if (matchattr(p, "domain", 6, &tmp2)) {
domain = tmp; domain = tmp2;
} }
else if (matchattr(p, "path", 4, &tmp)) { else if (matchattr(p, "path", 4, &tmp2)) {
path = tmp; path = tmp2;
} }
else if (matchattr(p, "secure", 6, NULL)) { else if (matchattr(p, "secure", 6, NULL)) {
flag |= COO_SECURE; flag |= COO_SECURE;
} }
else if (matchattr(p, "comment", 7, &tmp)) { else if (matchattr(p, "comment", 7, &tmp2)) {
comment = tmp; comment = tmp2;
} }
else if (matchattr(p, "version", 7, &tmp)) { else if (matchattr(p, "version", 7, &tmp2)) {
version = atoi(tmp->ptr); version = atoi(tmp2->ptr);
} }
else if (matchattr(p, "port", 4, &tmp)) { else if (matchattr(p, "port", 4, &tmp2)) {
/* version 1, Set-Cookie2 */ /* version 1, Set-Cookie2 */
port = tmp; port = tmp2;
} }
else if (matchattr(p, "commentURL", 10, &tmp)) { else if (matchattr(p, "commentURL", 10, &tmp2)) {
/* version 1, Set-Cookie2 */ /* version 1, Set-Cookie2 */
commentURL = tmp; commentURL = tmp2;
} }
else if (matchattr(p, "discard", 7, NULL)) { else if (matchattr(p, "discard", 7, NULL)) {
/* version 1, Set-Cookie2 */ /* version 1, Set-Cookie2 */
@@ -893,24 +896,24 @@ same_url_p(ParsedURL *pu1, ParsedURL *pu2)
* loadGeneralFile: load file to buffer * loadGeneralFile: load file to buffer
*/ */
Buffer * Buffer *
loadGeneralFile(char *path, ParsedURL *current, char *referer, int flag, loadGeneralFile(char *path, ParsedURL *volatile current, char *referer,
FormList *request) int flag, FormList *volatile request)
{ {
URLFile f, *of = NULL; URLFile f, *volatile of = NULL;
ParsedURL pu, *volatile puv = NULL; ParsedURL pu, *volatile puv = NULL;
int volatile nredir = 0; int volatile nredir = 0;
int volatile nredir_size = 0; int volatile nredir_size = 0;
Buffer *b = NULL, *(*proc) (); Buffer *b = NULL, *(*volatile proc)() = loadBuffer;
char *tpath; char *volatile tpath;
char *t, *p, *real_type = NULL; char *volatile t = "text/plain", *p, *volatile real_type = NULL;
Buffer *t_buf = NULL; Buffer *volatile t_buf = NULL;
int searchHeader = SearchHeader; int volatile searchHeader = SearchHeader;
int searchHeader_through = TRUE; int volatile searchHeader_through = TRUE;
MySignalHandler(*prevtrap) (); MySignalHandler(*volatile prevtrap) (SIGNAL_ARG) = NULL;
TextList *extra_header = newTextList(); TextList *extra_header = newTextList();
Str ss; volatile Str ss = NULL;
Str realm; volatile Str realm = NULL;
int add_auth_cookie_flag; int volatile add_auth_cookie_flag;
unsigned char status = HTST_NORMAL; unsigned char status = HTST_NORMAL;
URLOption url_option; URLOption url_option;
Str tmp; Str tmp;
@@ -961,10 +964,10 @@ loadGeneralFile(char *path, ParsedURL *current, char *referer, int flag,
return NULL; return NULL;
if (S_ISDIR(st.st_mode)) { if (S_ISDIR(st.st_mode)) {
if (UseExternalDirBuffer) { if (UseExternalDirBuffer) {
Str tmp = Strnew_charp(DirBufferCommand); Str cmd = Strnew_charp(DirBufferCommand);
Strcat_m_charp(tmp, "?dir=", Strcat_m_charp(cmd, "?dir=",
pu.real_file, "#current", NULL); pu.real_file, "#current", NULL);
b = loadGeneralFile(tmp->ptr, NULL, NO_REFERER, 0, b = loadGeneralFile(cmd->ptr, NULL, NO_REFERER, 0,
NULL); NULL);
if (b != NULL && b != NO_BUFFER) { if (b != NULL && b != NO_BUFFER) {
copyParsedURL(&b->currentURL, &pu); copyParsedURL(&b->currentURL, &pu);
@@ -1798,16 +1801,16 @@ flushline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent,
*hidden_under = NULL, *hidden = NULL; *hidden_under = NULL, *hidden = NULL;
if (w3m_debug) { if (w3m_debug) {
FILE *f = fopen("zzzproc1", "a"); FILE *df = fopen("zzzproc1", "a");
fprintf(f, "flushline(%s,%d,%d,%d)\n", obuf->line->ptr, indent, force, fprintf(df, "flushline(%s,%d,%d,%d)\n", obuf->line->ptr, indent, force,
width); width);
if (buf) { if (buf) {
TextLineListItem *p; TextLineListItem *p;
for (p = buf->first; p; p = p->next) { for (p = buf->first; p; p = p->next) {
fprintf(f, "buf=\"%s\"\n", p->ptr->line->ptr); fprintf(df, "buf=\"%s\"\n", p->ptr->line->ptr);
} }
} }
fclose(f); fclose(df);
} }
if (!(obuf->flag & (RB_SPECIAL & ~RB_NOBR)) && Strlastchar(line) == ' ') { if (!(obuf->flag & (RB_SPECIAL & ~RB_NOBR)) && Strlastchar(line) == ' ') {
@@ -3749,12 +3752,11 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit)
Lineprop outp[LINELEN], mode, effect; Lineprop outp[LINELEN], mode, effect;
int pos; int pos;
int nlines; int nlines;
FILE *debug; FILE *debug = NULL;
struct frameset *frameset_s[FRAMESTACK_SIZE]; struct frameset *frameset_s[FRAMESTACK_SIZE];
int frameset_sp = -1; int frameset_sp = -1;
union frameset_element *idFrame = NULL; union frameset_element *idFrame = NULL;
char *id = NULL; char *id = NULL;
Str tmp;
int hseq; int hseq;
Str line; Str line;
char *endp; char *endp;
@@ -4192,8 +4194,8 @@ HTMLlineproc0(char *istr, struct html_feed_environ *h_env, int internal)
struct parsed_tag *tag; struct parsed_tag *tag;
Str tokbuf; Str tokbuf;
struct table *tbl = NULL; struct table *tbl = NULL;
struct table_mode *tbl_mode; struct table_mode *tbl_mode = NULL;
int tbl_width; int tbl_width = 0;
if (w3m_debug) { if (w3m_debug) {
FILE *f = fopen("zzzproc1", "a"); FILE *f = fopen("zzzproc1", "a");
@@ -4867,7 +4869,7 @@ loadHTMLstream(URLFile *f, Buffer *newBuf, FILE * src, int internal)
char code; char code;
struct html_feed_environ htmlenv1; struct html_feed_environ htmlenv1;
struct readbuffer obuf; struct readbuffer obuf;
MySignalHandler(*prevtrap) (); MySignalHandler(*volatile prevtrap) (SIGNAL_ARG) = NULL;
n_textarea = 0; n_textarea = 0;
cur_textarea = NULL; cur_textarea = NULL;
@@ -4988,10 +4990,10 @@ Buffer *
loadHTMLString(Str page) loadHTMLString(Str page)
{ {
URLFile f; URLFile f;
MySignalHandler(*prevtrap) (); MySignalHandler(*volatile prevtrap) (SIGNAL_ARG) = NULL;
Buffer *newBuf; Buffer *newBuf;
Str tmp; Str tmp;
FILE *src = NULL; FILE *volatile src = NULL;
newBuf = newBuffer(INIT_BUFFER_WIDTH); newBuf = newBuffer(INIT_BUFFER_WIDTH);
if (SETJMP(AbortLoading) != 0) { if (SETJMP(AbortLoading) != 0) {
@@ -5141,19 +5143,19 @@ loadGopherDir(URLFile *uf, Buffer *newBuf)
* loadBuffer: read file and make new buffer * loadBuffer: read file and make new buffer
*/ */
Buffer * Buffer *
loadBuffer(URLFile *uf, Buffer *newBuf) loadBuffer(URLFile *uf, Buffer *volatile newBuf)
{ {
FILE *src = NULL; FILE *volatile src = NULL;
char code; char code;
Str lineBuf2; Str lineBuf2;
char pre_lbuf = '\0'; volatile char pre_lbuf = '\0';
int nlines; int nlines;
Str tmpf; Str tmpf;
int linelen = 0, trbyte = 0; int linelen = 0, trbyte = 0;
#ifdef USE_ANSI_COLOR #ifdef USE_ANSI_COLOR
int check_color; int check_color;
#endif #endif
MySignalHandler(*prevtrap) (); MySignalHandler(*volatile prevtrap) (SIGNAL_ARG) = NULL;
if (newBuf == NULL) if (newBuf == NULL)
newBuf = newBuffer(INIT_BUFFER_WIDTH); newBuf = newBuffer(INIT_BUFFER_WIDTH);
@@ -5280,7 +5282,6 @@ saveBufferDelNum(Buffer *buf, FILE * f, int del)
{ {
Line *l = buf->firstLine; Line *l = buf->firstLine;
Str tmp; Str tmp;
char *p;
#ifndef KANJI_SYMBOLS #ifndef KANJI_SYMBOLS
int is_html = FALSE; int is_html = FALSE;
@@ -5598,7 +5599,7 @@ save2tmp(URLFile uf, char *tmpf)
FILE *ff; FILE *ff;
int check; int check;
int linelen = 0, trbyte = 0; int linelen = 0, trbyte = 0;
MySignalHandler(*prevtrap) (); MySignalHandler(*volatile prevtrap) (SIGNAL_ARG) = NULL;
static JMP_BUF env_bak; static JMP_BUF env_bak;
ff = fopen(tmpf, "wb"); ff = fopen(tmpf, "wb");
@@ -5665,7 +5666,7 @@ doExternal(URLFile uf, char *path, char *type, Buffer **bufp,
{ {
Str tmpf, command; Str tmpf, command;
struct mailcap *mcap; struct mailcap *mcap;
int stat; int mc_stat;
Buffer *buf = NULL; Buffer *buf = NULL;
char *header; char *header;
@@ -5693,9 +5694,9 @@ doExternal(URLFile uf, char *path, char *type, Buffer **bufp,
header = checkHeader(defaultbuf, "Content-Type:"); header = checkHeader(defaultbuf, "Content-Type:");
if (header) if (header)
header = conv_to_system(header); header = conv_to_system(header);
command = unquote_mailcap(mcap->viewer, type, tmpf->ptr, header, &stat); command = unquote_mailcap(mcap->viewer, type, tmpf->ptr, header, &mc_stat);
#ifndef __EMX__ #ifndef __EMX__
if (!(stat & MCSTAT_REPNAME)) { if (!(mc_stat & MCSTAT_REPNAME)) {
Str tmp = Sprintf("(%s) < %s", command->ptr, shell_quote(tmpf->ptr)); Str tmp = Sprintf("(%s) < %s", command->ptr, shell_quote(tmpf->ptr));
command = tmp; command = tmp;
} }
+2 -3
View File
@@ -1,4 +1,4 @@
/* $Id: fm.h,v 1.22 2001/11/27 18:23:33 ukai Exp $ */ /* $Id: fm.h,v 1.23 2001/11/29 09:34:14 ukai Exp $ */
/* /*
* w3m: WWW wo Miru utility * w3m: WWW wo Miru utility
* *
@@ -674,7 +674,7 @@ global char *CurrentMenuData;
#endif #endif
extern char *ullevel[]; extern char *ullevel[];
extern char *version; extern char *w3m_version;
#define DUMP_BUFFER 0x01 #define DUMP_BUFFER 0x01
#define DUMP_HEAD 0x02 #define DUMP_HEAD 0x02
@@ -749,7 +749,6 @@ global char *DirBufferCommand init("file:///$LIB/dirlist.cmd");
#else #else
global char *DirBufferCommand init("file:///$LIB/dirlist.cgi"); global char *DirBufferCommand init("file:///$LIB/dirlist.cgi");
#endif /* __EMX__ */ #endif /* __EMX__ */
global char *config_file init(NULL);
global int ignore_null_img_alt init(TRUE); global int ignore_null_img_alt init(TRUE);
global struct auth_cookie *Auth_cookie init(NULL); global struct auth_cookie *Auth_cookie init(NULL);
+2 -2
View File
@@ -1,4 +1,4 @@
/* $Id: form.c,v 1.6 2001/11/24 02:01:26 ukai Exp $ */ /* $Id: form.c,v 1.7 2001/11/29 09:34:14 ukai Exp $ */
/* /*
* HTML forms * HTML forms
*/ */
@@ -258,7 +258,7 @@ formUpdateBuffer(Anchor *a, Buffer *buf, FormItemList *form)
int i, j, k; int i, j, k;
Buffer save; Buffer save;
char *p; char *p;
int spos, epos, c_len, rows, c_rows, pos, col; int spos, epos, c_len, rows, c_rows, pos, col = 0;
Lineprop c_type; Lineprop c_type;
Line *l; Line *l;
+2 -2
View File
@@ -1,4 +1,4 @@
/* $Id: frame.c,v 1.6 2001/11/24 02:01:26 ukai Exp $ */ /* $Id: frame.c,v 1.7 2001/11/29 09:34:14 ukai Exp $ */
#include "fm.h" #include "fm.h"
#include "parsetagx.h" #include "parsetagx.h"
#include "myctype.h" #include "myctype.h"
@@ -429,7 +429,7 @@ createFrameFile(struct frameset *f, FILE * f1, Buffer *current, int level,
#endif /* JP_CHARSET */ #endif /* JP_CHARSET */
char *d_target, *p_target, *s_target, *t_target; char *d_target, *p_target, *s_target, *t_target;
ParsedURL *currentURL, base; ParsedURL *currentURL, base;
MySignalHandler(*prevtrap) (SIGNAL_ARG) = NULL; MySignalHandler(*volatile prevtrap) (SIGNAL_ARG) = NULL;
int flag; int flag;
if (f == NULL) if (f == NULL)
+4 -4
View File
@@ -1,4 +1,4 @@
/* $Id: ftp.c,v 1.6 2001/11/24 02:01:26 ukai Exp $ */ /* $Id: ftp.c,v 1.7 2001/11/29 09:34:14 ukai Exp $ */
#include <stdio.h> #include <stdio.h>
#include <pwd.h> #include <pwd.h>
#include <Str.h> #include <Str.h>
@@ -121,9 +121,9 @@ FtpLogin(FTP * ftp_return, char *host, char *user, char *pass)
struct hostent *sockent; struct hostent *sockent;
Str tmp2 = Strnew_charp(pass); Str tmp2 = Strnew_charp(pass);
if (sockent = gethostbyaddr((char *)&sockname.sin_addr, if ((sockent = gethostbyaddr((char *)&sockname.sin_addr,
sizeof(sockname.sin_addr), sizeof(sockname.sin_addr),
sockname.sin_family)) sockname.sin_family)))
Strcat_charp(tmp2, sockent->h_name); Strcat_charp(tmp2, sockent->h_name);
else else
Strcat_m_charp(tmp2, "[", inet_ntoa(sockname.sin_addr), Strcat_m_charp(tmp2, "[", inet_ntoa(sockname.sin_addr),
@@ -401,7 +401,7 @@ openFTP(ParsedURL *pu)
char *qdir; char *qdir;
char **flist; char **flist;
int i, nfile, nfile_max = 100; int i, nfile, nfile_max = 100;
Str pwd; Str pwd = NULL;
int add_auth_cookie_flag; int add_auth_cookie_flag;
char *realpath = NULL; char *realpath = NULL;
#ifdef JP_CHARSET #ifdef JP_CHARSET
+7 -6
View File
@@ -1,4 +1,4 @@
/* $Id: linein.c,v 1.8 2001/11/24 02:01:26 ukai Exp $ */ /* $Id: linein.c,v 1.9 2001/11/29 09:34:14 ukai Exp $ */
#include "fm.h" #include "fm.h"
#include "local.h" #include "local.h"
#include "myctype.h" #include "myctype.h"
@@ -411,7 +411,10 @@ ins_kanji(Str tmp)
static void static void
_esc(void) _esc(void)
{ {
char c, c2; char c;
#ifdef JP_CHARSET
char c2;
#endif
switch (c = getch()) { switch (c = getch()) {
case '[': case '[':
@@ -440,16 +443,14 @@ _esc(void)
need_redraw = TRUE; need_redraw = TRUE;
} }
else else
#else
_rcompl();
#endif #endif
_rcompl();
break; break;
case CTRL_D: case CTRL_D:
#ifdef EMACS_LIKE_LINEEDIT #ifdef EMACS_LIKE_LINEEDIT
if (!emacs_like_lineedit) if (!emacs_like_lineedit)
#else
_rdcompl();
#endif #endif
_rdcompl();
need_redraw = TRUE; need_redraw = TRUE;
break; break;
#ifdef EMACS_LIKE_LINEEDIT #ifdef EMACS_LIKE_LINEEDIT
+3 -3
View File
@@ -1,4 +1,4 @@
/* $Id: local.c,v 1.9 2001/11/24 02:01:26 ukai Exp $ */ /* $Id: local.c,v 1.10 2001/11/29 09:34:14 ukai Exp $ */
#include "fm.h" #include "fm.h"
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
@@ -47,7 +47,7 @@ dirBuffer(char *dname)
struct stat lst; struct stat lst;
char lbuf[1024]; char lbuf[1024];
#endif /* HAVE_READLINK */ #endif /* HAVE_READLINK */
int i, l, nrow, n = 0, maxlen = 0; int i, l, nrow = 0, n = 0, maxlen = 0;
int nfile, nfile_max = 100; int nfile, nfile_max = 100;
Str dirname; Str dirname;
Buffer *buf; Buffer *buf;
@@ -256,7 +256,7 @@ set_environ(char *var, char *value)
static void static void
set_cgi_environ(char *name, char *fn, char *req_uri) set_cgi_environ(char *name, char *fn, char *req_uri)
{ {
set_environ("SERVER_SOFTWARE", version); set_environ("SERVER_SOFTWARE", w3m_version);
set_environ("SERVER_PROTOCOL", "HTTP/1.0"); set_environ("SERVER_PROTOCOL", "HTTP/1.0");
set_environ("SERVER_NAME", "localhost"); set_environ("SERVER_NAME", "localhost");
set_environ("SERVER_PORT", "80"); /* dummy */ set_environ("SERVER_PORT", "80"); /* dummy */
+13 -13
View File
@@ -1,4 +1,4 @@
/* $Id: mailcap.c,v 1.6 2001/11/24 02:01:26 ukai Exp $ */ /* $Id: mailcap.c,v 1.7 2001/11/29 09:34:15 ukai Exp $ */
#include "fm.h" #include "fm.h"
#include "myctype.h" #include "myctype.h"
#include <stdio.h> #include <stdio.h>
@@ -300,15 +300,15 @@ quote_mailcap(char *s, int flag)
static Str static Str
unquote_mailcap_loop(char *qstr, char *type, char *name, char *attr, int *stat, unquote_mailcap_loop(char *qstr, char *type, char *name, char *attr,
int flag0) int *mc_stat, int flag0)
{ {
Str str, tmp, test, then; Str str, tmp, test, then;
char *p; char *p;
int status = MC_NORMAL, prev_status = MC_NORMAL, sp = 0, flag; int status = MC_NORMAL, prev_status = MC_NORMAL, sp = 0, flag;
if (stat) if (mc_stat)
*stat = 0; *mc_stat = 0;
if (qstr == NULL) if (qstr == NULL)
return NULL; return NULL;
@@ -357,15 +357,15 @@ unquote_mailcap_loop(char *qstr, char *type, char *name, char *attr, int *stat,
case 's': case 's':
if (name) { if (name) {
Strcat_charp(str, quote_mailcap(name, flag)->ptr); Strcat_charp(str, quote_mailcap(name, flag)->ptr);
if (stat) if (mc_stat)
*stat |= MCSTAT_REPNAME; *mc_stat |= MCSTAT_REPNAME;
} }
break; break;
case 't': case 't':
if (type) { if (type) {
Strcat_charp(str, quote_mailcap(type, flag)->ptr); Strcat_charp(str, quote_mailcap(type, flag)->ptr);
if (stat) if (mc_stat)
*stat |= MCSTAT_REPTYPE; *mc_stat |= MCSTAT_REPTYPE;
} }
break; break;
} }
@@ -401,8 +401,8 @@ unquote_mailcap_loop(char *qstr, char *type, char *name, char *attr, int *stat,
(q == attr || IS_SPACE(*(q - 1)) || *(q - 1) == ';') && (q == attr || IS_SPACE(*(q - 1)) || *(q - 1) == ';') &&
matchattr(q, tmp->ptr, tmp->length, &tmp)) { matchattr(q, tmp->ptr, tmp->length, &tmp)) {
Strcat_charp(str, quote_mailcap(tmp->ptr, flag)->ptr); Strcat_charp(str, quote_mailcap(tmp->ptr, flag)->ptr);
if (stat) if (mc_stat)
*stat |= MCSTAT_REPPARAM; *mc_stat |= MCSTAT_REPPARAM;
} }
status = MC_NORMAL; status = MC_NORMAL;
} }
@@ -416,7 +416,7 @@ unquote_mailcap_loop(char *qstr, char *type, char *name, char *attr, int *stat,
} }
Str Str
unquote_mailcap(char *qstr, char *type, char *name, char *attr, int *stat) unquote_mailcap(char *qstr, char *type, char *name, char *attr, int *mc_stat)
{ {
return unquote_mailcap_loop(qstr, type, name, attr, stat, 0); return unquote_mailcap_loop(qstr, type, name, attr, mc_stat, 0);
} }
+22 -21
View File
@@ -1,4 +1,4 @@
/* $Id: main.c,v 1.25 2001/11/27 18:23:33 ukai Exp $ */ /* $Id: main.c,v 1.26 2001/11/29 09:34:15 ukai Exp $ */
#define MAINPROGRAM #define MAINPROGRAM
#include "fm.h" #include "fm.h"
#include <signal.h> #include <signal.h>
@@ -56,7 +56,7 @@ JMP_BUF IntReturn;
static void cmd_loadfile(char *path); static void cmd_loadfile(char *path);
static void cmd_loadURL(char *url, ParsedURL *current); static void cmd_loadURL(char *url, ParsedURL *current);
static void cmd_loadBuffer(Buffer *buf, int prop, int link); static void cmd_loadBuffer(Buffer *buf, int prop, int linkid);
static void keyPressEventProc(int c); static void keyPressEventProc(int c);
#ifdef USE_MARK #ifdef USE_MARK
static void cmd_mark(Lineprop *p); static void cmd_mark(Lineprop *p);
@@ -88,7 +88,7 @@ static int searchKeyNum(void);
static void static void
fusage(FILE * f, int err) fusage(FILE * f, int err)
{ {
fprintf(f, "version %s\n", version); fprintf(f, "version %s\n", w3m_version);
fprintf(f, "usage: w3m [options] [URL or filename]\noptions:\n"); fprintf(f, "usage: w3m [options] [URL or filename]\noptions:\n");
fprintf(f, " -t tab set tab width\n"); fprintf(f, " -t tab set tab width\n");
fprintf(f, " -r ignore backspace effect\n"); fprintf(f, " -r ignore backspace effect\n");
@@ -211,21 +211,21 @@ wrap_GC_warn_proc(char *msg, GC_word arg)
static void static void
sig_chld(int signo) sig_chld(int signo)
{ {
int stat; int p_stat;
#ifdef HAVE_WAITPID #ifdef HAVE_WAITPID
pid_t pid; pid_t pid;
while ((pid = waitpid(-1, &stat, WNOHANG)) > 0) { while ((pid = waitpid(-1, &p_stat, WNOHANG)) > 0) {
; ;
} }
#elif HAVE_WAIT3 #elif HAVE_WAIT3
int pid; int pid;
while ((pid = wait3(&stat, WNOHANG, NULL)) > 0) { while ((pid = wait3(&p_stat, WNOHANG, NULL)) > 0) {
; ;
} }
#else #else
wait(&stat); wait(&p_stat);
#endif #endif
signal(SIGCHLD, sig_chld); signal(SIGCHLD, sig_chld);
return; return;
@@ -274,6 +274,7 @@ MAIN(int argc, char **argv, char **envp)
char search_header = FALSE; char search_header = FALSE;
char *default_type = NULL; char *default_type = NULL;
char *post_file = NULL; char *post_file = NULL;
char *config_filename = NULL;
Str err_msg; Str err_msg;
#ifndef HAVE_SYS_ERRLIST #ifndef HAVE_SYS_ERRLIST
@@ -294,7 +295,7 @@ MAIN(int argc, char **argv, char **envp)
i = strlen(rc_dir); i = strlen(rc_dir);
if (i > 1 && rc_dir[i - 1] == '/') if (i > 1 && rc_dir[i - 1] == '/')
rc_dir[i - 1] = '\0'; rc_dir[i - 1] = '\0';
config_file = rcFile(CONFIG_FILE); config_filename = rcFile(CONFIG_FILE);
create_option_search_table(); create_option_search_table();
/* argument search 1 */ /* argument search 1 */
@@ -304,7 +305,7 @@ MAIN(int argc, char **argv, char **envp)
argv[i] = "-dummy"; argv[i] = "-dummy";
if (++i >= argc) if (++i >= argc)
usage(); usage();
config_file = argv[i]; config_filename = argv[i];
argv[i] = "-dummy"; argv[i] = "-dummy";
} }
else if (!strcmp("-h", argv[i])) else if (!strcmp("-h", argv[i]))
@@ -313,7 +314,7 @@ MAIN(int argc, char **argv, char **envp)
} }
/* initializations */ /* initializations */
init_rc(config_file); init_rc(config_filename);
#ifdef USE_COOKIE #ifdef USE_COOKIE
initCookie(); initCookie();
#endif /* USE_COOKIE */ #endif /* USE_COOKIE */
@@ -644,7 +645,7 @@ MAIN(int argc, char **argv, char **envp)
Strcat_charp(s_page, "<a href='http://w3m.sourceforge.net/'>"); Strcat_charp(s_page, "<a href='http://w3m.sourceforge.net/'>");
Strcat_m_charp(s_page, Strcat_m_charp(s_page,
"w3m</a>!<p><p>This is w3m version ", "w3m</a>!<p><p>This is w3m version ",
version, w3m_version,
"<br>Written by <a href='mailto:aito@fw.ipsj.or.jp'>Akinori Ito</a>", "<br>Written by <a href='mailto:aito@fw.ipsj.or.jp'>Akinori Ito</a>",
NULL); NULL);
#ifdef DEBIAN #ifdef DEBIAN
@@ -1237,7 +1238,7 @@ srchfor(void)
MySignalHandler(*prevtrap) (); MySignalHandler(*prevtrap) ();
char *str; char *str;
int i, n = searchKeyNum(); int i, n = searchKeyNum();
int wrapped = 0; volatile int wrapped = 0;
str = inputStrHist("Forward: ", NULL, TextHist); str = inputStrHist("Forward: ", NULL, TextHist);
if (str != NULL && *str == '\0') if (str != NULL && *str == '\0')
@@ -1269,7 +1270,7 @@ srchbak(void)
MySignalHandler(*prevtrap) (); MySignalHandler(*prevtrap) ();
char *str; char *str;
int i, n = searchKeyNum(); int i, n = searchKeyNum();
int wrapped = 0; volatile int wrapped = 0;
str = inputStrHist("Backward: ", NULL, TextHist); str = inputStrHist("Backward: ", NULL, TextHist);
if (str != NULL && *str == '\0') if (str != NULL && *str == '\0')
@@ -1295,10 +1296,10 @@ srchbak(void)
} }
static void static void
srch_nxtprv(int reverse) srch_nxtprv(volatile int reverse)
{ {
int i; int i;
int wrapped = 0; volatile int wrapped = 0;
static int (*routine[2]) (Buffer *, char *) = { static int (*routine[2]) (Buffer *, char *) = {
forwardSearch, backwardSearch}; forwardSearch, backwardSearch};
MySignalHandler(*prevtrap) (); MySignalHandler(*prevtrap) ();
@@ -3498,7 +3499,7 @@ goURL(void)
} }
static void static void
cmd_loadBuffer(Buffer *buf, int prop, int link) cmd_loadBuffer(Buffer *buf, int prop, int linkid)
{ {
if (buf == NULL) { if (buf == NULL) {
disp_err_message("Can't load string", FALSE); disp_err_message("Can't load string", FALSE);
@@ -3507,9 +3508,9 @@ cmd_loadBuffer(Buffer *buf, int prop, int link)
buf->bufferprop |= (BP_INTERNAL | prop); buf->bufferprop |= (BP_INTERNAL | prop);
if (!(buf->bufferprop & BP_NO_URL)) if (!(buf->bufferprop & BP_NO_URL))
copyParsedURL(&buf->currentURL, &Currentbuf->currentURL); copyParsedURL(&buf->currentURL, &Currentbuf->currentURL);
if (link != LB_NOLINK) { if (linkid != LB_NOLINK) {
buf->linkBuffer[REV_LB[link]] = Currentbuf; buf->linkBuffer[REV_LB[linkid]] = Currentbuf;
Currentbuf->linkBuffer[link] = buf; Currentbuf->linkBuffer[linkid] = buf;
} }
pushBuffer(buf); pushBuffer(buf);
} }
@@ -4401,7 +4402,7 @@ mouse()
int int
gpm_process_mouse(Gpm_Event * event, void *data) gpm_process_mouse(Gpm_Event * event, void *data)
{ {
int btn, x, y; int btn = MOUSE_BTN_RESET, x, y;
if (event->type & GPM_UP) if (event->type & GPM_UP)
btn = MOUSE_BTN_UP; btn = MOUSE_BTN_UP;
else if (event->type & GPM_DOWN) { else if (event->type & GPM_DOWN) {
@@ -4454,7 +4455,7 @@ sysm_process_mouse(int x, int y, int nbs, int obs)
void void
dispVer() dispVer()
{ {
disp_message(Sprintf("w3m version %s", version)->ptr, FALSE); disp_message(Sprintf("w3m version %s", w3m_version)->ptr, FALSE);
} }
void void
+72 -72
View File
@@ -1,4 +1,4 @@
/* $Id: menu.c,v 1.6 2001/11/24 02:01:26 ukai Exp $ */ /* $Id: menu.c,v 1.7 2001/11/29 09:34:15 ukai Exp $ */
/* /*
* w3m menu.c * w3m menu.c
*/ */
@@ -383,11 +383,11 @@ new_menu(Menu *menu, MenuItem *item)
} }
void void
geom_menu(Menu *menu, int x, int y, int select) geom_menu(Menu *menu, int x, int y, int mselect)
{ {
int win_x, win_y, win_w, win_h; int win_x, win_y, win_w, win_h;
menu->select = select; menu->select = mselect;
if (menu->width % FRAME_WIDTH) if (menu->width % FRAME_WIDTH)
menu->width = (menu->width / FRAME_WIDTH + 1) * FRAME_WIDTH; menu->width = (menu->width / FRAME_WIDTH + 1) * FRAME_WIDTH;
@@ -405,7 +405,7 @@ geom_menu(Menu *menu, int x, int y, int select)
} }
menu->x = win_x + FRAME_WIDTH; menu->x = win_x + FRAME_WIDTH;
win_y = menu->y - select - 1; win_y = menu->y - mselect - 1;
win_h = menu->height + 2; win_h = menu->height + 2;
if (win_y + win_h > LASTLINE) if (win_y + win_h > LASTLINE)
win_y = LASTLINE - win_h; win_y = LASTLINE - win_h;
@@ -414,8 +414,8 @@ geom_menu(Menu *menu, int x, int y, int select)
if (win_y + win_h > LASTLINE) { if (win_y + win_h > LASTLINE) {
win_h = LASTLINE - win_y; win_h = LASTLINE - win_y;
menu->height = win_h - 2; menu->height = win_h - 2;
if (menu->height <= select) if (menu->height <= mselect)
menu->offset = select - menu->height + 1; menu->offset = mselect - menu->height + 1;
} }
} }
menu->y = win_y + 1; menu->y = win_y + 1;
@@ -506,32 +506,32 @@ draw_menu(Menu *menu)
} }
void void
draw_menu_item(Menu *menu, int select) draw_menu_item(Menu *menu, int mselect)
{ {
mvaddnstr(menu->y + select - menu->offset, menu->x, mvaddnstr(menu->y + mselect - menu->offset, menu->x,
menu->item[select].label, menu->width); menu->item[mselect].label, menu->width);
} }
int int
select_menu(Menu *menu, int select) select_menu(Menu *menu, int mselect)
{ {
if (select < 0 || select >= menu->nitem) if (mselect < 0 || mselect >= menu->nitem)
return (MENU_NOTHING); return (MENU_NOTHING);
if (select < menu->offset) if (mselect < menu->offset)
up_menu(menu, menu->offset - select); up_menu(menu, menu->offset - mselect);
else if (select >= menu->offset + menu->height) else if (mselect >= menu->offset + menu->height)
down_menu(menu, select - menu->offset - menu->height + 1); down_menu(menu, mselect - menu->offset - menu->height + 1);
if (menu->select >= menu->offset && if (menu->select >= menu->offset &&
menu->select < menu->offset + menu->height) menu->select < menu->offset + menu->height)
draw_menu_item(menu, menu->select); draw_menu_item(menu, menu->select);
menu->select = select; menu->select = mselect;
standout(); standout();
draw_menu_item(menu, menu->select); draw_menu_item(menu, menu->select);
standend(); standend();
/* /*
* move(menu->cursorY, menu->cursorX); */ * move(menu->cursorY, menu->cursorX); */
move(menu->y + select - menu->offset, menu->x); move(menu->y + mselect - menu->offset, menu->x);
toggle_stand(); toggle_stand();
refresh(); refresh();
@@ -539,26 +539,26 @@ select_menu(Menu *menu, int select)
} }
void void
goto_menu(Menu *menu, int select, int down) goto_menu(Menu *menu, int mselect, int down)
{ {
int select_in; int select_in;
if (select >= menu->nitem) if (mselect >= menu->nitem)
select = menu->nitem - 1; mselect = menu->nitem - 1;
else if (select < 0) else if (mselect < 0)
select = 0; mselect = 0;
select_in = select; select_in = mselect;
while (menu->item[select].type == MENU_NOP) { while (menu->item[mselect].type == MENU_NOP) {
if (down > 0) { if (down > 0) {
if (++select >= menu->nitem) { if (++mselect >= menu->nitem) {
down_menu(menu, select_in - menu->select); down_menu(menu, select_in - menu->select);
select = menu->select; mselect = menu->select;
break; break;
} }
} }
else if (down < 0) { else if (down < 0) {
if (--select < 0) { if (--mselect < 0) {
up_menu(menu, menu->select - select_in); up_menu(menu, menu->select - select_in);
select = menu->select; mselect = menu->select;
break; break;
} }
} }
@@ -566,7 +566,7 @@ goto_menu(Menu *menu, int select, int down)
return; return;
} }
} }
select_menu(menu, select); select_menu(menu, mselect);
} }
void void
@@ -597,7 +597,7 @@ int
action_menu(Menu *menu) action_menu(Menu *menu)
{ {
char c; char c;
int select; int mselect;
MenuItem item; MenuItem item;
if (menu->active == 0) { if (menu->active == 0) {
@@ -619,21 +619,21 @@ action_menu(Menu *menu)
mouse_inactive(); mouse_inactive();
#if defined(USE_GPM) || defined(USE_SYSMOUSE) #if defined(USE_GPM) || defined(USE_SYSMOUSE)
if (c == X_MOUSE_SELECTED) { if (c == X_MOUSE_SELECTED) {
select = X_Mouse_Selection; mselect = X_Mouse_Selection;
if (select != MENU_NOTHING) if (mselect != MENU_NOTHING)
break; break;
} }
#endif /* defined(USE_GPM) || * * * * * * #endif /* defined(USE_GPM) || * * * * * *
* defined(USE_SYSMOUSE) */ * defined(USE_SYSMOUSE) */
#endif /* USE_MOUSE */ #endif /* USE_MOUSE */
if (IS_ASCII(c)) { /* Ascii */ if (IS_ASCII(c)) { /* Ascii */
select = (*menu->keymap[(int)c]) (c); mselect = (*menu->keymap[(int)c]) (c);
if (select != MENU_NOTHING) if (mselect != MENU_NOTHING)
break; break;
} }
} }
if (select >= 0 && select < menu->nitem) { if (mselect >= 0 && mselect < menu->nitem) {
item = menu->item[select]; item = menu->item[mselect];
if (item.type & MENU_POPUP) { if (item.type & MENU_POPUP) {
popup_menu(menu, item.popup); popup_menu(menu, item.popup);
return (1); return (1);
@@ -650,7 +650,7 @@ action_menu(Menu *menu)
CurrentMenuData = NULL; CurrentMenuData = NULL;
} }
} }
else if (select == MENU_CLOSE) { else if (mselect == MENU_CLOSE) {
if (menu->parent != NULL) if (menu->parent != NULL)
menu->parent->active = 0; menu->parent->active = 0;
} }
@@ -845,24 +845,24 @@ mTop(char c)
static int static int
mNext(char c) mNext(char c)
{ {
int select = CurrentMenu->select + CurrentMenu->height; int mselect = CurrentMenu->select + CurrentMenu->height;
if (select >= CurrentMenu->nitem) if (mselect >= CurrentMenu->nitem)
return mLast(c); return mLast(c);
down_menu(CurrentMenu, CurrentMenu->height); down_menu(CurrentMenu, CurrentMenu->height);
goto_menu(CurrentMenu, select, -1); goto_menu(CurrentMenu, mselect, -1);
return (MENU_NOTHING); return (MENU_NOTHING);
} }
static int static int
mPrev(char c) mPrev(char c)
{ {
int select = CurrentMenu->select - CurrentMenu->height; int mselect = CurrentMenu->select - CurrentMenu->height;
if (select < 0) if (mselect < 0)
return mTop(c); return mTop(c);
up_menu(CurrentMenu, CurrentMenu->height); up_menu(CurrentMenu, CurrentMenu->height);
goto_menu(CurrentMenu, select, 1); goto_menu(CurrentMenu, mselect, 1);
return (MENU_NOTHING); return (MENU_NOTHING);
} }
@@ -889,11 +889,11 @@ mBack(char c)
static int static int
mOk(char c) mOk(char c)
{ {
int select = CurrentMenu->select; int mselect = CurrentMenu->select;
if (CurrentMenu->item[select].type == MENU_NOP) if (CurrentMenu->item[mselect].type == MENU_NOP)
return (MENU_NOTHING); return (MENU_NOTHING);
return (select); return (mselect);
} }
static int static int
@@ -963,10 +963,10 @@ menu_search_forward(Menu *menu, int from)
static int static int
mSrchF(char c) mSrchF(char c)
{ {
int select; int mselect;
select = menu_search_forward(CurrentMenu, CurrentMenu->select); mselect = menu_search_forward(CurrentMenu, CurrentMenu->select);
if (select >= 0) if (mselect >= 0)
goto_menu(CurrentMenu, select, 1); goto_menu(CurrentMenu, mselect, 1);
return (MENU_NOTHING); return (MENU_NOTHING);
} }
@@ -1012,10 +1012,10 @@ menu_search_backward(Menu *menu, int from)
static int static int
mSrchB(char c) mSrchB(char c)
{ {
int select; int mselect;
select = menu_search_backward(CurrentMenu, CurrentMenu->select); mselect = menu_search_backward(CurrentMenu, CurrentMenu->select);
if (select >= 0) if (mselect >= 0)
goto_menu(CurrentMenu, select, -1); goto_menu(CurrentMenu, mselect, -1);
return (MENU_NOTHING); return (MENU_NOTHING);
} }
@@ -1048,20 +1048,20 @@ menu_search_next_previous(Menu *menu, int from, int reverse)
static int static int
mSrchN(char c) mSrchN(char c)
{ {
int select; int mselect;
select = menu_search_next_previous(CurrentMenu, CurrentMenu->select, 0); mselect = menu_search_next_previous(CurrentMenu, CurrentMenu->select, 0);
if (select >= 0) if (mselect >= 0)
goto_menu(CurrentMenu, select, 1); goto_menu(CurrentMenu, mselect, 1);
return (MENU_NOTHING); return (MENU_NOTHING);
} }
static int static int
mSrchP(char c) mSrchP(char c)
{ {
int select; int mselect;
select = menu_search_next_previous(CurrentMenu, CurrentMenu->select, 1); mselect = menu_search_next_previous(CurrentMenu, CurrentMenu->select, 1);
if (select >= 0) if (mselect >= 0)
goto_menu(CurrentMenu, select, -1); goto_menu(CurrentMenu, mselect, -1);
return (MENU_NOTHING); return (MENU_NOTHING);
} }
@@ -1081,7 +1081,7 @@ static int
process_mMouse(int btn, int x, int y) process_mMouse(int btn, int x, int y)
{ {
Menu *menu; Menu *menu;
int select; int mselect;
static int press_btn = MOUSE_BTN_RESET, press_x, press_y; static int press_btn = MOUSE_BTN_RESET, press_x, press_y;
char c = ' '; char c = ' ';
@@ -1112,10 +1112,10 @@ process_mMouse(int btn, int x, int y)
return (MENU_NOTHING); return (MENU_NOTHING);
} }
else { else {
select = y - menu->y + menu->offset; mselect = y - menu->y + menu->offset;
if (menu->item[select].type == MENU_NOP) if (menu->item[mselect].type == MENU_NOP)
return (MENU_NOTHING); return (MENU_NOTHING);
return (select_menu(menu, select)); return (select_menu(menu, mselect));
} }
} }
} }
@@ -1149,7 +1149,7 @@ mMouse(char c)
static int static int
gpm_process_menu_mouse(Gpm_Event * event, void *data) gpm_process_menu_mouse(Gpm_Event * event, void *data)
{ {
int btn, x, y; int btn = MOUSE_BTN_RESET, x, y;
if (event->type & GPM_UP) if (event->type & GPM_UP)
btn = MOUSE_BTN_UP; btn = MOUSE_BTN_UP;
else if (event->type & GPM_DOWN) { else if (event->type & GPM_DOWN) {
@@ -1340,7 +1340,7 @@ smChBuf(void)
static int static int
smDelBuf(char c) smDelBuf(char c)
{ {
int i, x, y, select; int i, x, y, mselect;
Buffer *buf; Buffer *buf;
if (CurrentMenu->select < 0 || CurrentMenu->select >= SelectMenu.nitem) if (CurrentMenu->select < 0 || CurrentMenu->select >= SelectMenu.nitem)
@@ -1359,7 +1359,7 @@ smDelBuf(char c)
x = CurrentMenu->x; x = CurrentMenu->x;
y = CurrentMenu->y; y = CurrentMenu->y;
select = CurrentMenu->select; mselect = CurrentMenu->select;
initSelectMenu(); initSelectMenu();
@@ -1368,7 +1368,7 @@ smDelBuf(char c)
geom_menu(CurrentMenu, x, y, 0); geom_menu(CurrentMenu, x, y, 0);
CurrentMenu->select = (select <= CurrentMenu->nitem - 2) ? select CurrentMenu->select = (mselect <= CurrentMenu->nitem - 2) ? mselect
: (CurrentMenu->nitem - 2); : (CurrentMenu->nitem - 2);
displayBuffer(Currentbuf, B_FORCE_REDRAW); displayBuffer(Currentbuf, B_FORCE_REDRAW);
@@ -1407,8 +1407,8 @@ initMenu(void)
FILE *mf; FILE *mf;
Str line; Str line;
char *p, *s; char *p, *s;
int in_menu, nmenu, nitem, type; int in_menu, nmenu = 0, nitem = 0, type;
MenuItem *item; MenuItem *item = NULL;
MenuList *list; MenuList *list;
w3mMenuList = New_N(MenuList, 3); w3mMenuList = New_N(MenuList, 3);
+2 -2
View File
@@ -1,4 +1,4 @@
/* $Id: parsetagx.c,v 1.5 2001/11/24 02:01:26 ukai Exp $ */ /* $Id: parsetagx.c,v 1.6 2001/11/29 09:34:15 ukai Exp $ */
#include "fm.h" #include "fm.h"
#include "myctype.h" #include "myctype.h"
#include "indep.h" #include "indep.h"
@@ -102,7 +102,7 @@ parse_tag(char **s, int internal)
int tag_id; int tag_id;
char tagname[MAX_TAG_LEN], attrname[MAX_TAG_LEN]; char tagname[MAX_TAG_LEN], attrname[MAX_TAG_LEN];
char *p, *q; char *p, *q;
int i, attr_id, nattr; int i, attr_id = 0, nattr;
/* Parse tag name */ /* Parse tag name */
q = (*s) + 1; q = (*s) + 1;
+7 -7
View File
@@ -1,4 +1,4 @@
/* $Id: proto.h,v 1.9 2001/11/27 18:29:24 ukai Exp $ */ /* $Id: proto.h,v 1.10 2001/11/29 09:34:15 ukai Exp $ */
/* /*
* This file was automatically generated by version 1.7 of cextract. * This file was automatically generated by version 1.7 of cextract.
* Manual editing not recommended. * Manual editing not recommended.
@@ -415,7 +415,7 @@ extern struct mailcap *searchMailcap(struct mailcap *table, char *type);
extern void initMailcap(); extern void initMailcap();
extern struct mailcap *searchExtViewer(char *type); extern struct mailcap *searchExtViewer(char *type);
extern Str unquote_mailcap(char *qstr, char *type, char *name, char *attr, extern Str unquote_mailcap(char *qstr, char *type, char *name, char *attr,
int *stat); int *mc_stat);
extern char *guessContentType(char *filename); 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 int check_no_proxy(char *domain);
@@ -456,7 +456,7 @@ extern Str encodeB(char *a);
extern int set_param_option(char *option); extern int set_param_option(char *option);
extern char *get_param_option(char *name); extern char *get_param_option(char *name);
extern void create_option_search_table(); extern void create_option_search_table();
extern void init_rc(char *config_file); extern void init_rc(char *config_filename);
extern Buffer *load_option_panel(void); extern Buffer *load_option_panel(void);
extern void panel_set_option(struct parsed_tagarg *); extern void panel_set_option(struct parsed_tagarg *);
extern void sync_with_option(void); extern void sync_with_option(void);
@@ -533,12 +533,12 @@ extern char *getQWord(char **str);
#ifdef USE_MENU #ifdef USE_MENU
extern void new_menu(Menu *menu, MenuItem *item); extern void new_menu(Menu *menu, MenuItem *item);
extern void geom_menu(Menu *menu, int x, int y, int select); extern void geom_menu(Menu *menu, int x, int y, int mselect);
extern void draw_all_menu(Menu *menu); extern void draw_all_menu(Menu *menu);
extern void draw_menu(Menu *menu); extern void draw_menu(Menu *menu);
extern void draw_menu_item(Menu *menu, int select); extern void draw_menu_item(Menu *menu, int mselect);
extern int select_menu(Menu *menu, int select); extern int select_menu(Menu *menu, int mselect);
extern void goto_menu(Menu *menu, int select, int down); extern void goto_menu(Menu *menu, int mselect, int down);
extern void up_menu(Menu *menu, int n); extern void up_menu(Menu *menu, int n);
extern void down_menu(Menu *menu, int n); extern void down_menu(Menu *menu, int n);
extern int action_menu(Menu *menu); extern int action_menu(Menu *menu);
+6 -4
View File
@@ -1,4 +1,4 @@
/* $Id: rc.c,v 1.15 2001/11/27 18:29:24 ukai Exp $ */ /* $Id: rc.c,v 1.16 2001/11/29 09:34:15 ukai Exp $ */
/* /*
* Initialization file etc. * Initialization file etc.
*/ */
@@ -34,6 +34,7 @@ static struct rc_search_table *RC_search_table;
static int RC_table_size; static int RC_table_size;
static int rc_initialized = 0; static int rc_initialized = 0;
static char *config_file = NULL;
#define P_INT 0 #define P_INT 0
#define P_SHORT 1 #define P_SHORT 1
@@ -702,7 +703,7 @@ void
show_params(FILE * fp) show_params(FILE * fp)
{ {
int i, j, l; int i, j, l;
char *t; char *t = NULL;
char *cmt; char *cmt;
fputs("\nconfiguration parameters\n", fp); fputs("\nconfiguration parameters\n", fp);
@@ -1153,7 +1154,7 @@ sync_with_option(void)
} }
void void
init_rc(char *config_file) init_rc(char *config_filename)
{ {
struct stat st; struct stat st;
FILE *f; FILE *f;
@@ -1200,6 +1201,7 @@ init_rc(char *config_file)
interpret_rc(f); interpret_rc(f);
fclose(f); fclose(f);
} }
config_file = config_filename;
if (config_file == NULL) if (config_file == NULL)
config_file = rcFile(CONFIG_FILE); config_file = rcFile(CONFIG_FILE);
if ((f = fopen(config_file, "rt")) != NULL) { if ((f = fopen(config_file, "rt")) != NULL) {
@@ -1248,7 +1250,7 @@ to_str(struct param_ptr *p)
Buffer * Buffer *
load_option_panel(void) load_option_panel(void)
{ {
Str src = Sprintf(optionpanel_src1, version, CMT_HELPER); Str src = Sprintf(optionpanel_src1, w3m_version, CMT_HELPER);
struct param_ptr *p; struct param_ptr *p;
struct sel_c *s; struct sel_c *s;
int x, i; int x, i;
+5 -5
View File
@@ -1,4 +1,4 @@
/* $Id: table.c,v 1.8 2001/11/24 02:01:26 ukai Exp $ */ /* $Id: table.c,v 1.9 2001/11/29 09:34:15 ukai Exp $ */
/* /*
* HTML table * HTML table
*/ */
@@ -470,7 +470,7 @@ visible_length(char *str)
int prev_status = status; int prev_status = status;
Str tagbuf = Strnew(); Str tagbuf = Strnew();
char *t, *r2; char *t, *r2;
int amp_len; int amp_len = 0;
t = str; t = str;
while (*str) { while (*str) {
@@ -938,7 +938,7 @@ set_integered_width(struct table *t, double *dwidth, short *iwidth)
int i, j, k, n, bcol, ecol, step; int i, j, k, n, bcol, ecol, step;
char *index, *fixed; char *index, *fixed;
double *mod; double *mod;
double sum = 0., x; double sum = 0., x = 0.;
struct table_cell *cell = &t->cell; struct table_cell *cell = &t->cell;
int rulewidth = table_rule_width(t); int rulewidth = table_rule_width(t);
@@ -1483,7 +1483,7 @@ check_table_height(struct table *t)
short maxcell; short maxcell;
short height[MAXCELL]; short height[MAXCELL];
} cell; } cell;
int space; int space = 0;
cell.maxcell = -1; cell.maxcell = -1;
@@ -1680,7 +1680,7 @@ renderTable(struct table *t, int max_width, struct html_feed_environ *h_env)
#endif /* MATRIX */ #endif /* MATRIX */
int width; int width;
int rulewidth; int rulewidth;
Str vrulea, vruleb, vrulec; Str vrulea = NULL, vruleb = NULL, vrulec = NULL;
#ifdef ID_EXT #ifdef ID_EXT
Str idtag; Str idtag;
#endif /* ID_EXT */ #endif /* ID_EXT */
+2 -2
View File
@@ -1,4 +1,4 @@
/* $Id: terms.c,v 1.16 2001/11/24 02:01:26 ukai Exp $ */ /* $Id: terms.c,v 1.17 2001/11/29 09:34:15 ukai Exp $ */
/* /*
* An original curses library for EUC-kanji by Akinori ITO, December 1989 * An original curses library for EUC-kanji by Akinori ITO, December 1989
* revised by Akinori ITO, January 1995 * revised by Akinori ITO, January 1995
@@ -842,7 +842,7 @@ switch_wchar(FILE * f)
void void
putchars(unsigned char c1, unsigned char c2, FILE * f) putchars(unsigned char c1, unsigned char c2, FILE * f)
{ {
Str s; Str s = NULL;
char *p; char *p;
switch (DisplayCode) { switch (DisplayCode) {
+7 -7
View File
@@ -1,4 +1,4 @@
/* $Id: url.c,v 1.11 2001/11/27 17:00:18 ukai Exp $ */ /* $Id: url.c,v 1.12 2001/11/29 09:34:15 ukai Exp $ */
#include "fm.h" #include "fm.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
@@ -349,10 +349,10 @@ baseURL(Buffer *buf)
} }
int int
openSocket(char *hostname, openSocket(char *volatile hostname,
char *remoteport_name, unsigned short remoteport_num) char *remoteport_name, unsigned short remoteport_num)
{ {
int sock = -1; volatile int sock = -1;
#ifdef INET6 #ifdef INET6
int *af; int *af;
struct addrinfo hints, *res0, *res; struct addrinfo hints, *res0, *res;
@@ -365,7 +365,7 @@ openSocket(char *hostname,
int a1, a2, a3, a4; int a1, a2, a3, a4;
unsigned long adr; unsigned long adr;
#endif /* not INET6 */ #endif /* not INET6 */
MySignalHandler(*trap) (); MySignalHandler(*volatile trap) (SIGNAL_ARG) = NULL;
if (fmInitialized) { if (fmInitialized) {
message(Sprintf("Opening socket...")->ptr, 0, 0); message(Sprintf("Opening socket...")->ptr, 0, 0);
@@ -481,7 +481,7 @@ openSocket(char *hostname,
} }
else { else {
char **h_addr_list; char **h_addr_list;
int result; int result = -1;
if (fmInitialized) { if (fmInitialized) {
message(Sprintf("Performing hostname lookup on %s", hostname)->ptr, message(Sprintf("Performing hostname lookup on %s", hostname)->ptr,
0, 0); 0, 0);
@@ -1123,7 +1123,7 @@ otherinfo(ParsedURL *target, ParsedURL *current, char *referer)
Strcat_charp(s, "User-Agent: "); Strcat_charp(s, "User-Agent: ");
if (UserAgent == NULL || *UserAgent == '\0') if (UserAgent == NULL || *UserAgent == '\0')
Strcat_charp(s, version); Strcat_charp(s, w3m_version);
else else
Strcat_charp(s, UserAgent); Strcat_charp(s, UserAgent);
Strcat_charp(s, "\r\n"); Strcat_charp(s, "\r\n");
@@ -1289,7 +1289,7 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current,
URLFile uf; URLFile uf;
HRequest hr; HRequest hr;
#ifdef USE_SSL #ifdef USE_SSL
SSL *sslh; SSL *sslh = NULL;
#endif /* USE_SSL */ #endif /* USE_SSL */
#ifdef USE_NNTP #ifdef USE_NNTP
FILE *fw; FILE *fw;
+2 -2
View File
@@ -1,6 +1,6 @@
/* $Id: version.c,v 1.5 2001/11/20 17:49:23 ukai Exp $ */ /* $Id: version.c,v 1.6 2001/11/29 09:34:15 ukai Exp $ */
#define CURRENT_VERSION "w3m/0.2.2" #define CURRENT_VERSION "w3m/0.2.2"
#ifndef FM_H #ifndef FM_H
char *version = CURRENT_VERSION; char *w3m_version = CURRENT_VERSION;
#endif /* not FM_H */ #endif /* not FM_H */