4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change
on this file since a114d8b5 was
283acce,
checked in by Shane Alcock <salcock@…>, 17 years ago
|
* empty log message *
|
-
Property mode set to
100644
|
File size:
982 bytes
|
Line | |
---|
1 | void |
---|
2 | skip_white(char **buf) |
---|
3 | { |
---|
4 | while(**buf==' ') |
---|
5 | (*buf)++; |
---|
6 | } |
---|
7 | |
---|
8 | /* Get the next word in a line |
---|
9 | * |
---|
10 | * Returns |
---|
11 | * NULL : End of line |
---|
12 | * other: Pointer to a word |
---|
13 | * |
---|
14 | * Side effects: |
---|
15 | * updates *buf |
---|
16 | * modified *buf |
---|
17 | * |
---|
18 | * ' foo bar baz' => 'foo' 'bar baz' |
---|
19 | * ' "foo bar" baz' => 'foo bar' ' baz' |
---|
20 | */ |
---|
21 | char * |
---|
22 | split_cmd(char **buf) |
---|
23 | { |
---|
24 | char *ret = 0; |
---|
25 | |
---|
26 | skip_white(buf); |
---|
27 | |
---|
28 | if (**buf=='"') /* Quoted */ |
---|
29 | { |
---|
30 | (*buf)++; |
---|
31 | ret=*buf; |
---|
32 | |
---|
33 | while(**buf && **buf!='"') |
---|
34 | (*buf)++; |
---|
35 | |
---|
36 | if (**buf) |
---|
37 | { |
---|
38 | **buf='\0'; |
---|
39 | (*buf)++; |
---|
40 | } |
---|
41 | } else |
---|
42 | { |
---|
43 | ret=*buf; |
---|
44 | |
---|
45 | while(**buf && **buf!=' ') |
---|
46 | (*buf)++; |
---|
47 | |
---|
48 | if (**buf) |
---|
49 | { |
---|
50 | **buf='\0'; |
---|
51 | (*buf)++; |
---|
52 | } |
---|
53 | } |
---|
54 | return ret; |
---|
55 | } |
---|
56 | |
---|
57 | /* Split a command line up into parc,parv |
---|
58 | * using command line rules |
---|
59 | */ |
---|
60 | void parse_cmd(char *buf,int *parc, char *parv[], int MAXTOKENS) |
---|
61 | { |
---|
62 | int i=0; |
---|
63 | *parc=0; |
---|
64 | |
---|
65 | while(*buf) |
---|
66 | { |
---|
67 | parv[(*parc)++]=split_cmd(&buf); |
---|
68 | if (*parc>(MAXTOKENS-1)) |
---|
69 | { |
---|
70 | parv[*parc]=buf; |
---|
71 | break; |
---|
72 | } |
---|
73 | } |
---|
74 | for(i=*parc;i<MAXTOKENS;i++) |
---|
75 | parv[i]=""; |
---|
76 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.