-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsdp_parser.go
More file actions
42 lines (32 loc) · 853 Bytes
/
sdp_parser.go
File metadata and controls
42 lines (32 loc) · 853 Bytes
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
31
32
33
34
35
36
37
38
39
40
41
42
package main
// sdp in one line "\n" or "\r\n" formated
import (
"flag"
"fmt"
"io/ioutil"
"os"
"strings"
)
var copyright string = "******** Create by LIDE ********"
var useage string = "Useage: sdp_parser -f <filename>"
func main() {
filename := flag.String("f", "sdp file", "sdp file given")
flag.Parse()
if count := len(os.Args); count != 3 {
fmt.Printf("%s\n", useage)
os.Exit(-1)
}
sdp, e := ioutil.ReadFile(*filename)
if e != nil {
fmt.Println("read file error", e.Error())
return
}
var sdp2 string = string(sdp)
fmt.Println("================================================================\n")
fmt.Println(copyright)
str := strings.Split(sdp2, "\\n")
for _, l := range str {
fmt.Println(strings.Replace(l, "\\r", "", -1))
}
fmt.Println("================================================================\n")
}