diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-03-27 15:35:06 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-03-27 15:35:06 +0000 |
commit | f63662d3301927e7b579a3512f3484cfd127ee14 (patch) | |
tree | 600b912ec982c57fe57bb6db614eec48e203446b | |
parent | [w3m-dev 03145] header option (diff) | |
download | w3m-f63662d3301927e7b579a3512f3484cfd127ee14.tar.gz w3m-f63662d3301927e7b579a3512f3484cfd127ee14.zip |
[w3m-dev 03146] Re: header option
* main.c (make_optional_header_string): cleanups
From: Hironori Sakamoto <hsaka@mth.biglobe.ne.jp>
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | main.c | 25 |
2 files changed, 17 insertions, 15 deletions
@@ -1,3 +1,8 @@ +2002-03-28 Hironori Sakamoto <hsaka@mth.biglobe.ne.jp> + + * [w3m-dev 03146] Re: header option + * main.c (make_optional_header_string): cleanups + 2002-03-28 Yuuichi Teranishi <teranisi@gohome.org> * [w3m-dev 03145] header option @@ -3292,4 +3297,4 @@ * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.361 2002/03/27 15:26:09 ukai Exp $ +$Id: ChangeLog,v 1.362 2002/03/27 15:35:06 ukai Exp $ @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.93 2002/03/27 15:26:09 ukai Exp $ */ +/* $Id: main.c,v 1.94 2002/03/27 15:35:06 ukai Exp $ */ #define MAINPROGRAM #include "fm.h" #include <signal.h> @@ -323,21 +323,18 @@ make_optional_header_string(char *s) char *p; Str hs; + if (strchr(s, '\n') || strchr(s, '\r')) + return NULL; for (p = s; *p && *p != ':'; p++) ; if (*p != ':' || p == s) return NULL; - if (strchr(s, '\n')) { - return NULL; - } - hs = Strnew_size(p - s); - strncpy(hs->ptr, s, p - s); - hs->length = p - s; - if (!Strcasecmp_charp(hs, "content-type")) { + hs = Strnew_size(strlen(s) + 3); + Strcopy_charp_n(hs, s, p - s); + if (!Strcasecmp_charp(hs, "content-type")) override_content_type = TRUE; - } Strcat_charp(hs, ": "); - if (*(p + 1)) { /* not null header */ - for (p = p + 1; isspace(*p); p++) ; /* skip white spaces */ + if (*(++p)) { /* not null header */ + SKIP_BLANKS(p); /* skip white spaces */ Strcat_charp(hs, p); } Strcat_charp(hs, "\r\n"); @@ -627,9 +624,9 @@ MAIN(int argc, char **argv, char **envp) Strcat(header_string, hs); } while (argv[i][0]) { - argv[i][0] = '\0'; - argv[i]++; - } + argv[i][0] = '\0'; + argv[i]++; + } } #ifdef USE_MOUSE else if (!strcmp("-no-mouse", argv[i])) { |