[w3m-dev 02605]

From: Kiyokazu SUTO <suto@ks-and-ks.ne.jp>
This commit is contained in:
Fumitoshi UKAI
2001-12-02 16:26:08 +00:00
parent 1ba1e3f91d
commit ba4557fc9d
16 changed files with 77 additions and 46 deletions
+30
View File
@@ -1,3 +1,33 @@
2001-12-03 Kiyokazu SUTO <suto@ks-and-ks.ne.jp>
* [w3m-dev 02605] $(PWD) / allocStr()
* XMakefile (install-scripts): use $$TOPDIR instead of $(PWD)
* indep.c (allocStr): if len is negative, it will copy string in `s'
* display.c (record_err_message): pass -1 as length to allocStr
* etc.c (lastFileName): ditto
* etc.c (mybasename): ditto
* etc.c (FQDN): ditto
* file.c (push_tag): ditto
* func.c (addKeyList): ditto
* history.c (unshiftHist): ditto
* history.c (pushHist): ditto
* indep.c (cleanupName): ditto
* linein.c (inputLineHist): ditto
* local.c (dirBuffer): ditto
* main.c (gotoLabel): ditto
* main.c (searchKeyData): ditto
* parsetagx.c (parsedtag_set_value): ditto
* terms.c (GETSTR): ditto
* textlist.h (pushText): ditto
* url.c (DefaultFile): ditto
* url.c (parseURL): ditto
* url.c (ALLOC_STR): ditto
* url.c (parseURL2): ditto
* url.c (openURL): ditto
* w3mhelperpanel.c (extractMailcapEntry): ditto
2001-12-02 Fumitoshi UKAI <ukai@debian.or.jp> 2001-12-02 Fumitoshi UKAI <ukai@debian.or.jp>
* [w3m-dev 02604] * [w3m-dev 02604]
+3 -2
View File
@@ -1,4 +1,4 @@
# $Id: XMakefile,v 1.11 2001/11/30 16:48:15 ukai Exp $ # $Id: XMakefile,v 1.12 2001/12/02 16:26:08 ukai Exp $
SRCS=main.c file.c buffer.c display.c etc.c search.c linein.c table.c local.c \ SRCS=main.c file.c buffer.c display.c etc.c search.c linein.c table.c local.c \
form.c map.c frame.c rc.c menu.c mailcap.c\ form.c map.c frame.c rc.c menu.c mailcap.c\
func.c cookie.c history.c backend.c $(KEYBIND_SRC) func.c cookie.c history.c backend.c $(KEYBIND_SRC)
@@ -107,7 +107,8 @@ all-scripts:
install-scripts: all-scripts install-scripts: all-scripts
for dir in $(SCRIPTSUBDIRS); \ for dir in $(SCRIPTSUBDIRS); \
do \ do \
(cd $$dir; $(MAKE) PERL='$(PERL)' BIN_DIR='$(BIN_DIR)' LIB_DIR='$(LIB_DIR)' HELP_DIR='$(HELP_DIR)' DESTDIR='$(DESTDIR)' INSTALL='sh $(PWD)/install.sh' install); \ TOPDIR=`pwd`; \
(cd $$dir; $(MAKE) PERL='$(PERL)' BIN_DIR='$(BIN_DIR)' LIB_DIR='$(LIB_DIR)' HELP_DIR='$(HELP_DIR)' DESTDIR='$(DESTDIR)' INSTALL="sh $$TOPDIR/install.sh" install); \
done done
uninstall: uninstall:
+2 -2
View File
@@ -1,4 +1,4 @@
/* $Id: display.c,v 1.10 2001/11/29 09:34:14 ukai Exp $ */ /* $Id: display.c,v 1.11 2001/12/02 16:26:08 ukai Exp $ */
#include <signal.h> #include <signal.h>
#include "fm.h" #include "fm.h"
@@ -782,7 +782,7 @@ record_err_message(char *s)
message_list = newGeneralList(); message_list = newGeneralList();
if (message_list->nitem >= LINES) if (message_list->nitem >= LINES)
popValue(message_list); popValue(message_list);
pushValue(message_list, allocStr(s, 0)); pushValue(message_list, allocStr(s, -1));
} }
} }
+4 -4
View File
@@ -1,4 +1,4 @@
/* $Id: etc.c,v 1.8 2001/11/24 02:01:26 ukai Exp $ */ /* $Id: etc.c,v 1.9 2001/12/02 16:26:08 ukai Exp $ */
#include "fm.h" #include "fm.h"
#include <pwd.h> #include <pwd.h>
#include "myctype.h" #include "myctype.h"
@@ -640,7 +640,7 @@ lastFileName(char *path)
p++; p++;
} }
return allocStr(q, 0); return allocStr(q, -1);
} }
#ifndef HAVE_BCOPY #ifndef HAVE_BCOPY
@@ -704,7 +704,7 @@ mybasename(char *s)
p++; p++;
else else
p = s; p = s;
return allocStr(p, 0); return allocStr(p, -1);
} }
char * char *
@@ -1518,7 +1518,7 @@ FQDN(char *host)
if (!(entry = gethostbyname(host))) if (!(entry = gethostbyname(host)))
return NULL; return NULL;
return allocStr(entry->h_name, 0); return allocStr(entry->h_name, -1);
#else /* INET6 */ #else /* INET6 */
for (af = ai_family_order_table[DNS_order];; af++) { for (af = ai_family_order_table[DNS_order];; af++) {
int error; int error;
+2 -2
View File
@@ -1,4 +1,4 @@
/* $Id: file.c,v 1.24 2001/12/02 14:27:11 ukai Exp $ */ /* $Id: file.c,v 1.25 2001/12/02 16:26:08 ukai Exp $ */
#include "fm.h" #include "fm.h"
#include <sys/types.h> #include <sys/types.h>
#include "myctype.h" #include "myctype.h"
@@ -1675,7 +1675,7 @@ static void
push_tag(struct readbuffer *obuf, char *cmdname, int cmd) push_tag(struct readbuffer *obuf, char *cmdname, int cmd)
{ {
obuf->tag_stack[obuf->tag_sp] = New(struct cmdtable); obuf->tag_stack[obuf->tag_sp] = New(struct cmdtable);
obuf->tag_stack[obuf->tag_sp]->cmdname = allocStr(cmdname, 0); obuf->tag_stack[obuf->tag_sp]->cmdname = allocStr(cmdname, -1);
obuf->tag_stack[obuf->tag_sp]->cmd = cmd; obuf->tag_stack[obuf->tag_sp]->cmd = cmd;
obuf->tag_sp++; obuf->tag_sp++;
if (obuf->tag_sp >= TAG_STACK_SIZE || obuf->flag & (RB_SPECIAL & ~RB_NOBR)) if (obuf->tag_sp >= TAG_STACK_SIZE || obuf->flag & (RB_SPECIAL & ~RB_NOBR))
+2 -2
View File
@@ -1,4 +1,4 @@
/* $Id: func.c,v 1.4 2001/11/24 02:01:26 ukai Exp $ */ /* $Id: func.c,v 1.5 2001/12/02 16:26:08 ukai Exp $ */
/* /*
* w3m func.c * w3m func.c
*/ */
@@ -248,7 +248,7 @@ addKeyList(KeyList *list, int key, char *data)
if (data == NULL || *data == '\0') if (data == NULL || *data == '\0')
data = NULL; data = NULL;
else else
data = allocStr(data, 0); data = allocStr(data, -1);
item = searchKeyList(list, key); item = searchKeyList(list, key);
if (item == NULL) { if (item == NULL) {
if (data == NULL) if (data == NULL)
+3 -3
View File
@@ -1,4 +1,4 @@
/* $Id: history.c,v 1.4 2001/11/24 02:01:26 ukai Exp $ */ /* $Id: history.c,v 1.5 2001/12/02 16:26:08 ukai Exp $ */
#include "fm.h" #include "fm.h"
#ifdef USE_HISTORY #ifdef USE_HISTORY
@@ -89,7 +89,7 @@ unshiftHist(Hist *hist, char *ptr)
if (hist == NULL || hist->list == NULL) if (hist == NULL || hist->list == NULL)
return NULL; return NULL;
item = (HistItem *)newListItem((void *)allocStr(ptr, 0), item = (HistItem *)newListItem((void *)allocStr(ptr, -1),
(ListItem *)hist->list->first, NULL); (ListItem *)hist->list->first, NULL);
if (hist->list->first) if (hist->list->first)
hist->list->first->prev = item; hist->list->first->prev = item;
@@ -107,7 +107,7 @@ pushHist(Hist *hist, char *ptr)
if (hist == NULL || hist->list == NULL) if (hist == NULL || hist->list == NULL)
return NULL; return NULL;
item = (HistItem *)newListItem((void *)allocStr(ptr, 0), item = (HistItem *)newListItem((void *)allocStr(ptr, -1),
NULL, (ListItem *)hist->list->last); NULL, (ListItem *)hist->list->last);
if (hist->list->last) if (hist->list->last)
hist->list->last->next = item; hist->list->last->next = item;
+3 -3
View File
@@ -1,4 +1,4 @@
/* $Id: indep.c,v 1.13 2001/11/27 18:29:24 ukai Exp $ */ /* $Id: indep.c,v 1.14 2001/12/02 16:26:08 ukai Exp $ */
#include "fm.h" #include "fm.h"
#include <stdio.h> #include <stdio.h>
#include <pwd.h> #include <pwd.h>
@@ -18,7 +18,7 @@ allocStr(const char *s, int len)
if (s == NULL) if (s == NULL)
return NULL; return NULL;
if (len == 0) if (len < 0)
len = strlen(s); len = strlen(s);
ptr = NewAtom_N(char, len + 1); ptr = NewAtom_N(char, len + 1);
if (ptr == NULL) { if (ptr == NULL) {
@@ -80,7 +80,7 @@ cleanupName(char *name)
{ {
char *buf, *p, *q; char *buf, *p, *q;
buf = allocStr(name, 0); buf = allocStr(name, -1);
p = buf; p = buf;
q = name; q = name;
while (*q != '\0') { while (*q != '\0') {
+2 -2
View File
@@ -1,4 +1,4 @@
/* $Id: linein.c,v 1.9 2001/11/29 09:34:14 ukai Exp $ */ /* $Id: linein.c,v 1.10 2001/12/02 16:26:08 ukai Exp $ */
#include "fm.h" #include "fm.h"
#include "local.h" #include "local.h"
#include "myctype.h" #include "myctype.h"
@@ -293,7 +293,7 @@ inputLineHist(char *prompt, char *def_str, int flag, Hist *hist)
if (flag & IN_FILENAME) if (flag & IN_FILENAME)
return expandName(p); return expandName(p);
else else
return allocStr(p, 0); return allocStr(p, -1);
} }
#ifdef __EMX__ #ifdef __EMX__
+2 -2
View File
@@ -1,4 +1,4 @@
/* $Id: local.c,v 1.10 2001/11/29 09:34:14 ukai Exp $ */ /* $Id: local.c,v 1.11 2001/12/02 16:26:08 ukai Exp $ */
#include "fm.h" #include "fm.h"
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
@@ -64,7 +64,7 @@ dirBuffer(char *dname)
flist = New_N(char *, nfile_max); flist = New_N(char *, nfile_max);
nfile = 0; nfile = 0;
while ((dir = readdir(d)) != NULL) { while ((dir = readdir(d)) != NULL) {
flist[nfile++] = allocStr(dir->d_name, 0); flist[nfile++] = allocStr(dir->d_name, -1);
if (nfile == nfile_max) { if (nfile == nfile_max) {
nfile_max *= 2; nfile_max *= 2;
flist = New_Reuse(char *, flist, nfile_max); flist = New_Reuse(char *, flist, nfile_max);
+5 -5
View File
@@ -1,4 +1,4 @@
/* $Id: main.c,v 1.30 2001/11/30 18:06:28 ukai Exp $ */ /* $Id: main.c,v 1.31 2001/12/02 16:26:08 ukai Exp $ */
#define MAINPROGRAM #define MAINPROGRAM
#include "fm.h" #include "fm.h"
#include <signal.h> #include <signal.h>
@@ -2448,7 +2448,7 @@ gotoLabel(char *label)
copyBuffer(buf, Currentbuf); copyBuffer(buf, Currentbuf);
for (i = 0; i < MAX_LB; i++) for (i = 0; i < MAX_LB; i++)
buf->linkBuffer[i] = NULL; buf->linkBuffer[i] = NULL;
buf->currentURL.label = allocStr(label, 0); buf->currentURL.label = allocStr(label, -1);
pushHashHist(URLHist, parsedURL2Str(&buf->currentURL)->ptr); pushHashHist(URLHist, parsedURL2Str(&buf->currentURL)->ptr);
(*buf->clone)++; (*buf->clone)++;
pushBuffer(buf); pushBuffer(buf);
@@ -4619,17 +4619,17 @@ searchKeyData(void)
KeyListItem *item; KeyListItem *item;
if (CurrentKeyData != NULL && *CurrentKeyData != '\0') if (CurrentKeyData != NULL && *CurrentKeyData != '\0')
return allocStr(CurrentKeyData, 0); return allocStr(CurrentKeyData, -1);
#ifdef USE_MENU #ifdef USE_MENU
if (CurrentMenuData != NULL && *CurrentMenuData != '\0') if (CurrentMenuData != NULL && *CurrentMenuData != '\0')
return allocStr(CurrentMenuData, 0); return allocStr(CurrentMenuData, -1);
#endif #endif
if (CurrentKey < 0) if (CurrentKey < 0)
return NULL; return NULL;
item = searchKeyList(&w3mKeyList, CurrentKey); item = searchKeyList(&w3mKeyList, CurrentKey);
if (item == NULL || item->data == NULL || *item->data == '\0') if (item == NULL || item->data == NULL || *item->data == '\0')
return NULL; return NULL;
return allocStr(item->data, 0); return allocStr(item->data, -1);
} }
static int static int
+2 -2
View File
@@ -1,4 +1,4 @@
/* $Id: parsetagx.c,v 1.6 2001/11/29 09:34:15 ukai Exp $ */ /* $Id: parsetagx.c,v 1.7 2001/12/02 16:26:08 ukai Exp $ */
#include "fm.h" #include "fm.h"
#include "myctype.h" #include "myctype.h"
#include "indep.h" #include "indep.h"
@@ -232,7 +232,7 @@ parsedtag_set_value(struct parsed_tag *tag, int id, char *value)
i = tag->map[id]; i = tag->map[id];
tag->attrid[i] = id; tag->attrid[i] = id;
if (value) if (value)
tag->value[i] = allocStr(value, 0); tag->value[i] = allocStr(value, -1);
else else
tag->value[i] = NULL; tag->value[i] = NULL;
tag->need_reconstruct = TRUE; tag->need_reconstruct = TRUE;
+2 -2
View File
@@ -1,4 +1,4 @@
/* $Id: terms.c,v 1.19 2001/11/30 10:10:24 ukai Exp $ */ /* $Id: terms.c,v 1.20 2001/12/02 16:26:08 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
@@ -577,7 +577,7 @@ setgraphchar(void)
#define graphchar(c) (((unsigned)(c)>=' ' && (unsigned)(c)<128)? gcmap[(c)-' '] : (c)) #define graphchar(c) (((unsigned)(c)>=' ' && (unsigned)(c)<128)? gcmap[(c)-' '] : (c))
#define GETSTR(v,s) {v = pt; suc = tgetstr(s,&pt); if (!suc) v = ""; else v = allocStr(suc,0); } #define GETSTR(v,s) {v = pt; suc = tgetstr(s,&pt); if (!suc) v = ""; else v = allocStr(suc, -1); }
void void
getTCstr(void) getTCstr(void)
+2 -2
View File
@@ -1,4 +1,4 @@
/* $Id: textlist.h,v 1.3 2001/11/24 02:01:26 ukai Exp $ */ /* $Id: textlist.h,v 1.4 2001/12/02 16:26:08 ukai Exp $ */
#ifndef TEXTLIST_H #ifndef TEXTLIST_H
#define TEXTLIST_H #define TEXTLIST_H
#include "Str.h" #include "Str.h"
@@ -39,7 +39,7 @@ typedef struct _textlist {
} TextList; } TextList;
#define newTextList() ((TextList *)newGeneralList()) #define newTextList() ((TextList *)newGeneralList())
#define pushText(tl, s) pushValue((GeneralList *)(tl), (void *)allocStr((s)?(s):"",0)) #define pushText(tl, s) pushValue((GeneralList *)(tl), (void *)allocStr((s)?(s):"",-1))
#define popText(tl) ((char *)popValue((GeneralList *)(tl))) #define popText(tl) ((char *)popValue((GeneralList *)(tl)))
#define rpopText(tl) ((char *)rpopValue((GeneralList *)(tl))) #define rpopText(tl) ((char *)rpopValue((GeneralList *)(tl)))
#define appendTextList(tl, tl2) ((TextList *)appendGeneralList((GeneralList *)(tl), (GeneralList *)(tl2))) #define appendTextList(tl, tl2) ((TextList *)appendGeneralList((GeneralList *)(tl), (GeneralList *)(tl2)))
+11 -11
View File
@@ -1,4 +1,4 @@
/* $Id: url.c,v 1.16 2001/11/30 14:06:27 ukai Exp $ */ /* $Id: url.c,v 1.17 2001/12/02 16:26:08 ukai Exp $ */
#include "fm.h" #include "fm.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
@@ -212,15 +212,15 @@ DefaultFile(int scheme)
#ifdef USE_SSL #ifdef USE_SSL
case SCM_HTTPS: case SCM_HTTPS:
#endif /* USE_SSL */ #endif /* USE_SSL */
return allocStr(HTTP_DEFAULT_FILE, 0); return allocStr(HTTP_DEFAULT_FILE, -1);
#ifdef USE_GOPHER #ifdef USE_GOPHER
case SCM_GOPHER: case SCM_GOPHER:
return allocStr("1", 0); return allocStr("1", -1);
#endif /* USE_GOPHER */ #endif /* USE_GOPHER */
case SCM_LOCAL: case SCM_LOCAL:
case SCM_LOCAL_CGI: case SCM_LOCAL_CGI:
case SCM_FTP: case SCM_FTP:
return allocStr("/", 0); return allocStr("/", -1);
} }
return NULL; return NULL;
} }
@@ -830,7 +830,7 @@ parseURL(char *url, ParsedURL *p_url, ParsedURL *current)
q++; q++;
if (IS_ALPHA(q[0]) && (q[1] == ':' || q[1] == '|')) { if (IS_ALPHA(q[0]) && (q[1] == ':' || q[1] == '|')) {
if (q[1] == '|') { if (q[1] == '|') {
p = allocStr(q, 0); p = allocStr(q, -1);
p[1] = ':'; p[1] = ':';
} }
else else
@@ -914,17 +914,17 @@ parseURL(char *url, ParsedURL *p_url, ParsedURL *current)
do_label: do_label:
if (p_url->scheme == SCM_MISSING) { if (p_url->scheme == SCM_MISSING) {
p_url->scheme = SCM_LOCAL; p_url->scheme = SCM_LOCAL;
p_url->file = allocStr(p, 0); p_url->file = allocStr(p, -1);
p_url->label = NULL; p_url->label = NULL;
} }
else if (*p == '#') else if (*p == '#')
p_url->label = allocStr(p + 1, 0); p_url->label = allocStr(p + 1, -1);
else else
p_url->label = NULL; p_url->label = NULL;
} }
#define initParsedURL(p) bzero(p,sizeof(ParsedURL)) #define initParsedURL(p) bzero(p,sizeof(ParsedURL))
#define ALLOC_STR(s) ((s)==NULL?NULL:allocStr(s,0)) #define ALLOC_STR(s) ((s)==NULL?NULL:allocStr(s,-1))
void void
copyParsedURL(ParsedURL *p, ParsedURL *q) copyParsedURL(ParsedURL *p, ParsedURL *q)
@@ -997,7 +997,7 @@ parseURL2(char *url, ParsedURL *pu, ParsedURL *current)
#ifdef USE_GOPHER #ifdef USE_GOPHER
else if (pu->scheme == SCM_GOPHER && pu->file[0] == '/') { else if (pu->scheme == SCM_GOPHER && pu->file[0] == '/') {
p = pu->file; p = pu->file;
pu->file = allocStr(p + 1, 0); pu->file = allocStr(p + 1, -1);
} }
#endif /* USE_GOPHER */ #endif /* USE_GOPHER */
} }
@@ -1485,7 +1485,7 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current,
return uf; return uf;
case SCM_FTP: case SCM_FTP:
if (pu->file == NULL) if (pu->file == NULL)
pu->file = allocStr("/", 0); pu->file = allocStr("/", -1);
if (non_null(FTP_proxy) && if (non_null(FTP_proxy) &&
!Do_not_use_proxy && !Do_not_use_proxy &&
pu->host != NULL && !check_no_proxy(pu->host)) { pu->host != NULL && !check_no_proxy(pu->host)) {
@@ -1509,7 +1509,7 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current,
case SCM_HTTPS: case SCM_HTTPS:
#endif /* USE_SSL */ #endif /* USE_SSL */
if (pu->file == NULL) if (pu->file == NULL)
pu->file = allocStr("/", 0); pu->file = allocStr("/", -1);
if (request && request->method == FORM_METHOD_POST && request->body) if (request && request->method == FORM_METHOD_POST && request->body)
hr.command = HR_COMMAND_POST; hr.command = HR_COMMAND_POST;
if (request && request->method == FORM_METHOD_HEAD) if (request && request->method == FORM_METHOD_HEAD)
+2 -2
View File
@@ -1,4 +1,4 @@
/* $Id: w3mhelperpanel.c,v 1.6 2001/11/24 02:01:26 ukai Exp $ */ /* $Id: w3mhelperpanel.c,v 1.7 2001/12/02 16:26:08 ukai Exp $ */
#include <errno.h> #include <errno.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
@@ -46,7 +46,7 @@ extractMailcapEntry(char *mcap_entry, char **type, char **cmd)
j++; j++;
while (mcap_entry[j] && IS_SPACE(mcap_entry[j])) while (mcap_entry[j] && IS_SPACE(mcap_entry[j]))
j++; j++;
*cmd = allocStr(&mcap_entry[j], 0); *cmd = allocStr(&mcap_entry[j], -1);
} }
static void static void