getfields man page on DragonFly

Man page or keyword search:  
man Server   44335 pages
apropos Keyword Search (all sections)
Output format
DragonFly logo
[printable version]

getfields(l)			BEGEMOT Library			  getfields(l)

NAME
       getfields, getmfields, setfields - split string into fields

SYNOPSIS
       # include <begemot.h>

       int getfields(char *str, char **fields, int nfields);

       int getmfields(char *str, char **fields, int nfields);

       char *setfields(char *delim);

DESCRIPTION
       getfields  and  getmfields  split  the  input  string  in substrings as
       defined by a set of delimiting characters.  The pointer array fields is
       filled with pointers to the starts of the substrings. Each substring is
       terminated with a NUL character (the original string is modified).  The
       number  of  entries  in the array is given with nfields.	 If the string
       contains more substrings than nfields specifies, the  last  pointer  in
       fields  will point to the rest of the string.  If there are lesser sub‐
       strings than entries in fields, the substring  pointer  array  will  be
       NULL terminated.	 Both functions return the number of substrings found.

       getfields  and  getmfields  differ  in  the  interpretation of multiple
       delimiting characters.  getfields interprets two consecutive delimiters
       as an empty field, whereas getmfields collapses multiple delimiters.

       setfields  sets	a  new	set of delimiters. A string containing the old
       delimiting characters is returned. The default set is  "\t ".  The  NUL
       character is always interpreted as a delimiter and end of string.

RETURN VALUE
       getfields  and  getmfields  return the number of substrings.  setfields
       returns a pointer to static memory containing the old delimiting	 char‐
       acters.	 This  is  valid only until the next call to setfields and can
       directly be feed into the next setfields call.

SEE ALSO
       strtok(3),

BUGS
       Could, perhaps, be more performant.

BEGEMOT				  12 Sep 1996			  getfields(l)
[top]

List of man pages available for DragonFly

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