aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2001-12-09 13:59:04 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2001-12-09 13:59:04 +0000
commitf41604493664f96ef07e7f74934c73736b3942a6 (patch)
tree47f73d8e60f956aec1d1190ae1ca71d857ab51a7
parentfix to prevent rcsid expansion (diff)
downloadw3m-f41604493664f96ef07e7f74934c73736b3942a6.tar.gz
w3m-f41604493664f96ef07e7f74934c73736b3942a6.zip
[w3m-dev 02646]
From: Kiyokazu SUTO <suto@ks-and-ks.ne.jp>
-rw-r--r--ChangeLog16
-rwxr-xr-xconfigure28
-rw-r--r--etc.c47
-rw-r--r--file.c15
-rw-r--r--fm.h5
-rw-r--r--proto.h4
-rw-r--r--terms.c13
7 files changed, 59 insertions, 69 deletions
diff --git a/ChangeLog b/ChangeLog
index 081dfcf..96a9522 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* [w3m-dev 02645]
@@ -1104,4 +1118,4 @@
* release-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 $
diff --git a/configure b/configure
index 0e5e0cc..4366f65 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#!/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.
#
@@ -967,18 +967,20 @@ done
case $sysname in
linux|Linux|LINUX|aix|Aix|AIX)
- case $cflags in
- *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
- echo "Your OS is $sysname; using gc library comes with w3m."
- gcinclude=""
- gclib=""
- ;;
- esac
+ if [ ! -f "$gcinclude/private/gc_priv.h" ]; then
+ case $cflags in
+ *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
+ echo "Your OS is $sysname; using gc library comes with w3m."
+ gcinclude=""
+ gclib=""
+ ;;
+ esac
+ fi
;;
esac
diff --git a/etc.c b/etc.c
index 81e7516..48f62ea 100644
--- a/etc.c
+++ b/etc.c
@@ -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 <pwd.h>
#include "myctype.h"
@@ -171,24 +171,21 @@ currentLineSkip(Buffer *buf, Line *line, int offset, int last)
#define MAX_CMD_LEN 128
-static int
-get_cmd(Hash_si * hash,
- char **s,
- char *args,
- char termchar, int defaultcmd, int allow_space, int *status)
+int
+gethtmlcmd(char **s)
{
+ extern Hash_si tagtable;
char cmdstr[MAX_CMD_LEN];
char *p = cmdstr;
char *save = *s;
int cmd;
- if (status)
- *status = 0;
+
(*s)++;
/* first character */
if (IS_ALNUM(**s) || **s == '_' || **s == '/')
*(p++) = tolower(*((*s)++));
else
- return defaultcmd;
+ return HTML_UNKNOWN;
if (p[-1] == '/')
SKIP_BLANKS(*s);
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) {
/* buffer overflow: perhaps caused by bad HTML source */
*s = save + 1;
- if (status)
- *status = -1;
- return defaultcmd;
+ return HTML_UNKNOWN;
}
*p = '\0';
/* hash search */
- cmd = getHash_si(hash, cmdstr, defaultcmd);
- if (args != NULL) {
- p = args;
- while (**s == ' ' || **s == '\t')
- (*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)
+ cmd = getHash_si(&tagtable, cmdstr, HTML_UNKNOWN);
+ while (**s && **s != '>')
+ (*s)++;
+ if (**s == '>')
(*s)++;
- else if (status)
- *status = -1;
return cmd;
}
-int
-gethtmlcmd(char **s, int *status)
-{
- extern Hash_si tagtable;
- return get_cmd(&tagtable, s, NULL, '>', HTML_UNKNOWN, TRUE, status);
-}
-
static char *
searchAnchorArg(char **arg)
{
diff --git a/file.c b/file.c
index ce87aa3..90c391b 100644
--- a/file.c
+++ b/file.c
@@ -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 <sys/types.h>
#include "myctype.h"
@@ -293,6 +293,7 @@ uncompressed_file_type(char *path, char **ext)
if (path == NULL)
return NULL;
+ slen = 0;
len = strlen(path);
for (d = compression_decoders; d->type != CMP_NOCOMPRESS; d++) {
if (d->ext == NULL)
@@ -1804,7 +1805,7 @@ sloppy_parse_line(char **str)
static void
passthrough(struct readbuffer *obuf, char *str, int back)
{
- int status, cmd;
+ int cmd;
Str tok = Strnew();
char *str_bak;
@@ -1817,7 +1818,7 @@ passthrough(struct readbuffer *obuf, char *str, int back)
str_bak = str;
if (sloppy_parse_line(&str)) {
char *q = str_bak;
- cmd = gethtmlcmd(&q, &status);
+ cmd = gethtmlcmd(&q);
if (back) {
struct link_stack *p;
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 */
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;
- char *str = istr, *q;
+ char *q;
int cmd;
struct readbuffer *obuf = h_env->obuf;
int indent, delta;
@@ -4296,7 +4297,7 @@ HTMLlineproc0(char *istr, struct html_feed_environ *h_env, int internal)
(obuf->table_level >= 0) ? 'T' : ' ',
(obuf->flag & RB_INTXTA) ? 'X' : ' ',
(obuf->flag & RB_IGNORE) ? 'I' : ' ');
- fprintf(f, "HTMLlineproc1(\"%s\",%d,%lx)\n", istr, h_env->limit,
+ fprintf(f, "HTMLlineproc1(\"%s\",%d,%lx)\n", str, h_env->limit,
(unsigned long)h_env);
fclose(f);
}
@@ -4387,7 +4388,7 @@ HTMLlineproc0(char *istr, struct html_feed_environ *h_env, int internal)
}
else {
char *p = q;
- cmd = gethtmlcmd(&p, NULL);
+ cmd = gethtmlcmd(&p);
}
/* textarea */
diff --git a/fm.h b/fm.h
index 8ee16db..a804d44 100644
--- a/fm.h
+++ b/fm.h
@@ -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
*
@@ -10,7 +10,10 @@
#ifndef FM_H
#define FM_H
+
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE /* strcasestr() */
+#endif
#include <stdio.h>
#include <stdlib.h>
diff --git a/proto.h b/proto.h
index 3ef44e0..f51e77a 100644
--- a/proto.h
+++ b/proto.h
@@ -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.
* Manual editing not recommended.
@@ -234,7 +234,7 @@ extern int columnSkip(Buffer *buf, int offset);
extern int columnPos(Line *line, int column);
extern Line *lineSkip(Buffer *buf, Line *line, int offset, int last);
extern Line *currentLineSkip(Buffer *buf, Line *line, int offset, int last);
-extern int gethtmlcmd(char **s, int *status);
+extern int gethtmlcmd(char **s);
extern char *getAnchor(char *arg, char **arg_return);
extern Str checkType(Str s, Lineprop *oprop,
#ifdef USE_ANSI_COLOR
diff --git a/terms.c b/terms.c
index 8965912..7d195b2 100644
--- a/terms.c
+++ b/terms.c
@@ -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
* revised by Akinori ITO, January 1995
@@ -15,6 +15,7 @@
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
+#include <sys/ioctl.h>
#ifdef USE_MOUSE
#ifdef USE_GPM
#include <gpm.h>
@@ -234,8 +235,7 @@ void flush_tty();
#endif /* not SIGIOT */
#ifdef HAVE_TERMIO_H
-#include <sys/ioctl.h>
-#include <termio.h>
+#include <termio.h>
typedef struct termio TerminalMode;
#define TerminalSet(fd,x) ioctl(fd,TCSETA,x)
#define TerminalGet(fd,x) ioctl(fd,TCGETA,x)
@@ -254,8 +254,7 @@ typedef struct termios TerminalMode;
#endif /* HAVE_TERMIOS_H */
#ifdef HAVE_SGTTY_H
-#include <sys/ioctl.h>
-#include <sgtty.h>
+#include <sgtty.h>
typedef struct sgttyb TerminalMode;
#define TerminalSet(fd,x) ioctl(fd,TIOCSETP,x)
#define TerminalGet(fd,x) ioctl(fd,TIOCGETP,x)
@@ -655,10 +654,6 @@ getTCstr(void)
setgraphchar();
}
-#ifndef TIOCGWINSZ
-#include <sys/ioctl.h>
-#endif /* not TIOCGWINSZ */
-
void
setlinescols(void)
{