|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T p
Length: 1671 (0x687) Types: TextFile Names: »parseline.3«
└─⟦87ddcff64⟧ Bits:30001253 CPHDIST85 Tape, 1985 Autumn Conference Copenhagen └─⟦this⟧ »cph85dist/stat/doc/man/parseline.3«
.TH PARSELINE 3 "March 5, 1985" "UNIX|STAT 5.0" "UNIX Programmer's Manual" .SH NAME parseline \- parse fields from a line .SH SYNOPSIS .nf parseline (line, array, maxfields) char *line; char **array; .fi .SH DESCRIPTION .I Parseline parses line (using whitespace or quotes as delimiters) into separate strings put into array[i]. Array is assumed to be declared something like: .ce char *array[maxfields]; At most maxfields fields are allowed. There is no limit on the length of the strings to be put in the array because the argument line is used to store the strings. A side effect is that the argument line is clobbered; end of line pointers are inserted while the array pointers are used to save the beginning of fields. The function returns the number of fields parsed, but if too many fields are present, maxfields+1 is returned. .PP A field is delimited by white space: spaces, tabs, or newlines. The main exception is that strings with spaces in them can be quoted with the single or double quote. The two quotes allow the inclusion of quotes in quoted fields. .SH EXAMPLES .PP The following lines all have three fields. .ce 10 one two three "one" 'two' three "one one" "two two" "three'" .ce 0 The last example has the third string with a single quote in it. Once read in, none of the fields except for that one will have quotes in them; the quotes are used to delimit fields but are not part of them. .SH AUTHOR Gary Perlman (based on a function of Jay McClelland's). .SH SEE\ ALSO strings(3) is a different version with less side effects but more space restrictions/needs. .SH BUGS The input line is clobbered, so a copy should be passed if it is needed later.