blob: 6ce308e61d706590d3858778669020c4ddcec670 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
package kconfig
import (
"bufio"
"bytes"
"strings"
)
func ParseKConfig(raw []byte) map[string]string {
buffer := bytes.NewBuffer(raw)
scanner := bufio.NewScanner(buffer)
ret := map[string]string{}
for scanner.Scan() {
line := scanner.Text()
if line[0] == '#' {
continue
}
idx := strings.Index(line, "=")
if idx < 0 {
continue
}
ret[line[0:idx]] = line[idx+1:]
}
return ret
}
func UnQuote(in string) string {
return in[1 : len(in)-1]
}
|