getfields man page on Plan9

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

GETFIELDS(2)							  GETFIELDS(2)

NAME
       getfields, gettokens, tokenize - break a string into fields

SYNOPSIS
       #include <u.h>
       #include <libc.h>

       int   getfields(char *str, char **args, int maxargs, int multiflag,
		 char *delims)

       int   gettokens(char *str, char **args, int maxargs, char *delims)

       int   tokenize(char *str, char **args, int maxargs)

DESCRIPTION
       Getfields  places  into	the  array  args pointers to the first maxargs
       fields of the null terminated UTF string str.  Delimiters between these
       fields are set to NUL bytes.

       Fields  are  substrings of str whose definition depends on the value of
       multiflag.  If multiflag is zero,  adjacent  fields  are	 separated  by
       exactly one delimiter.  For example

	     getfields("#alice#bob##charles###", arg, 3, 0, "#");

       yields  three substrings: null-string , alice, and bob##charles###.  If
       the multiflag argument is not zero, a field is a	 non-empty  string  of
       non-delimiters.	For example

	     getfields("#alice#bob##charles###", arg, 3, 1, "#");

       yields the three substrings: alice, bob, and charles###.

       Getfields returns the number of fields pointed to.

       Gettokens is the same as getfields with multiflag non-zero, except that
       fields may be quoted using single quotes, in the manner of rc(1).   Any
       such  quotes  remain  in	 the resulting args.  See quote(2) for related
       quote-handling software.

       Tokenize is similar to gettokens with delims set to  "\t\r\n ",	except
       that quotes are interpreted but do not appear in the resulting args.

SOURCE
       /sys/src/libc/port/tokenize.c

SEE ALSO
       strtok in strcat(2), quote(2).

								  GETFIELDS(2)
[top]
                             _         _         _ 
                            | |       | |       | |     
                            | |       | |       | |     
                         __ | | __ __ | | __ __ | | __  
                         \ \| |/ / \ \| |/ / \ \| |/ /  
                          \ \ / /   \ \ / /   \ \ / /   
                           \   /     \   /     \   /    
                            \_/       \_/       \_/ 
More information is available in HTML format for server Plan9

List of man pages available for Plan9

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