What are the implications and usage guidelines for strsep's obseletion of strtok?

72 views Asked by At

The (BSD) man pages for strtok state in the first line under description

This interface is obsoleted by strsep(3).

Does that mean that strtok should on the whole not be used? It does not provide any usage guidelines about strtok's being obsolete beyond that. On strsep's man page, it states under history

The strsep() function is intended as a replacement for the strtok() function. While the strtok() function should be preferred for portability reasons (it conforms to ISO/IEC 9899:1990 (``ISO C90'')) it is unable to handle empty fields, i.e., detect fields delimited by two adjacent delimiter characters, or to be used for more than a single string at a time.

So, my questions are this

  1. Should strsep on the whole be used over strtok?
  2. How much of a portability issue is there with strsep as it appeared in BSD4.4 which was in June of 1994?
  3. Do all POSIX compliant machines have strsep?
0

There are 0 answers