[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nmh-workers] Starting the final call for features for 1.7
From: |
Paul Fox |
Subject: |
Re: [Nmh-workers] Starting the final call for features for 1.7 |
Date: |
Tue, 27 Sep 2016 07:10:39 -0400 |
oliver wrote:
> On 23 Sep, Ken Hornstein wrote:
> > I think that we are starting to get close to being ready for a 1.7
>
> The latest code in git is failing to build on Solaris because it
> relies on getline(3). getline was a GNU extension that has now been
> added to recent POSIX specifications but may still be lacking on
> older systems that predate that.
>
> Could we perhaps include a configure test and a fallback implementation
> such as the one below (it is a public domain implementation tweaked
> to use mh_xmalloc etc)?
as i recall, after i changed most everything to use getline(), lyndon
was working on such a replacement, but i don't know what happened with
that. oh -- here:
http://lists.nongnu.org/archive/html/nmh-workers/2014-08/msg00033.html
looks like it was never finished. the target at the time was OS X, not
solaris.
paul
>
> I'm not quite sure which file would be appropriate for this to be
> included in. sbr/utils.c seemed a reasonable choice but one of the
> test cases also depends on getline and my automake knowledge was not
> sufficient to work out how to handle the dependencies for that without
> listing loads of object files. I also can't work out how to run the
> tests by the way. make test doesn't work and the README file provides no
> indication of how to run them.
>
> Oliver
>
> #ifndef HAVE_GETLINE
>
> ssize_t getline(char **lineptr, size_t *n, FILE *stream) {
> int c;
> size_t alloced = 0;
> char *linebuf;
>
> if (*lineptr == NULL) {
> alloced = 256;
> linebuf = mh_xmalloc(sizeof(char) * alloced);
> } else {
> linebuf = *lineptr;
> alloced = *n;
> }
> ssize_t linelen = 0;
>
> do {
> c = fgetc(stream);
> if (c == EOF) {
> break;
> }
> if (linelen >= alloced) {
> alloced += (alloced + 1)/2;
> linebuf = mh_xrealloc(linebuf, sizeof(char) * alloced);
> }
> *(linebuf + linelen) = (unsigned char)c;
> linelen++;
> } while (c != '\n');
>
> if (linelen == 0) {
> if (linebuf && !*lineptr) {
> free(linebuf);
> linebuf = NULL;
> }
> linelen = -1;
> *n = alloced;
> } else {
> if (linebuf) {
> linebuf[linelen] = '\0';
> }
> *n = alloced;
> *lineptr = linebuf;
> }
>
> return linelen;
> }
>
> #endif
>
>
> _______________________________________________
> Nmh-workers mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/nmh-workers
>
=----------------------
paul fox, address@hidden (arlington, ma, where it's 53.8 degrees)
- Re: [Nmh-workers] Starting the final call for features for 1.7, (continued)
- Re: [Nmh-workers] Starting the final call for features for 1.7, William Hay, 2016/09/27
- Re: [Nmh-workers] Starting the final call for features for 1.7, David Levine, 2016/09/27
- Re: [Nmh-workers] Starting the final call for features for 1.7, William Hay, 2016/09/27
- Re: [Nmh-workers] Starting the final call for features for 1.7, Ken Hornstein, 2016/09/27
- Re: [Nmh-workers] Starting the final call for features for 1.7, William Hay, 2016/09/27
- Re: [Nmh-workers] Starting the final call for features for 1.7, Ken Hornstein, 2016/09/27
- Re: [Nmh-workers] Starting the final call for features for 1.7, P Vixie, 2016/09/27
- Re: [Nmh-workers] Starting the final call for features for 1.7, William Hay, 2016/09/28
Re: [Nmh-workers] Starting the final call for features for 1.7, Oliver Kiddle, 2016/09/27