Subversion Repositories planix.SVN

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include <u.h>
2
#include <libc.h>
3
 
4
int	strcomment = '#';
5
 
6
int
7
strparse(char *p, int arsize, char **arv)
8
{
9
	int arc = 0;
10
 
11
	/*print("parse: 0x%lux = \"%s\"\n", p, p);/**/
12
	while(p){
13
		while(*p == ' ' || *p == '\t')
14
			p++;
15
		if(*p == 0 || *p == strcomment)
16
			break;
17
		if(arc >= arsize-1)
18
			break;
19
		arv[arc++] = p;
20
		while(*p && *p != ' ' && *p != '\t')
21
			p++;
22
		if(*p == 0)
23
			break;
24
		*p++ = 0;
25
	}
26
	arv[arc] = 0;
27
	/*while(*arv){
28
		print("\t0x%lux = \"%s\"\n", *arv, *arv);
29
		++arv;
30
	}/**/
31
	return arc;
32
}