From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from scc-mailout-kit-01-web.scc.kit.edu (scc-mailout-kit-01-web.scc.kit.edu [129.13.231.93]); by fantadrom.bsd.lv (OpenSMTPD) with ESMTP id ab1a8c64; for ; Wed, 21 Jan 2015 19:20:59 -0500 (EST) Received: from asta-nat.asta.uni-karlsruhe.de ([172.22.63.82] helo=hekate.usta.de) by scc-mailout-kit-01.scc.kit.edu with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (envelope-from ) id 1YE5W5-0002zZ-0k; Thu, 22 Jan 2015 01:20:58 +0100 Received: from donnerwolke.usta.de ([172.24.96.3]) by hekate.usta.de with esmtp (Exim 4.77) (envelope-from ) id 1YE5W4-0005V8-QB; Thu, 22 Jan 2015 01:20:56 +0100 Received: from iris.usta.de ([172.24.96.5] helo=usta.de) by donnerwolke.usta.de with esmtp (Exim 4.80) (envelope-from ) id 1YE5W4-0004Fi-KV; Thu, 22 Jan 2015 01:20:56 +0100 Received: from schwarze by usta.de with local (Exim 4.77) (envelope-from ) id 1YE5W4-0002Go-JQ; Thu, 22 Jan 2015 01:20:56 +0100 Date: Thu, 22 Jan 2015 01:20:56 +0100 From: Ingo Schwarze To: Kristaps Dzonsons Cc: tech@mdocml.bsd.lv Subject: Re: MACHINE not defined and a few cast nits Message-ID: <20150122002056.GI11796@iris.usta.de> References: <54BB798E.6070407@bsd.lv> X-Mailinglist: mdocml-tech Reply-To: tech@mdocml.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54BB798E.6070407@bsd.lv> User-Agent: Mutt/1.5.21 (2010-09-15) Hi Kristaps, Kristaps Dzonsons wrote on Sun, Jan 18, 2015 at 10:14:54AM +0100: > Enclosed is a patch for compilation on Mac OS X. If wraps the > MACHINE in #ifdef, but I'm not sure how to get this without invoking > sysctl(3) for each and every invocation of mandoc. Which won't work > on windows anyway, I reckon. > > I also cast some unsigned char's that clang complains about. OK schwarze@ for the whole patch. I agree that the #ifdef makes sense. I already worried that this might blow up on some platforms, but didn't realize it can be fixed so elegantly. Using sysctl(3) indeed looks like overkill. This ought to be done at compile or configure time, not at run time. Should i add support for setting MACHINE from configure.local after your commit has gone in? Yours, Ingo > Index: main.c > =================================================================== > RCS file: /home/cvs/mdocml/mdocml/main.c,v > retrieving revision 1.216 > diff -u -p -r1.216 main.c > --- main.c 16 Jan 2015 21:15:05 -0000 1.216 > +++ main.c 18 Jan 2015 09:14:40 -0000 > @@ -321,18 +321,20 @@ main(int argc, char *argv[]) > argc = 1; > } > } else if (argc > 1 && > - ((uc = argv[0]) != NULL) && > + ((uc = (unsigned char *)argv[0]) != NULL) && > ((isdigit(uc[0]) && (uc[1] == '\0' || > (isalpha(uc[1]) && uc[2] == '\0'))) || > (uc[0] == 'n' && uc[1] == '\0'))) { > - search.sec = uc; > + search.sec = (char *)uc; > argv++; > argc--; > } > if (search.arch == NULL) > search.arch = getenv("MACHINE"); > +#ifdef MACHINE > if (search.arch == NULL) > search.arch = MACHINE; > +#endif > } > > rc = MANDOCLEVEL_OK; > Index: preconv.c > =================================================================== > RCS file: /home/cvs/mdocml/mdocml/preconv.c,v > retrieving revision 1.13 > diff -u -p -r1.13 preconv.c > --- preconv.c 19 Dec 2014 04:58:35 -0000 1.13 > +++ preconv.c 18 Jan 2015 09:14:40 -0000 > @@ -33,7 +33,7 @@ preconv_encode(struct buf *ib, size_t *i > int nby; > unsigned int accum; > > - cu = ib->buf + *ii; > + cu = (unsigned char *)ib->buf + *ii; > assert(*cu & 0x80); > > if ( ! (*filenc & MPARSE_UTF8)) -- To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv