Batcher and it's man page.
Julien ÉLIE
julien at trigofacile.com
Sun Nov 1 20:04:22 UTC 2009
Hi Kamil,
> Is it planned restoration of handling lines with filenames? (Or I have
> to write it by myself? :) )
Did you finally find something else to use batcher?
In case it would help, I see that there is some code in innxmit that
could be of help if you want to add support for filenames to batcher:
/*
** Open an article. If the argument is a token, retrieve the article via
** the storage API. Otherwise, open the file and fake up an ARTHANDLE for
** it. Only fill in those fields that we'll need. Articles not retrieved
** via the storage API will have a type of TOKEN_EMPTY.
*/
static ARTHANDLE *
article_open(const char *path, const char *id)
{
TOKEN token;
ARTHANDLE *article;
int fd;
size_t length;
struct stat st;
char *p;
if (IsToken(path)) {
token = TextToToken(path);
article = SMretrieve(token, RETR_ALL);
if (article == NULL) {
if (SMerrno == SMERR_NOENT || SMerrno == SMERR_UNINIT)
STATmissing++;
else {
warn("requeue %s: %s", path, SMerrorstr);
Requeue(path, id);
}
}
return article;
} else {
char *data;
fd = open(path, O_RDONLY);
if (fd < 0)
return NULL;
if (fstat(fd, &st) < 0) {
syswarn("requeue %s", path);
Requeue(path, id);
return NULL;
}
article = xmalloc(sizeof(ARTHANDLE));
article->type = TOKEN_EMPTY;
article->len = st.st_size;
data = xmalloc(article->len);
if (xread(fd, data, article->len) < 0) {
syswarn("requeue %s", path);
free(data);
free(article);
close(fd);
Requeue(path, id);
return NULL;
}
close(fd);
p = memchr(data, '\n', article->len);
if (p == NULL || p == data) {
warn("requeue %s: cannot find headers", path);
free(data);
free(article);
Requeue(path, id);
return NULL;
}
if (p[-1] != '\r') {
p = wire_from_native(data, article->len, &length);
free(data);
data = p;
article->len = length;
}
article->data = data;
return article;
}
}
--
Julien ÉLIE
« Tuto, cito, iucunde. » (Esculape)
More information about the inn-workers
mailing list