alaffin | 7ce3a79 | 2000-07-27 16:59:03 +0000 | [diff] [blame] | 1 | .\" |
| 2 | .\" $Id: string_to_tokens.3,v 1.1 2000/07/27 16:59:03 alaffin Exp $ |
| 3 | .\" |
| 4 | .\" Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 5 | .\" |
alaffin | 7ce3a79 | 2000-07-27 16:59:03 +0000 | [diff] [blame] | 6 | .\" This program is free software; you can redistribute it and/or modify it |
| 7 | .\" under the terms of version 2 of the GNU General Public License as |
| 8 | .\" published by the Free Software Foundation. |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 9 | .\" |
alaffin | 7ce3a79 | 2000-07-27 16:59:03 +0000 | [diff] [blame] | 10 | .\" This program is distributed in the hope that it would be useful, but |
| 11 | .\" WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 13 | .\" |
alaffin | 7ce3a79 | 2000-07-27 16:59:03 +0000 | [diff] [blame] | 14 | .\" Further, this software is distributed without any warranty that it is |
| 15 | .\" free of the rightful claim of any third person regarding infringement |
| 16 | .\" or the like. Any license provided herein, whether implied or |
| 17 | .\" otherwise, applies only to this software file. Patent licenses, if |
| 18 | .\" any, provided herein do not apply to combinations of this program with |
| 19 | .\" other software, or any other product whatsoever. |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 20 | .\" |
alaffin | 7ce3a79 | 2000-07-27 16:59:03 +0000 | [diff] [blame] | 21 | .\" You should have received a copy of the GNU General Public License along |
Wanlong Gao | fed9641 | 2012-10-24 10:10:29 +0800 | [diff] [blame] | 22 | .\" with this program; if not, write the Free Software Foundation, Inc., |
| 23 | .\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 24 | .\" |
alaffin | 7ce3a79 | 2000-07-27 16:59:03 +0000 | [diff] [blame] | 25 | .\" Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, |
| 26 | .\" Mountain View, CA 94043, or: |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 27 | .\" |
| 28 | .\" http://www.sgi.com |
| 29 | .\" |
| 30 | .\" For further information regarding this notice, see: |
| 31 | .\" |
alaffin | 7ce3a79 | 2000-07-27 16:59:03 +0000 | [diff] [blame] | 32 | .\" http://oss.sgi.com/projects/GenInfo/NoticeExplan/ |
| 33 | .\" |
| 34 | .TH STRING_TO_TOKEN 3 07/25/2000 "Linux Test Project" |
| 35 | .SH NAME |
| 36 | string_to_tokens \- Break a string into its tokens |
| 37 | .SH SYNOPSIS |
| 38 | .nf |
| 39 | \fB |
| 40 | int string_to_tokens(arg_string, arg_array, array_size, separator) |
| 41 | char *arg_string; |
| 42 | char *arg_array[]; |
| 43 | int array_size; |
| 44 | char *separator; |
| 45 | \fR |
| 46 | .fi |
| 47 | |
| 48 | .SH DESCRIPTION |
| 49 | This function parses the string \fIarg_string\fR, placing pointers to |
| 50 | the \fIseparator\fR separated tokens into the elements of \fIarg_array\fR. |
| 51 | The array is terminated with a null pointer. |
| 52 | \fIarg_array\fR must contains at least \fIarray_size\fR elements. |
| 53 | Only the first \fIarray_size\fR minus one tokens will be placed into |
| 54 | \fIarg_array\fR. If there are more than \fIarray_size\fR-1 tokens, the rest are |
| 55 | ignored by this routine. |
| 56 | .RE |
| 57 | |
| 58 | .SH "SEE ALSO" |
| 59 | strtok(3). |
| 60 | |
| 61 | .SH DIAGNOSTICS |
| 62 | This function returns the number of \fIseparator\fR separated tokens that |
| 63 | were found in \fIarg_string\fR. |
| 64 | If \fIarg_array\fR or \fIseparator\fR is NULL or \fIarray_size\fR is less than 2, |
| 65 | -1 is returned. |
| 66 | |
| 67 | .SH BUGS |
| 68 | This function uses \fBstrtok()\fR to parse \fIarg_string\fR, and thus |
| 69 | physically alters \fIarg_string\fR by placing null characters where the |
| 70 | separators originally were. |
| 71 | |