[w3m-dev 02646]

From: Kiyokazu SUTO <suto@ks-and-ks.ne.jp>
This commit is contained in:
Fumitoshi UKAI
2001-12-09 13:59:04 +00:00
parent 70617e8626
commit f416044936
7 changed files with 59 additions and 69 deletions
+15 -1
View File
@@ -1,3 +1,17 @@
2001-12-09 Kiyokazu SUTO <suto@ks-and-ks.ne.jp>
* [w3m-dev 02646] Some code cleanups
* configure: use host libgc instead of gc/gc.a on Linux and/or AIX
if possible
* etc.c (get_cmd): deleted, merged into gethtmlcmd()
* etc.c (gethtmlcmd): merge get_cmd() code
* file.c (uncompressed_file_type): initialize slen
* file.c (passthrough): status deleted
* file.c (HTMLlineproc0): istr deleted, gethtmlcmd() argument fix
* fm.h (_GNU_SOURCE): ifndef _GNU_SOURCE
* proto.h (gethtmlcmd): fix prototypes
* terms.c: include <sys/ioctl.h> always
2001-12-09 Fumitoshi UKAI <ukai@debian.or.jp> 2001-12-09 Fumitoshi UKAI <ukai@debian.or.jp>
* [w3m-dev 02645] * [w3m-dev 02645]
@@ -1104,4 +1118,4 @@
* release-0-2-1 * release-0-2-1
* import w3m-0.2.1 * import w3m-0.2.1
$Id: ChangeLog,v 1.117 2001/12/08 15:55:30 ukai Exp $ $Id: ChangeLog,v 1.118 2001/12/09 13:59:04 ukai Exp $
Vendored
+15 -13
View File
@@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
# $Id: configure,v 1.34 2001/12/08 11:24:41 ukai Exp $ # $Id: configure,v 1.35 2001/12/09 13:59:04 ukai Exp $
# Configuration. # Configuration.
# #
@@ -967,18 +967,20 @@ done
case $sysname in case $sysname in
linux|Linux|LINUX|aix|Aix|AIX) linux|Linux|LINUX|aix|Aix|AIX)
case $cflags in if [ ! -f "$gcinclude/private/gc_priv.h" ]; then
*DEBIAN*) case $cflags in
# on Debian, we can use libgc*.deb *DEBIAN*)
:;; # on Debian, we can use libgc*.deb
*) :;;
# these OS requires gcmain.c, which include gc/gc_priv.h *)
# therefore we use gc library comes with w3m # these OS requires gcmain.c, which include gc/gc_priv.h
echo "Your OS is $sysname; using gc library comes with w3m." # therefore we use gc library comes with w3m
gcinclude="" echo "Your OS is $sysname; using gc library comes with w3m."
gclib="" gcinclude=""
;; gclib=""
esac ;;
esac
fi
;; ;;
esac esac
+11 -36
View File
@@ -1,4 +1,4 @@
/* $Id: etc.c,v 1.9 2001/12/02 16:26:08 ukai Exp $ */ /* $Id: etc.c,v 1.10 2001/12/09 13:59:04 ukai Exp $ */
#include "fm.h" #include "fm.h"
#include <pwd.h> #include <pwd.h>
#include "myctype.h" #include "myctype.h"
@@ -171,24 +171,21 @@ currentLineSkip(Buffer *buf, Line *line, int offset, int last)
#define MAX_CMD_LEN 128 #define MAX_CMD_LEN 128
static int int
get_cmd(Hash_si * hash, gethtmlcmd(char **s)
char **s,
char *args,
char termchar, int defaultcmd, int allow_space, int *status)
{ {
extern Hash_si tagtable;
char cmdstr[MAX_CMD_LEN]; char cmdstr[MAX_CMD_LEN];
char *p = cmdstr; char *p = cmdstr;
char *save = *s; char *save = *s;
int cmd; int cmd;
if (status)
*status = 0;
(*s)++; (*s)++;
/* first character */ /* first character */
if (IS_ALNUM(**s) || **s == '_' || **s == '/') if (IS_ALNUM(**s) || **s == '_' || **s == '/')
*(p++) = tolower(*((*s)++)); *(p++) = tolower(*((*s)++));
else else
return defaultcmd; return HTML_UNKNOWN;
if (p[-1] == '/') if (p[-1] == '/')
SKIP_BLANKS(*s); SKIP_BLANKS(*s);
while ((IS_ALNUM(**s) || **s == '_') && p - cmdstr < MAX_CMD_LEN) { while ((IS_ALNUM(**s) || **s == '_') && p - cmdstr < MAX_CMD_LEN) {
@@ -197,41 +194,19 @@ get_cmd(Hash_si * hash,
if (p - cmdstr == MAX_CMD_LEN) { if (p - cmdstr == MAX_CMD_LEN) {
/* buffer overflow: perhaps caused by bad HTML source */ /* buffer overflow: perhaps caused by bad HTML source */
*s = save + 1; *s = save + 1;
if (status) return HTML_UNKNOWN;
*status = -1;
return defaultcmd;
} }
*p = '\0'; *p = '\0';
/* hash search */ /* hash search */
cmd = getHash_si(hash, cmdstr, defaultcmd); cmd = getHash_si(&tagtable, cmdstr, HTML_UNKNOWN);
if (args != NULL) { while (**s && **s != '>')
p = args; (*s)++;
while (**s == ' ' || **s == '\t') if (**s == '>')
(*s)++;
while (**s && **s != '\n' && **s != '\r' && **s != termchar) {
*(p++) = *((*s)++);
}
*p = '\0';
}
else if (allow_space) {
while (**s && **s != termchar)
(*s)++;
}
if (**s == termchar)
(*s)++; (*s)++;
else if (status)
*status = -1;
return cmd; return cmd;
} }
int
gethtmlcmd(char **s, int *status)
{
extern Hash_si tagtable;
return get_cmd(&tagtable, s, NULL, '>', HTML_UNKNOWN, TRUE, status);
}
static char * static char *
searchAnchorArg(char **arg) searchAnchorArg(char **arg)
{ {
+8 -7
View File
@@ -1,4 +1,4 @@
/* $Id: file.c,v 1.29 2001/12/06 22:25:30 ukai Exp $ */ /* $Id: file.c,v 1.30 2001/12/09 13:59:04 ukai Exp $ */
#include "fm.h" #include "fm.h"
#include <sys/types.h> #include <sys/types.h>
#include "myctype.h" #include "myctype.h"
@@ -293,6 +293,7 @@ uncompressed_file_type(char *path, char **ext)
if (path == NULL) if (path == NULL)
return NULL; return NULL;
slen = 0;
len = strlen(path); len = strlen(path);
for (d = compression_decoders; d->type != CMP_NOCOMPRESS; d++) { for (d = compression_decoders; d->type != CMP_NOCOMPRESS; d++) {
if (d->ext == NULL) if (d->ext == NULL)
@@ -1804,7 +1805,7 @@ sloppy_parse_line(char **str)
static void static void
passthrough(struct readbuffer *obuf, char *str, int back) passthrough(struct readbuffer *obuf, char *str, int back)
{ {
int status, cmd; int cmd;
Str tok = Strnew(); Str tok = Strnew();
char *str_bak; char *str_bak;
@@ -1817,7 +1818,7 @@ passthrough(struct readbuffer *obuf, char *str, int back)
str_bak = str; str_bak = str;
if (sloppy_parse_line(&str)) { if (sloppy_parse_line(&str)) {
char *q = str_bak; char *q = str_bak;
cmd = gethtmlcmd(&q, &status); cmd = gethtmlcmd(&q);
if (back) { if (back) {
struct link_stack *p; struct link_stack *p;
for (p = link_stack; p; p = p->next) { for (p = link_stack; p; p = p->next) {
@@ -4276,10 +4277,10 @@ table_width(struct html_feed_environ *h_env, int table_level)
/* HTML processing first pass */ /* HTML processing first pass */
void void
HTMLlineproc0(char *istr, struct html_feed_environ *h_env, int internal) HTMLlineproc0(char *str, struct html_feed_environ *h_env, int internal)
{ {
Lineprop mode; Lineprop mode;
char *str = istr, *q; char *q;
int cmd; int cmd;
struct readbuffer *obuf = h_env->obuf; struct readbuffer *obuf = h_env->obuf;
int indent, delta; int indent, delta;
@@ -4296,7 +4297,7 @@ HTMLlineproc0(char *istr, struct html_feed_environ *h_env, int internal)
(obuf->table_level >= 0) ? 'T' : ' ', (obuf->table_level >= 0) ? 'T' : ' ',
(obuf->flag & RB_INTXTA) ? 'X' : ' ', (obuf->flag & RB_INTXTA) ? 'X' : ' ',
(obuf->flag & RB_IGNORE) ? 'I' : ' '); (obuf->flag & RB_IGNORE) ? 'I' : ' ');
fprintf(f, "HTMLlineproc1(\"%s\",%d,%lx)\n", istr, h_env->limit, fprintf(f, "HTMLlineproc1(\"%s\",%d,%lx)\n", str, h_env->limit,
(unsigned long)h_env); (unsigned long)h_env);
fclose(f); fclose(f);
} }
@@ -4387,7 +4388,7 @@ HTMLlineproc0(char *istr, struct html_feed_environ *h_env, int internal)
} }
else { else {
char *p = q; char *p = q;
cmd = gethtmlcmd(&p, NULL); cmd = gethtmlcmd(&p);
} }
/* textarea */ /* textarea */
+4 -1
View File
@@ -1,4 +1,4 @@
/* $Id: fm.h,v 1.26 2001/12/06 15:31:58 ukai Exp $ */ /* $Id: fm.h,v 1.27 2001/12/09 13:59:04 ukai Exp $ */
/* /*
* w3m: WWW wo Miru utility * w3m: WWW wo Miru utility
* *
@@ -10,7 +10,10 @@
#ifndef FM_H #ifndef FM_H
#define FM_H #define FM_H
#ifndef _GNU_SOURCE
#define _GNU_SOURCE /* strcasestr() */ #define _GNU_SOURCE /* strcasestr() */
#endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
+2 -2
View File
@@ -1,4 +1,4 @@
/* $Id: proto.h,v 1.13 2001/12/04 16:33:08 ukai Exp $ */ /* $Id: proto.h,v 1.14 2001/12/09 13:59:04 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.
@@ -234,7 +234,7 @@ extern int columnSkip(Buffer *buf, int offset);
extern int columnPos(Line *line, int column); extern int columnPos(Line *line, int column);
extern Line *lineSkip(Buffer *buf, Line *line, int offset, int last); extern Line *lineSkip(Buffer *buf, Line *line, int offset, int last);
extern Line *currentLineSkip(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 int gethtmlcmd(char **s);
extern char *getAnchor(char *arg, char **arg_return); 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 #ifdef USE_ANSI_COLOR
+4 -9
View File
@@ -1,4 +1,4 @@
/* $Id: terms.c,v 1.20 2001/12/02 16:26:08 ukai Exp $ */ /* $Id: terms.c,v 1.21 2001/12/09 13:59:04 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
@@ -15,6 +15,7 @@
#ifdef HAVE_SYS_SELECT_H #ifdef HAVE_SYS_SELECT_H
#include <sys/select.h> #include <sys/select.h>
#endif #endif
#include <sys/ioctl.h>
#ifdef USE_MOUSE #ifdef USE_MOUSE
#ifdef USE_GPM #ifdef USE_GPM
#include <gpm.h> #include <gpm.h>
@@ -234,8 +235,7 @@ void flush_tty();
#endif /* not SIGIOT */ #endif /* not SIGIOT */
#ifdef HAVE_TERMIO_H #ifdef HAVE_TERMIO_H
#include <sys/ioctl.h> #include <termio.h>
#include <termio.h>
typedef struct termio TerminalMode; typedef struct termio TerminalMode;
#define TerminalSet(fd,x) ioctl(fd,TCSETA,x) #define TerminalSet(fd,x) ioctl(fd,TCSETA,x)
#define TerminalGet(fd,x) ioctl(fd,TCGETA,x) #define TerminalGet(fd,x) ioctl(fd,TCGETA,x)
@@ -254,8 +254,7 @@ typedef struct termios TerminalMode;
#endif /* HAVE_TERMIOS_H */ #endif /* HAVE_TERMIOS_H */
#ifdef HAVE_SGTTY_H #ifdef HAVE_SGTTY_H
#include <sys/ioctl.h> #include <sgtty.h>
#include <sgtty.h>
typedef struct sgttyb TerminalMode; typedef struct sgttyb TerminalMode;
#define TerminalSet(fd,x) ioctl(fd,TIOCSETP,x) #define TerminalSet(fd,x) ioctl(fd,TIOCSETP,x)
#define TerminalGet(fd,x) ioctl(fd,TIOCGETP,x) #define TerminalGet(fd,x) ioctl(fd,TIOCGETP,x)
@@ -655,10 +654,6 @@ getTCstr(void)
setgraphchar(); setgraphchar();
} }
#ifndef TIOCGWINSZ
#include <sys/ioctl.h>
#endif /* not TIOCGWINSZ */
void void
setlinescols(void) setlinescols(void)
{ {