blob: 5c458db4a54a1829bd5d59eb2e2295d0c18cdc65 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
package main
import "strings"
func parse_smtp_line(line string) (cmd, param string) {
line = strings.TrimSuffix(line, "\n")
line = strings.TrimSuffix(line, "\r")
cmd_end := strings.IndexByte(line, ' ')
var param_start int
if cmd_end == -1 {
cmd_end = len(line)
param_start = len(line)
} else {
param_start = cmd_end + 1
}
cmd = strings.ToUpper(line[:cmd_end])
param = line[param_start:]
return
}
|