|
From: Keith M. <kei...@us...> - 2017-04-09 23:29:38
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 09/04/17 14:57, Anton Shepelev wrote: >> The interface of strtok_r() is rather ugly. Its first invocation >> shall differ from subsequent ones, whereas the task performed is >> the same. I agree that the APIs of both strtok() and strtok_r() are utterly disgusting, but nevertheless they are what they are, and as POSIX.1 prescribes, (and as ISO-C prescribes, in the case of strtok()); the same is true of Microsoft's strtok_s(). >> I have come up with more consistent version: >> [...] You are, of course, free to adopt this in your own applications, but, since it complies with no recognized standard, it will not be considered for inclusion in MinGW. > The code fragment is broken because grofg ... What is grofg? Do you, perhaps, mean groff? If so, then... > interpreted '\' as an escape character. strictly, as \0 appears in your code, it will be interpreted as an _escape sequence_, representing a non-paddable digit-width space; (typographically correct digits are all required to occupy uniform space, even in proportionally spaced fonts). Thus... > Here is the correct code: > > [...] > while( s[ind] != '\0' ) the '\0' in this code results in: while( s[ind] != ' ' ) (as it was shown, in your earlier post). - -- Regards, Keith. Public key available from keys.gnupg.net Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (GNU/Linux) iQIcBAEBAgAGBQJY6sPbAAoJEMCtNsY0flo/j5kQAIX1/XXqTq71moMwrV7nkP3Y JKIoP02euKKvFgfYvNDPZd2FU4LfCnem8ExGRVGXXBbrEmly5+wVBKZpPzITu0uJ 7GUXJnyIHK2iPRtRhCXykQ2akuzyKFQg64ExC9wR8F1i5uRk9UjMePjxkirGa9i5 gJS/fGlzXctxOnFSYjQhvB9iK8Af7m2qprWCP4taJkb9uLhafytbYk/95wL9CEx3 BlBcn/4pGNw0FFX2KqQPlmB2y5Pu3beUBcuIrLwPyXJLsCmKuEGupLRAmqsUcyDO Nd4oo1DPcxPcJ7W/GfZqvtX1E0/ei0Hq8/hXEfvN3ay3pF4IRy9sfciMJ9ae3hfz tVuTLDj5BCm1FndjhRMUrEAPFkjW1BEUL9EYoIyJ5fR0R/rNzwCmxc5dTghx3K6Y lUmLQZq8GCT4FE+r/TmLk+y37Gla0aW0zoogwcJ3UP7Qpc3Dvb4cINxj8Zu0szxM sPmQUIQhUAnYPuY+RQ95B2aOTr5e009HPAqBa/PJBwK+BZIG4sLaA8XGWcPpkq+o QNsKaME7S+G+2CtMZlBZfpybNQ53xFSqMMDy7ahSwVwjZ2x8aLX/+6ZwZeo3Rms6 g7NWSSlVOYZ38S5nhoODj+UVuLEGLI8jtHt0tW16kjK0VdwdFoRzD7XWhuaAbMDJ a0n6RDrVx0Cs9Jdz0XJ3 =k9fd -----END PGP SIGNATURE----- |