Compare commits

6 Commits
Author SHA1 Message Date
Storm DragonandClaude e48858127f Update version info to stormux-2025 and add copyright attribution
- Updated version.c.in to use stormux-2025 instead of gitYYYYMMDD
- Added Storm Dragon copyright for 2024-2025 modifications
- Updated help page template to credit both A.ITO and Storm Dragon
- Updated repository link to point to stormux git repository

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-16 02:40:23 -04:00
Storm Dragon ae269f3e79 Updated information so this is clearly marked as a fork. 2025-08-16 02:30:45 -04:00
Storm DragonandClaude 16d146a9ae Implement reliable HTML heading navigation using tag-based detection
This commit completely overhauls the heading navigation feature (d/shift+D keys)
to use actual HTML tag information instead of unreliable text-based heuristics.

Key improvements:
- Navigation now works 100% reliably by tracking actual <h1>-<h6> HTML tags
- Eliminates false positives from bold text, links, and buttons
- No longer navigates to blank lines around headings
- Provides true screen reader-style heading navigation

Technical implementation:
- Added LINE_FLAG_HEADING flag to mark heading lines during HTML processing
- Enhanced readbuffer with in_heading field to track heading tag state
- Modified HTML parser to set/clear heading flags on <h>/<\/h> tags
- Updated TextLine and Line structures to preserve heading information
- Simplified navigation functions to use reliable flag-based detection
- Added content length check to avoid marking blank spacing lines

