strsep.3
上传用户:zibowangxu
上传日期:2007-01-04
资源大小:331k
文件大小:2k
- ."
- ." Copyright (c) 1999 WU-FTPD Development Group.
- ." All rights reserved.
- ."
- ." Portions Copyright (c) 1980, 1985, 1988, 1989, 1990, 1991, 1993, 1994
- ." The Regents of the University of California. Portions Copyright (c)
- ." 1993, 1994 Washington University in Saint Louis. Portions Copyright
- ." (c) 1996, 1998 Berkeley Software Design, Inc. Portions Copyright (c)
- ." 1998 Sendmail, Inc. Portions Copyright (c) 1983, 1995, 1996, 1997 Eric
- ." P. Allman. Portions Copyright (c) 1989 Massachusetts Institute of
- ." Technology. Portions Copyright (c) 1997 Stan Barber. Portions
- ." Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997 Free Software
- ." Foundation, Inc. Portions Copyright (c) 1997 Kent Landfield.
- ."
- ." Use and distribution of this software and its source code are governed
- ." by the terms and conditions of the WU-FTPD Software License ("LICENSE").
- ."
- ." $Id: strsep.3,v 1.3 1999/08/27 14:45:11 wuftpd Exp $
- ."
- .TH STRSEP 3 "May 15, 1990"
- .UC 7
- .SH NAME
- strsep - separate strings
- .SH SYNOPSIS
- .nf
- .ft B
- #include <string.h>
- char *
- strsep(char **stringp, char *delim);
- .ft R
- .fi
- .SH DESCRIPTION
- .B Strsep
- locates in the null-terminated string at
- .I *stringp
- the first occurence of any character in
- .I delim
- and replaces this with a 'e0',
- records the location of the immediate following character in
- .IR *stringp ,
- then returns the original value of
- .IR *stringp .
- If no delimiter characters are found,
- .B strsep
- sets
- .I *stringp
- to NULL;
- if
- .I *stringp
- is initially NULL,
- .B strsep
- returns NULL.
- .SH EXAMPLES
- The following uses
- .I strsep
- to parse strings containing runs of white space,
- making up an argument vector:
- .sp
- .nf
- .RS
- char inputstring[100];
- char **argv[51], **ap = argv, *p, *val;
- .I "/* set up inputstring */"
- for (p = inputstring; p != NULL; ) {
- while ((val = strsep(&p, " et")) != NULL && *val == 'e0');
- *ap++ = val;
- }
- *ap = 0;
- .RE