X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f Date: Tue, 04 Jan 2005 16:56:32 -0700 From: Brian Inglis Subject: Re: More complaints from tests/libclink/check In-reply-to: <200501012001.j01K1YMM023795@speedy.ludd.ltu.se> To: djgpp-workers AT delorie DOT com Message-id: Organization: Systematic Software MIME-version: 1.0 X-Mailer: Forte Agent 1.93/32.576 English (American) Content-type: text/plain; charset=us-ascii References: <200501012001 DOT j01K1YMM023795 AT speedy DOT ludd DOT ltu DOT se> Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id j04NuYZp011948 Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Sat, 01 Jan 2005 21:01:34 +0100 (CET), ams AT ludd DOT ltu DOT se wrote: >According to Brian Inglis: >> On Sat, 01 Jan 2005 04:13:50 +0100 (CET), ams AT ludd DOT ltu DOT se wrote: >> >You just define your (POSIX) functions that does the real work, adding >> >them as stubs to and letting the C (89 or 99) call them >> >as necessary. >> >> I am not sure what you mean by stubs here? > >I implemented strtok_r() yesterday. This is what I did. > >1. Move strtok.c to strtok_r.c (note: different directories). > >2. Edit strtok_r.c to have the right parameters and adjust code for >"function parameter memory" instead of static variable. > >3. Add strtok_r.c to makefile. > >4. Add new strtok() in strtok.c that calls strtok_r(). > >5. 4 means that strtok_r will pollute ansi namespace, hence I added >strtok_r to . Added #include to strtok.c >and strtok_r.c. (Actually I haven't done this yet, but will.) > >6. Copied strtok.txh to strtok_r.txh and adjusted it accordingly. > >Questions? Does strtok_r.c define _strtok_r()? Does the prototype declaration for strtok_r() appear in string.h between #ifndef _STRICT_ANSI and #ifndef _POSIX_SOURCE? The time *_r() functions make most sense if implemented in ctime.c, as static functions there do most of the work. I found I had to prototype the _*_r() functions in ctime.c to quiet 3.4.* compiler warnings. -- Thanks. Take care, Brian Inglis