diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2001-12-09 13:59:04 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2001-12-09 13:59:04 +0000 |
commit | f41604493664f96ef07e7f74934c73736b3942a6 (patch) | |
tree | 47f73d8e60f956aec1d1190ae1ca71d857ab51a7 /etc.c | |
parent | fix to prevent rcsid expansion (diff) | |
download | w3m-f41604493664f96ef07e7f74934c73736b3942a6.tar.gz w3m-f41604493664f96ef07e7f74934c73736b3942a6.zip |
[w3m-dev 02646]
From: Kiyokazu SUTO <suto@ks-and-ks.ne.jp>
Diffstat (limited to '')
-rw-r--r-- | etc.c | 47 |
1 files changed, 11 insertions, 36 deletions
@@ -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) { |