Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ strsep(3) — 386BSD 1.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

STRSEP(3)                 386BSD Programmer's Manual                 STRSEP(3)

NAME
     strsep - separate strings

SYNOPSIS
     #include <string.h>

     char *
     strsep(char **stringp, char *delim)

DESCRIPTION
     The strsep() locates in the null-terminated string at *stringp the first
     occurence of any character in delim and replaces this with a `\0',
     records the location of the immediate following character in *stringp,
     then returns the original value of *stringp. If no delimiter characters
     are found, strsep() sets *stringp to NULL; if *stringp is initially NULL,
     strsep() returns NULL.

EXAMPLES
     The following uses strsep() to parse strings containing runs of white
     space, making up an argument vector:

           char inputstring[100];
           char **argv[51], **ap = argv, *p, *val;
           /* set up inputstring */
           for (p = inputstring; p != NULL; ) {
                   while ((val = strsep(&p, " \t")) != NULL && *val == '\0');
                   *ap++ = val;
           }
           *ap = 0;

HISTORY
     The strsep() function is currently under development.

BSD Experimental                April 19, 1991                               1






























Typewritten Software • bear@typewritten.org • Edmonds, WA 98026