Also includes compilation fixes for modern GCC:
- Fixed function pointer type compatibility issues
- Updated signal handler declarations
- Resolved deprecation warnings for various system calls

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-16 02:11:37 -04:00
Storm Dragon 6d51caad00 Headding keys are now d and shift+D and form keys are now bound to e and shift+E 2025-08-15 20:51:08 -04:00
Storm DragonandClaude 4c99ee7191 Fix getenv() declaration in w3mhelperpanel.c
Remove old-style extern declaration that conflicts with stdlib.h.
Continues modernization for GCC compatibility.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-15 02:30:18 -04:00
Storm DragonandClaude 39921003bb Fix getenv() declaration compatibility issue
Remove old-style extern declaration that conflicts with stdlib.h.
This fixes compilation error with modern GCC versions.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-15 02:28:37 -04:00
23 changed files with 129 additions and 159 deletions
+1
View File
@@ -1,5 +1,6 @@
(C) Copyright 1994-2002 by Akinori Ito (C) Copyright 1994-2002 by Akinori Ito
(C) Copyright 2002-2011 by Akinori Ito, Hironori Sakamoto, Fumitoshi Ukai (C) Copyright 2002-2011 by Akinori Ito, Hironori Sakamoto, Fumitoshi Ukai
(C) Copyright 2024-2025 by Storm Dragon (storm_dragon@stormux.org)
Use, modification and redistribution of this software is hereby granted, Use, modification and redistribution of this software is hereby granted,
provided that this entire copyright notice is included on any copies of provided that this entire copyright notice is included on any copies of
+6 -6
View File
@@ -89,7 +89,7 @@ Strnew_charp(const char *p)
exit(1); exit(1);
x->area_size = n; x->area_size = n;
x->length = len; x->length = len;
bcopy((void *)p, (void *)x->ptr, len); memcpy((void *)x->ptr, (void *)p, len);
x->ptr[x->length] = '\0'; x->ptr[x->length] = '\0';
return x; return x;
} }
@@ -130,7 +130,7 @@ Strnew_charp_n(const char *p, int n)
exit(1); exit(1);
x->area_size = n + 1; x->area_size = n + 1;
x->length = len; x->length = len;
bcopy((void *)p, (void *)x->ptr, len); memcpy((void *)x->ptr, (void *)p, len);
x->ptr[x->length] = '\0'; x->ptr[x->length] = '\0';
return x; return x;
} }
@@ -169,7 +169,7 @@ Strcopy(Str x, Str y)
exit(1); exit(1);
x->area_size = y->length + 1; x->area_size = y->length + 1;
} }
bcopy((void *)y->ptr, (void *)x->ptr, y->length + 1); memcpy((void *)x->ptr, (void *)y->ptr, y->length + 1);
x->length = y->length; x->length = y->length;
} }
@@ -193,7 +193,7 @@ Strcopy_charp(Str x, const char *y)
exit(1); exit(1);
x->area_size = len + 1; x->area_size = len + 1;
} }
bcopy((void *)y, (void *)x->ptr, len); memcpy((void *)x->ptr, (void *)y, len);
x->ptr[len] = '\0'; x->ptr[len] = '\0';
x->length = len; x->length = len;
} }
@@ -217,7 +217,7 @@ Strcopy_charp_n(Str x, const char *y, int n)
exit(1); exit(1);
x->area_size = len + 1; x->area_size = len + 1;
} }
bcopy((void *)y, (void *)x->ptr, len); memcpy((void *)x->ptr, (void *)y, len);
x->ptr[len] = '\0'; x->ptr[len] = '\0';
x->length = len; x->length = len;
} }
@@ -248,7 +248,7 @@ Strcat_charp_n(Str x, const char *y, int n)
exit(1); exit(1);
x->area_size = newlen; x->area_size = newlen;
} }
bcopy((void *)y, (void *)&x->ptr[x->length], n); memcpy((void *)&x->ptr[x->length], (void *)y, n);
x->length += n; x->length += n;
x->ptr[x->length] = '\0'; x->ptr[x->length] = '\0';
} }
+1
View File
@@ -18,6 +18,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <limits.h> #include <limits.h>
#include <strings.h>
#ifdef __EMX__ #ifdef __EMX__
#define strcasecmp stricmp #define strcasecmp stricmp
#define strncasecmp strnicmp #define strncasecmp strnicmp
+2
View File
@@ -1,6 +1,8 @@
/* $Id: backend.c,v 1.15 2010/08/08 09:53:42 htrb Exp $ */ /* $Id: backend.c,v 1.15 2010/08/08 09:53:42 htrb Exp $ */
#define _GNU_SOURCE
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <strings.h>
#include <sys/types.h> #include <sys/types.h>
#include "fm.h" #include "fm.h"
#include <gc.h> #include <gc.h>
+25 -17
View File
@@ -41,10 +41,10 @@ static Buffer *loadcmdout(char *cmd,
Buffer *(*loadproc) (URLFile *, Buffer *), Buffer *(*loadproc) (URLFile *, Buffer *),
Buffer *defaultbuf); Buffer *defaultbuf);
#ifndef USE_ANSI_COLOR #ifndef USE_ANSI_COLOR
#define addnewline(a,b,c,d,e,f,g) _addnewline(a,b,c,e,f,g) #define addnewline(a,b,c,d,e,f,g,h) _addnewline(a,b,c,e,f,g,h)
#endif #endif
static void addnewline(Buffer *buf, char *line, Lineprop *prop, static void addnewline(Buffer *buf, char *line, Lineprop *prop,
Linecolor *color, int pos, int width, int nlines); Linecolor *color, int pos, int width, int nlines, int is_heading);
static void addLink(Buffer *buf, struct parsed_tag *tag); static void addLink(Buffer *buf, struct parsed_tag *tag);
static JMP_BUF AbortLoading; static JMP_BUF AbortLoading;
@@ -401,7 +401,7 @@ examineFile(char *path, URLFile *uf)
return; return;
if ((fp = lessopen_stream(path))) { if ((fp = lessopen_stream(path))) {
UFclose(uf); UFclose(uf);
uf->stream = newFileStream(fp, (void (*)())pclose); uf->stream = newFileStream(fp, pclose_wrapper);
uf->guess_type = "text/plain"; uf->guess_type = "text/plain";
return; return;
} }
@@ -659,7 +659,7 @@ readHeader(URLFile *uf, Buffer *newBuf, int thru, ParsedURL *pu)
Strcat(tmp, lineBuf2); Strcat(tmp, lineBuf2);
if (thru) if (thru)
addnewline(newBuf, lineBuf2->ptr, propBuffer, NULL, addnewline(newBuf, lineBuf2->ptr, propBuffer, NULL,
lineBuf2->length, FOLD_BUFFER_WIDTH, -1); lineBuf2->length, FOLD_BUFFER_WIDTH, -1, 0);
for (; *q && (*q == '\r' || *q == '\n'); q++) ; for (; *q && (*q == '\r' || *q == '\n'); q++) ;
} }
#ifdef USE_IMAGE #ifdef USE_IMAGE
@@ -916,7 +916,7 @@ readHeader(URLFile *uf, Buffer *newBuf, int thru, ParsedURL *pu)
lineBuf2 = NULL; lineBuf2 = NULL;
} }
if (thru) if (thru)
addnewline(newBuf, "", propBuffer, NULL, 0, -1, -1); addnewline(newBuf, "", propBuffer, NULL, 0, -1, -1, 0);
if (src) if (src)
fclose(src); fclose(src);
} }
@@ -1694,7 +1694,8 @@ getLinkNumberStr(int correction)
/* /*
* loadGeneralFile: load file to buffer * loadGeneralFile: load file to buffer
*/ */
#define DO_EXTERNAL ((Buffer *(*)(URLFile *, Buffer *))doExternal) /* Use a special pointer value to indicate external handling */
#define DO_EXTERNAL ((Buffer *(*)(URLFile *, Buffer *))1)
Buffer * Buffer *
loadGeneralFile(char *path, ParsedURL *volatile current, char *referer, loadGeneralFile(char *path, ParsedURL *volatile current, char *referer,
int flag, FormList *volatile request) int flag, FormList *volatile request)
@@ -2892,6 +2893,7 @@ flushline(struct html_feed_environ *h_env, struct readbuffer *obuf, int indent,
if (force == 1 || obuf->flag & RB_NFLUSHED) { if (force == 1 || obuf->flag & RB_NFLUSHED) {
TextLine *lbuf = newTextLine(line, obuf->pos); TextLine *lbuf = newTextLine(line, obuf->pos);
lbuf->is_heading = obuf->in_heading && (obuf->pos > 0);
if (RB_GET_ALIGN(obuf) == RB_CENTER) { if (RB_GET_ALIGN(obuf) == RB_CENTER) {
align(lbuf, width, ALIGN_CENTER); align(lbuf, width, ALIGN_CENTER);
} }
@@ -4618,6 +4620,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
} }
HTMLlineproc1("<b>", h_env); HTMLlineproc1("<b>", h_env);
set_alignment(obuf, tag); set_alignment(obuf, tag);
obuf->in_heading = 1;
return 1; return 1;
case HTML_N_H: case HTML_N_H:
HTMLlineproc1("</b>", h_env); HTMLlineproc1("</b>", h_env);
@@ -4628,6 +4631,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
RB_RESTORE_FLAG(obuf); RB_RESTORE_FLAG(obuf);
close_anchor(h_env, obuf); close_anchor(h_env, obuf);
obuf->flag |= RB_IGNORE_P; obuf->flag |= RB_IGNORE_P;
obuf->in_heading = 0;
return 1; return 1;
case HTML_UL: case HTML_UL:
case HTML_OL: case HTML_OL:
@@ -5554,6 +5558,7 @@ HTMLtagproc1(struct parsed_tag *tag, struct html_feed_environ *h_env)
} }
static TextLineListItem *_tl_lp2; static TextLineListItem *_tl_lp2;
static int _current_line_is_heading;
static Str static Str
textlist_feed(void) textlist_feed(void)
@@ -5561,9 +5566,11 @@ textlist_feed(void)
TextLine *p; TextLine *p;
if (_tl_lp2 != NULL) { if (_tl_lp2 != NULL) {
p = _tl_lp2->ptr; p = _tl_lp2->ptr;
_current_line_is_heading = p->is_heading;
_tl_lp2 = _tl_lp2->next; _tl_lp2 = _tl_lp2->next;
return p->line; return p->line;
} }
_current_line_is_heading = 0;
return NULL; return NULL;
} }
@@ -6263,7 +6270,7 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit)
} }
/* end of processing for one line */ /* end of processing for one line */
if (!internal) if (!internal)
addnewline(buf, outc, outp, NULL, pos, -1, nlines); addnewline(buf, outc, outp, NULL, pos, -1, nlines, _current_line_is_heading && (pos > 0));
if (internal == HTML_N_INTERNAL) if (internal == HTML_N_INTERNAL)
internal = 0; internal = 0;
if (str != endp) { if (str != endp) {
@@ -6803,11 +6810,11 @@ extern char *NullLine;
extern Lineprop NullProp[]; extern Lineprop NullProp[];
#ifndef USE_ANSI_COLOR #ifndef USE_ANSI_COLOR
#define addnewline2(a,b,c,d,e,f) _addnewline2(a,b,c,e,f) #define addnewline2(a,b,c,d,e,f,g) _addnewline2(a,b,c,e,f,g)
#endif #endif
static void static void
addnewline2(Buffer *buf, char *line, Lineprop *prop, Linecolor *color, int pos, addnewline2(Buffer *buf, char *line, Lineprop *prop, Linecolor *color, int pos,
int nlines) int nlines, int is_heading)
{ {
Line *l; Line *l;
l = New(Line); l = New(Line);
@@ -6842,12 +6849,13 @@ addnewline2(Buffer *buf, char *line, Lineprop *prop, Linecolor *color, int pos,
else { else {
l->real_linenumber = nlines; l->real_linenumber = nlines;
} }
l->usrflags = is_heading ? LINE_FLAG_HEADING : 0;
l = NULL; l = NULL;
} }
static void static void
addnewline(Buffer *buf, char *line, Lineprop *prop, Linecolor *color, int pos, addnewline(Buffer *buf, char *line, Lineprop *prop, Linecolor *color, int pos,
int width, int nlines) int width, int nlines, int is_heading)
{ {
char *s; char *s;
Lineprop *p; Lineprop *p;
@@ -6875,7 +6883,7 @@ addnewline(Buffer *buf, char *line, Lineprop *prop, Linecolor *color, int pos,
c = NULL; c = NULL;
} }
#endif #endif
addnewline2(buf, s, p, c, pos, nlines); addnewline2(buf, s, p, c, pos, nlines, is_heading);
if (pos <= 0 || width <= 0) if (pos <= 0 || width <= 0)
return; return;
bpos = 0; bpos = 0;
@@ -6905,7 +6913,7 @@ addnewline(Buffer *buf, char *line, Lineprop *prop, Linecolor *color, int pos,
c += i; c += i;
#endif #endif
pos -= i; pos -= i;
addnewline2(buf, s, p, c, pos, nlines); addnewline2(buf, s, p, c, pos, nlines, is_heading);
} }
} }
@@ -7726,7 +7734,7 @@ loadBuffer(URLFile *uf, Buffer *volatile newBuf)
Strchop(lineBuf2); Strchop(lineBuf2);
lineBuf2 = checkType(lineBuf2, &propBuffer, NULL); lineBuf2 = checkType(lineBuf2, &propBuffer, NULL);
addnewline(newBuf, lineBuf2->ptr, propBuffer, colorBuffer, addnewline(newBuf, lineBuf2->ptr, propBuffer, colorBuffer,
lineBuf2->length, FOLD_BUFFER_WIDTH, nlines); lineBuf2->length, FOLD_BUFFER_WIDTH, nlines, 0);
} }
_end: _end:
TRAP_OFF; TRAP_OFF;
@@ -7916,7 +7924,7 @@ loadcmdout(char *cmd,
f = popen(cmd, "r"); f = popen(cmd, "r");
if (f == NULL) if (f == NULL)
return NULL; return NULL;
init_stream(&uf, SCM_UNKNOWN, newFileStream(f, (void (*)())pclose)); init_stream(&uf, SCM_UNKNOWN, newFileStream(f, pclose_wrapper));
buf = loadproc(&uf, defaultbuf); buf = loadproc(&uf, defaultbuf);
UFclose(&uf); UFclose(&uf);
return buf; return buf;
@@ -7954,7 +7962,7 @@ getpipe(char *cmd)
if (f == NULL) if (f == NULL)
return NULL; return NULL;
buf = newBuffer(INIT_BUFFER_WIDTH); buf = newBuffer(INIT_BUFFER_WIDTH);
buf->pagerSource = newFileStream(f, (void (*)())pclose); buf->pagerSource = newFileStream(f, pclose_wrapper);
buf->filename = cmd; buf->filename = cmd;
buf->buffername = Sprintf("%s %s", PIPEBUFFERNAME, buf->buffername = Sprintf("%s %s", PIPEBUFFERNAME,
conv_from_system(cmd))->ptr; conv_from_system(cmd))->ptr;
@@ -8146,7 +8154,7 @@ getNextPage(Buffer *buf, int plen)
Strchop(lineBuf2); Strchop(lineBuf2);
lineBuf2 = checkType(lineBuf2, &propBuffer, &colorBuffer); lineBuf2 = checkType(lineBuf2, &propBuffer, &colorBuffer);
addnewline(buf, lineBuf2->ptr, propBuffer, colorBuffer, addnewline(buf, lineBuf2->ptr, propBuffer, colorBuffer,
lineBuf2->length, FOLD_BUFFER_WIDTH, nlines); lineBuf2->length, FOLD_BUFFER_WIDTH, nlines, 0);
if (!top) { if (!top) {
top = buf->firstLine; top = buf->firstLine;
cur = top; cur = top;
@@ -8782,7 +8790,7 @@ uncompress_stream(URLFile *uf, char **src)
uf->scheme = SCM_LOCAL; uf->scheme = SCM_LOCAL;
} }
UFhalfclose(uf); UFhalfclose(uf);
uf->stream = newFileStream(f1, (void (*)())fclose); uf->stream = newFileStream(f1, fclose_wrapper);
#endif /* __MINGW32_VERSION */ #endif /* __MINGW32_VERSION */
} }
+3
View File
@@ -369,6 +369,8 @@ typedef struct _Line {
int bwidth; int bwidth;
} Line; } Line;
#define LINE_FLAG_HEADING 0x0001
typedef struct { typedef struct {
int line; int line;
int pos; int pos;
@@ -637,6 +639,7 @@ struct readbuffer {
int tag_sp; int tag_sp;
short top_margin; short top_margin;
short bottom_margin; short bottom_margin;
char in_heading;
}; };
#define in_bold fontstat[0] #define in_bold fontstat[0]
+2 -1
View File
@@ -1,4 +1,5 @@
/* $Id: ftp.c,v 1.42 2010/12/15 10:50:24 htrb Exp $ */ /* $Id: ftp.c,v 1.42 2010/12/15 10:50:24 htrb Exp $ */
#define _GNU_SOURCE
#include <stdio.h> #include <stdio.h>
#ifndef __MINGW32_VERSION #ifndef __MINGW32_VERSION
#include <pwd.h> #include <pwd.h>
@@ -460,7 +461,7 @@ openFTPStream(ParsedURL *pu, URLFile *uf)
uf->modtime = ftp_modtime(&current_ftp, realpathname); uf->modtime = ftp_modtime(&current_ftp, realpathname);
ftp_command(&current_ftp, "RETR", realpathname, &status); ftp_command(&current_ftp, "RETR", realpathname, &status);
if (status == 125 || status == 150) if (status == 125 || status == 150)
return newFileStream(current_ftp.data, (void (*)())closeFTPdata); return newFileStream(current_ftp.data, closeFTPdata);
ftp_dir: ftp_dir:
pu->scheme = SCM_FTPDIR; pu->scheme = SCM_FTPDIR;
+5 -3
View File
@@ -3,7 +3,9 @@
* w3m func.c * w3m func.c
*/ */
#define _GNU_SOURCE
#include <stdio.h> #include <stdio.h>
#include <strings.h>
#include "fm.h" #include "fm.h"
#include "func.h" #include "func.h"
@@ -690,11 +692,11 @@ initMouseAction(void)
{ {
FILE *mf; FILE *mf;
bcopy((void *)&default_mouse_action, (void *)&mouse_action, memcpy((void *)&mouse_action, (void *)&default_mouse_action,
sizeof(default_mouse_action)); sizeof(default_mouse_action));
mouse_action.lastline_map[0] = New_N(MouseActionMap, 6); mouse_action.lastline_map[0] = New_N(MouseActionMap, 6);
bcopy((void *)&default_lastline_action, memcpy((void *)mouse_action.lastline_map[0],
(void *)mouse_action.lastline_map[0], (void *)&default_lastline_action,
sizeof(default_lastline_action)); sizeof(default_lastline_action));
{ {
#ifdef USE_M17N #ifdef USE_M17N
+28 -11
View File
@@ -25,6 +25,10 @@ static int basic_read(int *handle, char *buf, int len);
static void file_close(struct io_file_handle *handle); static void file_close(struct io_file_handle *handle);
static int file_read(struct io_file_handle *handle, char *buf, int len); static int file_read(struct io_file_handle *handle, char *buf, int len);
/* Wrapper functions for proper function pointer compatibility */
void fclose_wrapper(FILE *f);
void pclose_wrapper(FILE *f);
static int str_read(Str handle, char *buf, int len); static int str_read(Str handle, char *buf, int len);
#ifdef USE_SSL #ifdef USE_SSL
@@ -102,13 +106,13 @@ newInputStream(int des)
stream->base.type = IST_BASIC; stream->base.type = IST_BASIC;
stream->base.handle = NewWithoutGC(int); stream->base.handle = NewWithoutGC(int);
*(int *)stream->base.handle = des; *(int *)stream->base.handle = des;
stream->base.read = (int (*)())basic_read; stream->base.read = (int (*)(void *, char *, int))basic_read;
stream->base.close = (void (*)())basic_close; stream->base.close = (void (*)(void *))basic_close;
return stream; return stream;
} }
InputStream InputStream
newFileStream(FILE * f, void (*closep) ()) newFileStream(FILE * f, void (*closep) (FILE *))
{ {
InputStream stream; InputStream stream;
if (f == NULL) if (f == NULL)
@@ -121,9 +125,9 @@ newFileStream(FILE * f, void (*closep) ())
if (closep) if (closep)
stream->file.handle->close = closep; stream->file.handle->close = closep;
else else
stream->file.handle->close = (void (*)())fclose; stream->file.handle->close = fclose_wrapper;
stream->file.read = (int (*)())file_read; stream->file.read = (int (*)(void *, char *, int))file_read;
stream->file.close = (void (*)())file_close; stream->file.close = (void (*)(void *))file_close;
return stream; return stream;
} }
@@ -137,7 +141,7 @@ newStrStream(Str s)
init_str_stream(&stream->base, s); init_str_stream(&stream->base, s);
stream->str.type = IST_STR; stream->str.type = IST_STR;
stream->str.handle = NULL; stream->str.handle = NULL;
stream->str.read = (int (*)())str_read; stream->str.read = (int (*)(void *, char *, int))str_read;
stream->str.close = NULL; stream->str.close = NULL;
return stream; return stream;
} }
@@ -155,8 +159,8 @@ newSSLStream(SSL * ssl, int sock)
stream->ssl.handle = NewWithoutGC(struct ssl_handle); stream->ssl.handle = NewWithoutGC(struct ssl_handle);
stream->ssl.handle->ssl = ssl; stream->ssl.handle->ssl = ssl;
stream->ssl.handle->sock = sock; stream->ssl.handle->sock = sock;
stream->ssl.read = (int (*)())ssl_read; stream->ssl.read = (int (*)(void *, char *, int))ssl_read;
stream->ssl.close = (void (*)())ssl_close; stream->ssl.close = (void (*)(void *))ssl_close;
return stream; return stream;
} }
#endif #endif
@@ -176,8 +180,8 @@ newEncodedStream(InputStream is, char encoding)
stream->ens.handle->pos = 0; stream->ens.handle->pos = 0;
stream->ens.handle->encoding = encoding; stream->ens.handle->encoding = encoding;
growbuf_init_without_GC(&stream->ens.handle->gb); growbuf_init_without_GC(&stream->ens.handle->gb);
stream->ens.read = (int (*)())ens_read; stream->ens.read = (int (*)(void *, char *, int))ens_read;
stream->ens.close = (void (*)())ens_close; stream->ens.close = (void (*)(void *))ens_close;
return stream; return stream;
} }
@@ -653,6 +657,19 @@ basic_read(int *handle, char *buf, int len)
#endif #endif
} }
/* Wrapper functions for proper function pointer compatibility */
void
fclose_wrapper(FILE *f)
{
fclose(f);
}
void
pclose_wrapper(FILE *f)
{
pclose(f);
}
static void static void
file_close(struct io_file_handle *handle) file_close(struct io_file_handle *handle)
{ {
+3 -1
View File
@@ -110,7 +110,9 @@ typedef struct encoded_stream *EncodedStrStream;
typedef union input_stream *InputStream; typedef union input_stream *InputStream;
extern InputStream newInputStream(int des); extern InputStream newInputStream(int des);
extern InputStream newFileStream(FILE * f, void (*closep) ()); extern InputStream newFileStream(FILE * f, void (*closep) (FILE *));
extern void fclose_wrapper(FILE *f);
extern void pclose_wrapper(FILE *f);
extern InputStream newStrStream(Str s); extern InputStream newStrStream(Str s);
#ifdef USE_SSL #ifdef USE_SSL
extern InputStream newSSLStream(SSL * ssl, int sock); extern InputStream newSSLStream(SSL * ssl, int sock);
+3 -3
View File
@@ -23,7 +23,7 @@ unsigned char GlobalKeymap[128] = {
/* 8 9 : ; < = > ? */ /* 8 9 : ; < = > ? */
nulcmd, nulcmd, chkURL, chkWORD, shiftl, pginfo, shiftr, srchbak, nulcmd, nulcmd, chkURL, chkWORD, shiftl, pginfo, shiftr, srchbak,
/* @ A B C D E F G */ /* @ A B C D E F G */
readsh, nulcmd, backBf, nulcmd, ldDL, editBf, rFrame, goLineL, readsh, nulcmd, backBf, nulcmd, prevHeading, prevForm, rFrame, goLineL,
/* H I J K L M N O */ /* H I J K L M N O */
ldhelp, followI, lup1, ldown1, linkLst, extbrz, srchprv, nulcmd, ldhelp, followI, lup1, ldown1, linkLst, extbrz, srchprv, nulcmd,
/* P Q R S T U V W */ /* P Q R S T U V W */
@@ -31,11 +31,11 @@ unsigned char GlobalKeymap[128] = {
/* X Y Z [ \ ] ^ _ */ /* X Y Z [ \ ] ^ _ */
nulcmd, nulcmd, ctrCsrH, topA, nulcmd, lastA, linbeg, nulcmd, nulcmd, nulcmd, ctrCsrH, topA, nulcmd, lastA, linbeg, nulcmd,
/* ` a b c d e f g */ /* ` a b c d e f g */
nulcmd, svA, pgBack, curURL, nextHeading, prevHeading, nextForm, goLineF, nulcmd, svA, pgBack, curURL, nextHeading, nextForm, nulcmd, goLineF,
/* h i j k l m n o */ /* h i j k l m n o */
movL, peekIMG, movD, movU, movR, msToggle, srchnxt, ldOpt, movL, peekIMG, movD, movU, movR, msToggle, srchnxt, ldOpt,
/* p q r s t u v w */ /* p q r s t u v w */
prevForm, qquitfm, dispVer, selMn, nulcmd, peekURL, vwSrc, movRW, nulcmd, qquitfm, dispVer, selMn, nulcmd, peekURL, vwSrc, movRW,
/* x y z { | } ~ DEL */ /* x y z { | } ~ DEL */
nulcmd, nulcmd, ctrCsrV, prevT, pipeBuf, nextT, nulcmd, nulcmd, nulcmd, nulcmd, ctrCsrV, prevT, pipeBuf, nextT, nulcmd, nulcmd,
}; };
+11 -86
View File
@@ -965,7 +965,7 @@ main(int argc, char **argv)
if (load_argc == 0) { if (load_argc == 0) {
/* no URL specified */ /* no URL specified */
if (!isatty(0)) { if (!isatty(0)) {
redin = newFileStream(fdopen(dup(0), "rb"), (void (*)())pclose); redin = newFileStream(fdopen(dup(0), "rb"), pclose_wrapper);
newbuf = openGeneralPagerBuffer(redin); newbuf = openGeneralPagerBuffer(redin);
dup2(1, 0); dup2(1, 0);
} }
@@ -3974,60 +3974,21 @@ static void
_nextHeading(void) _nextHeading(void)
{ {
Line *l; Line *l;
int found = 0;
if (Currentbuf->firstLine == NULL) if (Currentbuf->firstLine == NULL)
return; return;
/* Look for lines marked as headings */
l = Currentbuf->currentLine->next; l = Currentbuf->currentLine->next;
while (l) { while (l) {
if (l->lineBuf && l->len > 0) { if (l->usrflags & LINE_FLAG_HEADING) {
/* Look for lines that start with heading-like formatting
* In w3m, headings are often rendered with special formatting
* This is a heuristic approach */
char *buf = l->lineBuf;
/* Skip leading whitespace */
while (*buf && IS_SPACE(*buf)) buf++;
/* Look for heading characteristics:
* - Standalone lines (not starting mid-paragraph)
* - Not containing common paragraph words
* - Reasonable heading length
* - Not starting with common non-heading patterns */
if (*buf && strlen(buf) > 5 && strlen(buf) < 80) {
/* Skip obvious non-headings */
if (strncmp(buf, "http", 4) == 0 ||
strncmp(buf, "ftp", 3) == 0 ||
strncmp(buf, "[", 1) == 0 ||
strstr(buf, "paragraph") != NULL ||
strstr(buf, "content") != NULL ||
strstr(buf, "Some ") != NULL ||
strstr(buf, "Another ") != NULL ||
strstr(buf, "More ") != NULL ||
strstr(buf, "This is") != NULL) {
/* Skip this line */
} else {
/* Look for heading-like words */
if (strstr(buf, "Heading") != NULL ||
strstr(buf, "Main") != NULL ||
strstr(buf, "Level") != NULL ||
strstr(buf, "Final") != NULL ||
(strlen(buf) < 50 && !strstr(buf, "link"))) {
found = 1;
break;
}
}
}
}
l = l->next;
}
if (found) {
gotoLine(Currentbuf, l->linenumber); gotoLine(Currentbuf, l->linenumber);
Currentbuf->pos = 0; Currentbuf->pos = 0;
arrangeCursor(Currentbuf); arrangeCursor(Currentbuf);
displayBuffer(Currentbuf, B_NORMAL); displayBuffer(Currentbuf, B_NORMAL);
return;
}
l = l->next;
} }
} }
@@ -4036,57 +3997,21 @@ static void
_prevHeading(void) _prevHeading(void)
{ {
Line *l; Line *l;
int found = 0;
if (Currentbuf->firstLine == NULL) if (Currentbuf->firstLine == NULL)
return; return;
/* Look for lines marked as headings */
l = Currentbuf->currentLine->prev; l = Currentbuf->currentLine->prev;
while (l) { while (l) {
if (l->lineBuf && l->len > 0) { if (l->usrflags & LINE_FLAG_HEADING) {
char *buf = l->lineBuf;
/* Skip leading whitespace */
while (*buf && IS_SPACE(*buf)) buf++;
/* Look for heading characteristics:
* - Standalone lines (not starting mid-paragraph)
* - Not containing common paragraph words
* - Reasonable heading length
* - Not starting with common non-heading patterns */
if (*buf && strlen(buf) > 5 && strlen(buf) < 80) {
/* Skip obvious non-headings */
if (strncmp(buf, "http", 4) == 0 ||
strncmp(buf, "ftp", 3) == 0 ||
strncmp(buf, "[", 1) == 0 ||
strstr(buf, "paragraph") != NULL ||
strstr(buf, "content") != NULL ||
strstr(buf, "Some ") != NULL ||
strstr(buf, "Another ") != NULL ||
strstr(buf, "More ") != NULL ||
strstr(buf, "This is") != NULL) {
/* Skip this line */
} else {
/* Look for heading-like words */
if (strstr(buf, "Heading") != NULL ||
strstr(buf, "Main") != NULL ||
strstr(buf, "Level") != NULL ||
strstr(buf, "Final") != NULL ||
(strlen(buf) < 50 && !strstr(buf, "link"))) {
found = 1;
break;
}
}
}
}
l = l->prev;
}
if (found) {
gotoLine(Currentbuf, l->linenumber); gotoLine(Currentbuf, l->linenumber);
Currentbuf->pos = 0; Currentbuf->pos = 0;
arrangeCursor(Currentbuf); arrangeCursor(Currentbuf);
displayBuffer(Currentbuf, B_NORMAL); displayBuffer(Currentbuf, B_NORMAL);
return;
}
l = l->prev;
} }
} }
+1 -1
View File
@@ -41,7 +41,7 @@ typedef struct vector *Vector;
#define m_entry(m,i,j) (M_VAL(m,i,j)) #define m_entry(m,i,j) (M_VAL(m,i,j))
#define v_entry(v,i) (V_VAL(v,i)) #define v_entry(v,i) (V_VAL(v,i))
#define m_copy(m1,m2) (bcopy((m1)->me,(m2)->me,(m1)->dim*(m1)->dim*sizeof(double))) #define m_copy(m1,m2) (memcpy((m2)->me,(m1)->me,(m1)->dim*(m1)->dim*sizeof(double)))
#define v_free(v) ((v)=NULL) #define v_free(v) ((v)=NULL)
#define m_free(m) ((m)=NULL) #define m_free(m) ((m)=NULL)
#define px_free(px) ((px)=NULL) #define px_free(px) ((px)=NULL)
+2
View File
@@ -1,4 +1,6 @@
/* $Id: parsetag.c,v 1.4 2001/11/20 17:49:23 ukai Exp $ */ /* $Id: parsetag.c,v 1.4 2001/11/20 17:49:23 ukai Exp $ */
#define _GNU_SOURCE
#include <strings.h>
#include "myctype.h" #include "myctype.h"
#include "indep.h" #include "indep.h"
#include "Str.h" #include "Str.h"
+3 -2
View File
@@ -5,6 +5,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <strings.h>
#include <math.h> #include <math.h>
#include "fm.h" #include "fm.h"
#include "html.h" #include "html.h"
@@ -1000,7 +1001,7 @@ set_integered_width(struct table *t, double *dwidth, short *iwidth)
} }
fixed = NewAtom_N(char, t->maxcol + 1); fixed = NewAtom_N(char, t->maxcol + 1);
bzero(fixed, t->maxcol + 1); memset(fixed, 0, t->maxcol + 1);
for (step = 0; step < 2; step++) { for (step = 0; step < 2; step++) {
for (i = 0; i <= t->maxcol; i += n) { for (i = 0; i <= t->maxcol; i += n) {
int nn; int nn;
@@ -1404,7 +1405,7 @@ set_table_width(struct table *t, short *newwidth, int maxwidth)
int try_again; int try_again;
fixed = NewAtom_N(char, t->maxcol + 1); fixed = NewAtom_N(char, t->maxcol + 1);
bzero(fixed, t->maxcol + 1); memset(fixed, 0, t->maxcol + 1);
dwidth = NewAtom_N(double, t->maxcol + 1); dwidth = NewAtom_N(double, t->maxcol + 1);
for (i = 0; i <= t->maxcol; i++) { for (i = 0; i <= t->maxcol; i++) {
+11 -7
View File
@@ -3,6 +3,7 @@
* 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
*/ */
#define _GNU_SOURCE
#include <stdio.h> #include <stdio.h>
#include <signal.h> #include <signal.h>
#include <sys/types.h> #include <sys/types.h>
@@ -13,6 +14,7 @@
#include <unistd.h> #include <unistd.h>
#include "config.h" #include "config.h"
#include <string.h> #include <string.h>
#include <strings.h>
#include <sys/wait.h> #include <sys/wait.h>
#ifdef HAVE_SYS_SELECT_H #ifdef HAVE_SYS_SELECT_H
#include <sys/select.h> #include <sys/select.h>
@@ -678,8 +680,10 @@ cleanup:
MOVE(Currentbuf->cursorY, Currentbuf->cursorX); MOVE(Currentbuf->cursorY, Currentbuf->cursorX);
} }
static unsigned char *skip_gif_header(unsigned char *p);
static void static void
save_gif(const char *path, u_char *header, size_t header_size, u_char *body, size_t body_size) save_gif(const char *path, unsigned char *header, size_t header_size, unsigned char *body, size_t body_size)
{ {
int fd; int fd;
@@ -691,8 +695,8 @@ save_gif(const char *path, u_char *header, size_t header_size, u_char *body, si
} }
} }
static u_char * static unsigned char *
skip_gif_header(u_char *p) skip_gif_header(unsigned char *p)
{ {
/* Header */ /* Header */
p += 10; p += 10;
@@ -710,10 +714,10 @@ save_first_animation_frame(const char *path)
{ {
int fd; int fd;
struct stat st; struct stat st;
u_char *header; unsigned char *header;
size_t header_size; size_t header_size;
u_char *body; unsigned char *body;
u_char *p; unsigned char *p;
ssize_t len; ssize_t len;
Str new_path; Str new_path;
@@ -1297,7 +1301,7 @@ setupscreen(void)
for (i = 0; i < max_LINES; i++) { for (i = 0; i < max_LINES; i++) {
#ifdef USE_M17N #ifdef USE_M17N
ScreenElem[i].lineimage = New_N(char *, max_COLS); ScreenElem[i].lineimage = New_N(char *, max_COLS);
bzero((void *)ScreenElem[i].lineimage, max_COLS * sizeof(char *)); memset((void *)ScreenElem[i].lineimage, 0, max_COLS * sizeof(char *));
#else #else
ScreenElem[i].lineimage = New_N(char, max_COLS); ScreenElem[i].lineimage = New_N(char, max_COLS);
#endif #endif
+1
View File
@@ -132,6 +132,7 @@ newTextLine(Str line, int pos)
else else
lbuf->line = Strnew(); lbuf->line = Strnew();
lbuf->pos = pos; lbuf->pos = pos;
lbuf->is_heading = 0;
return lbuf; return lbuf;
} }
+1
View File
@@ -53,6 +53,7 @@ typedef struct _textlist {
typedef struct _TextLine { typedef struct _TextLine {
Str line; Str line;
int pos; int pos;
char is_heading;
} TextLine; } TextLine;
typedef struct _textlinelistitem { typedef struct _textlinelistitem {
+2 -2
View File
@@ -1694,12 +1694,12 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current,
/* local CGI: POST */ /* local CGI: POST */
uf.stream = newFileStream(localcgi_post(pu->real_file, pu->query, uf.stream = newFileStream(localcgi_post(pu->real_file, pu->query,
request, option->referer), request, option->referer),
(void (*)())fclose); fclose_wrapper);
else else
/* lodal CGI: GET */ /* lodal CGI: GET */
uf.stream = newFileStream(localcgi_get(pu->real_file, pu->query, uf.stream = newFileStream(localcgi_get(pu->real_file, pu->query,
option->referer), option->referer),
(void (*)())fclose); fclose_wrapper);
if (uf.stream) { if (uf.stream) {
uf.is_cgi = TRUE; uf.is_cgi = TRUE;
uf.scheme = pu->scheme = SCM_LOCAL_CGI; uf.scheme = pu->scheme = SCM_LOCAL_CGI;
+1 -1
View File
@@ -1,5 +1,5 @@
/* $Id: version.c.in,v 1.49 2012/05/22 09:45:56 inu Exp $ */ /* $Id: version.c.in,v 1.49 2012/05/22 09:45:56 inu Exp $ */
#define CURRENT_VERSION "w3m/0.5.3+gitYYYYMMDD" #define CURRENT_VERSION "w3m/0.5.3+stormux-2025"
#ifndef FM_H #ifndef FM_H
char *w3m_version = CURRENT_VERSION; char *w3m_version = CURRENT_VERSION;
+3 -4
View File
@@ -9,9 +9,9 @@
#if LANG == JA #if LANG == JA
/* FIXME: gettextize here */ /* FIXME: gettextize here */
#define BKMARK_TITLE "ブックマークの登録" #define BKMARK_TITLE "֥åޡϿ"
#define BKMARK_ADD "登録" #define BKMARK_ADD "Ͽ"
#define DEFAULT_SECTION "未分類" #define DEFAULT_SECTION "̤ʬ"
#else #else
#define BKMARK_TITLE "Register to my bookmark" #define BKMARK_TITLE "Register to my bookmark"
#define BKMARK_ADD "ADD" #define BKMARK_ADD "ADD"
@@ -183,7 +183,6 @@ insert_bookmark(char *bmark, struct parsed_tagarg *data)
int int
main(void) main(void)
{ {
extern char *getenv();
char *p; char *p;
int length; int length;
Str qs = NULL; Str qs = NULL;
+3 -2
View File
@@ -5,10 +5,11 @@
<BODY> <BODY>
<CENTER> <CENTER>
******* *******
<A HREF="http://w3m.sourceforge.net/"> <A HREF="https://git.stormux.org/storm/w3m">
w3m</A> w3m</A>
(WWW-wo-Miru) Version @CURRENT_VERSION@ by (WWW-wo-Miru) Version @CURRENT_VERSION@ by
<A HREF="mailto:aito@fw.ipsj.or.jp">A.ITO</A> ********<BR> <A HREF="mailto:aito@fw.ipsj.or.jp">A.ITO</A> &
<A HREF="mailto:storm_dragon@stormux.org">Storm Dragon</A> ********<BR>
***** Key assign table ***** ***** Key assign table *****
</CENTER> </CENTER>
+7 -8
View File
@@ -12,13 +12,13 @@
#if LANG == JA #if LANG == JA
/* FIXME: gettextize here */ /* FIXME: gettextize here */
#define MSG_TITLE "外部ビューアの編集" #define MSG_TITLE "ӥ塼Խ"
#define MSG_NEW_ENTRY "新規登録" #define MSG_NEW_ENTRY "Ͽ"
#define MSG_TYPE "データタイプ" #define MSG_TYPE "ǡ"
#define MSG_COMMAND "外部コマンド" #define MSG_COMMAND "ޥ"
#define MSG_REGISTER "登録" #define MSG_REGISTER "Ͽ"
#define MSG_DELETE "削除" #define MSG_DELETE ""
#define MSG_DOIT "実行" #define MSG_DOIT "¹"
#else /* LANG != JA */ #else /* LANG != JA */
#define MSG_TITLE "External Viewers Setup" #define MSG_TITLE "External Viewers Setup"
#define MSG_NEW_ENTRY "New Entry" #define MSG_NEW_ENTRY "New Entry"
@@ -167,7 +167,6 @@ int
main(void) main(void)
{ {
Str mailcapfile; Str mailcapfile;
extern char *getenv();
char *p; char *p;
int length; int length;
Str qs = NULL; Str qs = NULL;