From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-3.sys.kth.se (smtp-3.sys.kth.se [130.237.48.192]); by fantadrom.bsd.lv (OpenSMTPD) with ESMTP id 86876f56; for ; Mon, 23 Feb 2015 12:31:36 -0500 (EST) Received: from smtp-3.sys.kth.se (localhost.localdomain [127.0.0.1]) by smtp-3.sys.kth.se (Postfix) with ESMTP id 3DCB3596 for ; Mon, 23 Feb 2015 18:31:35 +0100 (CET) X-Virus-Scanned: by amavisd-new at kth.se Received: from smtp-3.sys.kth.se ([127.0.0.1]) by smtp-3.sys.kth.se (smtp-3.sys.kth.se [127.0.0.1]) (amavisd-new, port 10024) with LMTP id REB-Kap4LiAP for ; Mon, 23 Feb 2015 18:31:33 +0100 (CET) X-KTH-Auth: kristaps [90.38.46.58] X-KTH-mail-from: kristaps@bsd.lv X-KTH-rcpt-to: discuss@mdocml.bsd.lv Received: from pc3.home (AToulouse-651-1-231-58.w90-38.abo.wanadoo.fr [90.38.46.58]) by smtp-3.sys.kth.se (Postfix) with ESMTPSA id 083131C4A for ; Mon, 23 Feb 2015 18:31:24 +0100 (CET) Message-ID: <54EB63EA.4080702@bsd.lv> Date: Mon, 23 Feb 2015 18:31:22 +0100 From: Kristaps Dzonsons User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 X-Mailinglist: mdocml-discuss Reply-To: discuss@mdocml.bsd.lv MIME-Version: 1.0 To: discuss@mdocml.bsd.lv Subject: Re: texi2mdoc References: <54EB47BE.6000608@bsd.lv> <20150223165627.GA13719@k8> In-Reply-To: <20150223165627.GA13719@k8> Content-Type: multipart/mixed; boundary="------------020707040109000404030009" This is a multi-part message in MIME format. --------------020707040109000404030009 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sviatoslav, Oh Linux... not only does it not have strlcat(3) (replaced with a simple string copy) or memmem(3) (found with _GNU_SOURCE), but the dirname(3) is all weird. Does the enclosed patch (against the website version) fix all this for you? (There are another two nits fixed in this, as my Linux box has GMP against which I could test...) Thanks for testing it out! As for the 403... Ingo, the httpd.conf defines "/snapshots/" as accepting directory listings. Should texi2mdoc (and, as I'm seeing, pod2mdoc and docbook2mdoc) also have their snap directories also accept listings? Best, Kristaps --------------020707040109000404030009 Content-Type: text/plain; charset=UTF-8; x-mac-type="0"; x-mac-creator="0"; name="linux.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="linux.patch" ? build ? config.texi ? examples ? files.txt ? files2.txt ? gcc-vers.texi ? gdb-cfg.texi ? intdoc.texi ? linux.patch ? out ? texi2mdoc ? texi2mdoc.dSYM ? afl/dict ? afl/out Index: main.c =================================================================== RCS file: /home/cvs/mdocml/texi2mdoc/main.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -p -r1.36 -r1.37 --- main.c 23 Feb 2015 15:23:44 -0000 1.36 +++ main.c 23 Feb 2015 17:24:51 -0000 1.37 @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.36 2015/02/23 15:23:44 kristaps Exp $ */ +/* $Id: main.c,v 1.37 2015/02/23 17:24:51 kristaps Exp $ */ /* * Copyright (c) 2015 Kristaps Dzonsons * @@ -14,6 +14,9 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#if defined(__linux__) || defined(__MINT__) +# define _GNU_SOURCE /* memmem */ +#endif #include #include @@ -1355,7 +1358,10 @@ dosp(struct texi *p, enum texicmd cmd, const char *buf, size_t sz, size_t *pos) { - texivspace(p); + if (p->literal) + texiputchar(p, '\n'); + else + texivspace(p); /* FIXME: ignore and parseeoln. */ advanceeoln(p, buf, sz, pos, 1); } @@ -1631,7 +1637,7 @@ main(int argc, char *argv[]) { struct texi texi; int c; - char *path, *dir; + char *dirpath, *dir, *ccp; const char *progname, *Idir, *cp; progname = strrchr(argv[0], '/'); @@ -1656,13 +1662,11 @@ main(int argc, char *argv[]) if (0 == (argc -= optind)) goto usage; - if (NULL == (path = strdup(argv[0]))) + if (NULL == (dirpath = strdup(argv[0]))) texiabort(&texi, NULL); - else if (NULL == (dir = dirname(path))) + if (NULL == (dir = dirname(dirpath))) texiabort(&texi, NULL); - free(path); - if (NULL != (cp = strrchr(argv[0], '/'))) texi.title = strdup(cp + 1); else @@ -1670,11 +1674,12 @@ main(int argc, char *argv[]) if (NULL == texi.title) texiabort(&texi, NULL); - else if (NULL != (path = strchr(texi.title, '.'))) - *path = '\0'; + else if (NULL != (ccp = strchr(texi.title, '.'))) + *ccp = '\0'; texi.ign = 1; texi.dirs = parsedirs(&texi, dir, Idir, &texi.dirsz); + free(dirpath); parsefile(&texi, argv[0], 1); /* We shouldn't get here. */ texiexit(&texi); Index: util.c =================================================================== RCS file: /home/cvs/mdocml/texi2mdoc/util.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -p -r1.10 -r1.11 --- util.c 23 Feb 2015 15:09:09 -0000 1.10 +++ util.c 23 Feb 2015 17:24:51 -0000 1.11 @@ -1,4 +1,4 @@ -/* $Id: util.c,v 1.10 2015/02/23 15:09:09 kristaps Exp $ */ +/* $Id: util.c,v 1.11 2015/02/23 17:24:51 kristaps Exp $ */ /* * Copyright (c) 2015 Kristaps Dzonsons * @@ -421,10 +421,11 @@ static void texiexecmacro(struct texi *p, struct teximacro *m, const char *buf, size_t sz, size_t *pos) { - size_t valsz, realsz, aasz, asz, - ssz, i, j, k, start, end; - char *val; - char **args; + size_t valsz, realsz, aasz, asz, + ssz, i, j, k, start, end; + char *val; + char **args; + const char *cp; args = argparse(p, buf, sz, pos, &asz, m->argsz); if (asz != m->argsz) @@ -494,7 +495,10 @@ texiexecmacro(struct texi *p, struct tex texiabort(p, NULL); } - j = strlcat(val, args[k], valsz + 1); + for (cp = args[k]; '\0' != *cp; cp++) + val[j++] = *cp; + + val[j] = '\0'; i = end; } @@ -1221,8 +1225,6 @@ argparse(struct texi *p, const char *buf /* Test for zero-length '{ }'. */ if (start == end && '}' == buf[*pos] && 0 == *argsz) break; - if (start == end) - texierr(p, "zero-length argument"); /* FIXME: use reallocarray. */ args = realloc (args, sizeof(char *) * --------------020707040109000404030009-- -- To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv