bufsplit man page on SmartOS

Printed from http://www.polarhome.com/service/man/?qf=bufsplit&af=0&tf=2&of=SmartOS

BUFSPLIT(3GEN)							BUFSPLIT(3GEN)

NAME
       bufsplit - split buffer into fields

SYNOPSIS
       cc [ flag ... ] file ... -lgen [ library ... ]
       #include <libgen.h>

       size_t bufsplit(char *buf, size_t n, char **a);

DESCRIPTION
       bufsplit()  examines the buffer, buf, and assigns values to the pointer
       array, a, so that the pointers point to the first n fields in buf  that
       are delimited by TABs or	 NEWLINEs.

       To  change the characters used to separate fields, call bufsplit() with
       buf pointing to the string of characters, and n and a set to zero.  For
       example,	 to  use  colon (:), period (.), and  comma (,), as separators
       along with TAB and NEWLINE:

       bufsplit (":.,\t\n", 0, (char**)0 );

RETURN VALUES
       The number of fields assigned in the array  a.  If  buf	is  zero,  the
       return  value  is zero and the array is unchanged.  Otherwise the value
       is  at least one.  The remainder of  the	 elements  in  the  array  are
       assigned the address of the null byte at the end of the buffer.

EXAMPLES
       Example 1 Example of bufsplit() function.

	 /*
	  * set a[0] = "This", a[1] = "is", a[2] = "a",
	  * a[3] = "test"
	  */
	 bufsplit("This\tis\ta\ttest\n", 4, a);

NOTES
       bufsplit() changes the delimiters to null bytes in buf.

       When  compiling multithreaded applications, the _REENTRANT flag must be
       defined on the compile line.  This flag should only be used  in	multi‐
       threaded applications.

ATTRIBUTES
       See attributes(5) for descriptions of the following attributes:

       ┌───────────────┬─────────────────┐
       │ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
       ├───────────────┼─────────────────┤
       │MT-Level       │ MT-Safe	 │
       └───────────────┴─────────────────┘

SEE ALSO
       attributes(5)

				 Dec 29, 1996			BUFSPLIT(3GEN)
[top]

List of man pages available for SmartOS

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net