commit ca87005f446178738577b7f49891e9df2c25983c
parent 7aa3a24182462c391f79ca37d110920fbb2eb3cc
Author: ukai <ukai>
Date: Sun, 2 Dec 2001 16:26:08 +0000
[w3m-dev 02605]
From: Kiyokazu SUTO <suto@ks-and-ks.ne.jp>
Diffstat:
16 files changed, 62 insertions(+), 31 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -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>
* [w3m-dev 02604]
diff --git a/XMakefile b/XMakefile
@@ -107,7 +107,8 @@ all-scripts:
install-scripts: all-scripts
for dir in $(SCRIPTSUBDIRS); \
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
uninstall:
diff --git a/display.c b/display.c
@@ -782,7 +782,7 @@ record_err_message(char *s)
message_list = newGeneralList();
if (message_list->nitem >= LINES)
popValue(message_list);
- pushValue(message_list, allocStr(s, 0));
+ pushValue(message_list, allocStr(s, -1));
}
}
diff --git a/etc.c b/etc.c
@@ -640,7 +640,7 @@ lastFileName(char *path)
p++;
}
- return allocStr(q, 0);
+ return allocStr(q, -1);
}
#ifndef HAVE_BCOPY
@@ -704,7 +704,7 @@ mybasename(char *s)
p++;
else
p = s;
- return allocStr(p, 0);
+ return allocStr(p, -1);
}
char *
@@ -1518,7 +1518,7 @@ FQDN(char *host)
if (!(entry = gethostbyname(host)))
return NULL;
- return allocStr(entry->h_name, 0);
+ return allocStr(entry->h_name, -1);
#else /* INET6 */
for (af = ai_family_order_table[DNS_order];; af++) {
int error;
diff --git a/file.c b/file.c
@@ -1675,7 +1675,7 @@ static void
push_tag(struct readbuffer *obuf, char *cmdname, int cmd)
{
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_sp++;
if (obuf->tag_sp >= TAG_STACK_SIZE || obuf->flag & (RB_SPECIAL & ~RB_NOBR))
diff --git a/func.c b/func.c
@@ -248,7 +248,7 @@ addKeyList(KeyList *list, int key, char *data)
if (data == NULL || *data == '\0')
data = NULL;
else
- data = allocStr(data, 0);
+ data = allocStr(data, -1);
item = searchKeyList(list, key);
if (item == NULL) {
if (data == NULL)
diff --git a/history.c b/history.c
@@ -89,7 +89,7 @@ unshiftHist(Hist *hist, char *ptr)
if (hist == NULL || hist->list == NULL)
return NULL;
- item = (HistItem *)newListItem((void *)allocStr(ptr, 0),
+ item = (HistItem *)newListItem((void *)allocStr(ptr, -1),
(ListItem *)hist->list->first, NULL);
if (hist->list->first)
hist->list->first->prev = item;
@@ -107,7 +107,7 @@ pushHist(Hist *hist, char *ptr)
if (hist == NULL || hist->list == NULL)
return NULL;
- item = (HistItem *)newListItem((void *)allocStr(ptr, 0),
+ item = (HistItem *)newListItem((void *)allocStr(ptr, -1),
NULL, (ListItem *)hist->list->last);
if (hist->list->last)
hist->list->last->next = item;
diff --git a/indep.c b/indep.c
@@ -18,7 +18,7 @@ allocStr(const char *s, int len)
if (s == NULL)
return NULL;
- if (len == 0)
+ if (len < 0)
len = strlen(s);
ptr = NewAtom_N(char, len + 1);
if (ptr == NULL) {
@@ -80,7 +80,7 @@ cleanupName(char *name)
{
char *buf, *p, *q;
- buf = allocStr(name, 0);
+ buf = allocStr(name, -1);
p = buf;
q = name;
while (*q != '\0') {
diff --git a/linein.c b/linein.c
@@ -293,7 +293,7 @@ inputLineHist(char *prompt, char *def_str, int flag, Hist *hist)
if (flag & IN_FILENAME)
return expandName(p);
else
- return allocStr(p, 0);
+ return allocStr(p, -1);
}
#ifdef __EMX__
diff --git a/local.c b/local.c
@@ -64,7 +64,7 @@ dirBuffer(char *dname)
flist = New_N(char *, nfile_max);
nfile = 0;
while ((dir = readdir(d)) != NULL) {
- flist[nfile++] = allocStr(dir->d_name, 0);
+ flist[nfile++] = allocStr(dir->d_name, -1);
if (nfile == nfile_max) {
nfile_max *= 2;
flist = New_Reuse(char *, flist, nfile_max);
diff --git a/main.c b/main.c
@@ -2448,7 +2448,7 @@ gotoLabel(char *label)
copyBuffer(buf, Currentbuf);
for (i = 0; i < MAX_LB; i++)
buf->linkBuffer[i] = NULL;
- buf->currentURL.label = allocStr(label, 0);
+ buf->currentURL.label = allocStr(label, -1);
pushHashHist(URLHist, parsedURL2Str(&buf->currentURL)->ptr);
(*buf->clone)++;
pushBuffer(buf);
@@ -4619,17 +4619,17 @@ searchKeyData(void)
KeyListItem *item;
if (CurrentKeyData != NULL && *CurrentKeyData != '\0')
- return allocStr(CurrentKeyData, 0);
+ return allocStr(CurrentKeyData, -1);
#ifdef USE_MENU
if (CurrentMenuData != NULL && *CurrentMenuData != '\0')
- return allocStr(CurrentMenuData, 0);
+ return allocStr(CurrentMenuData, -1);
#endif
if (CurrentKey < 0)
return NULL;
item = searchKeyList(&w3mKeyList, CurrentKey);
if (item == NULL || item->data == NULL || *item->data == '\0')
return NULL;
- return allocStr(item->data, 0);
+ return allocStr(item->data, -1);
}
static int
diff --git a/parsetagx.c b/parsetagx.c
@@ -232,7 +232,7 @@ parsedtag_set_value(struct parsed_tag *tag, int id, char *value)
i = tag->map[id];
tag->attrid[i] = id;
if (value)
- tag->value[i] = allocStr(value, 0);
+ tag->value[i] = allocStr(value, -1);
else
tag->value[i] = NULL;
tag->need_reconstruct = TRUE;
diff --git a/terms.c b/terms.c
@@ -577,7 +577,7 @@ setgraphchar(void)
#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
getTCstr(void)
diff --git a/textlist.h b/textlist.h
@@ -39,7 +39,7 @@ typedef struct _textlist {
} TextList;
#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 rpopText(tl) ((char *)rpopValue((GeneralList *)(tl)))
#define appendTextList(tl, tl2) ((TextList *)appendGeneralList((GeneralList *)(tl), (GeneralList *)(tl2)))
diff --git a/url.c b/url.c
@@ -212,15 +212,15 @@ DefaultFile(int scheme)
#ifdef USE_SSL
case SCM_HTTPS:
#endif /* USE_SSL */
- return allocStr(HTTP_DEFAULT_FILE, 0);
+ return allocStr(HTTP_DEFAULT_FILE, -1);
#ifdef USE_GOPHER
case SCM_GOPHER:
- return allocStr("1", 0);
+ return allocStr("1", -1);
#endif /* USE_GOPHER */
case SCM_LOCAL:
case SCM_LOCAL_CGI:
case SCM_FTP:
- return allocStr("/", 0);
+ return allocStr("/", -1);
}
return NULL;
}
@@ -830,7 +830,7 @@ parseURL(char *url, ParsedURL *p_url, ParsedURL *current)
q++;
if (IS_ALPHA(q[0]) && (q[1] == ':' || q[1] == '|')) {
if (q[1] == '|') {
- p = allocStr(q, 0);
+ p = allocStr(q, -1);
p[1] = ':';
}
else
@@ -914,17 +914,17 @@ parseURL(char *url, ParsedURL *p_url, ParsedURL *current)
do_label:
if (p_url->scheme == SCM_MISSING) {
p_url->scheme = SCM_LOCAL;
- p_url->file = allocStr(p, 0);
+ p_url->file = allocStr(p, -1);
p_url->label = NULL;
}
else if (*p == '#')
- p_url->label = allocStr(p + 1, 0);
+ p_url->label = allocStr(p + 1, -1);
else
p_url->label = NULL;
}
#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
copyParsedURL(ParsedURL *p, ParsedURL *q)
@@ -997,7 +997,7 @@ parseURL2(char *url, ParsedURL *pu, ParsedURL *current)
#ifdef USE_GOPHER
else if (pu->scheme == SCM_GOPHER && pu->file[0] == '/') {
p = pu->file;
- pu->file = allocStr(p + 1, 0);
+ pu->file = allocStr(p + 1, -1);
}
#endif /* USE_GOPHER */
}
@@ -1485,7 +1485,7 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current,
return uf;
case SCM_FTP:
if (pu->file == NULL)
- pu->file = allocStr("/", 0);
+ pu->file = allocStr("/", -1);
if (non_null(FTP_proxy) &&
!Do_not_use_proxy &&
pu->host != NULL && !check_no_proxy(pu->host)) {
@@ -1509,7 +1509,7 @@ openURL(char *url, ParsedURL *pu, ParsedURL *current,
case SCM_HTTPS:
#endif /* USE_SSL */
if (pu->file == NULL)
- pu->file = allocStr("/", 0);
+ pu->file = allocStr("/", -1);
if (request && request->method == FORM_METHOD_POST && request->body)
hr.command = HR_COMMAND_POST;
if (request && request->method == FORM_METHOD_HEAD)
diff --git a/w3mhelperpanel.c b/w3mhelperpanel.c
@@ -46,7 +46,7 @@ extractMailcapEntry(char *mcap_entry, char **type, char **cmd)
j++;
while (mcap_entry[j] && IS_SPACE(mcap_entry[j]))
j++;
- *cmd = allocStr(&mcap_entry[j], 0);
+ *cmd = allocStr(&mcap_entry[j], -1);
}
static void