Hi Bruce, > > So, it took 20 minutes to clean up. Attached. > > I should have tested better. I've included a test program and script now.
Thanks. I have committed it into gnulib, after adding module descriptions and removing a "Written by Bruno Haible" comment from the test. 2008-11-17 Bruce Korb <[EMAIL PROTECTED]> * modules/parse-duration-tests: New file. * tests/test-parse-duration.sh: New file. * tests/test-parse-duration.c: New file. New module 'parse-duration'. * lib/parse-duration.h: New file. * lib/parse-duration.c: New file. * modules/parse-duration: New file. > It will likely be Christmas before I can play again. Still to do: - As mentioned in <http://lists.gnu.org/archive/html/bug-gnulib/2008-11/msg00061.html> I'd like to see the return value convention documented, and the locale dependency cleared up. - Compilation with -Wall yields a warning: parse-duration.c: In function `parse_period': parse-duration.c:383: warning: implicit declaration of function `xstrdup' parse-duration.c:383: warning: initialization makes pointer from integer without a cast - The test prints the following: -rw-r--r-- 1 bruno user 147 Nov 17 12:58 /tmp/glQwoKIg/tests.txt OK: 1 Y 2 M 3 W 4 d 5 h 6 m 7 s OK: P 00010225 T 05:06:07 OK: P 1Y2M3W4D T 5H6M7S OK: 1 Y 2 M 25 D 5:6:7 OK: 1 Y 2 M 25 d 5h 6:7 OK: 1 Y 2 M 25 d 5h 6m 7 OK: P 1-2-25 T 5:6:7 PASS: test-parse-duration.sh When everything it OK, it is better to print nothing. So that tests that fail or are skipped get the necessary attention from the person who looks at the log. Bruno