Skip to content

Commit

Permalink
dictionary flag now optional for dict_generator cli
Browse files Browse the repository at this point in the history
  • Loading branch information
lwlee2608 committed Nov 12, 2023
1 parent 3b540b8 commit fe79df8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 779 deletions.
23 changes: 13 additions & 10 deletions cmd/dict_generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,23 @@ func main() {
var dictionary string
var output string

flag.StringVar(&dictionary, "dictionary", "dictionary.xml", "Dictionary")
flag.StringVar(&dictionary, "dictionary", "", "Dictionary")
flag.StringVar(&output, "output", "const.js", "Output file")
flag.Parse()

file, err := os.Open(dictionary)
if err != nil {
log.Fatalf("Error opening dictioanry: %s\n", err)
}
defer file.Close()

parser := dict.Default
parser.Load(file)
if err != nil {
log.Fatalf("Error parsing dictioanry: %s\n", err)

if dictionary != "" {
file, err := os.Open(dictionary)
if err != nil {
log.Fatalf("Error opening dictioanry: %s\n", err)
}
defer file.Close()

parser.Load(file)
if err != nil {
log.Fatalf("Error parsing dictioanry: %s\n", err)
}
}

w, err := os.OpenFile(output, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0666)
Expand Down
2 changes: 1 addition & 1 deletion diameter.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (d *Diameter) Send(client *DiameterClient, msg *DiameterMessage) (uint32, e

// Wait for CCA
resp := <-client.hopIds[hopByHopID]
log.Infof("Received CCA \n%s", resp)
//log.Infof("Received CCA \n%s", resp)

delete(client.hopIds, hopByHopID)

Expand Down
Loading

0 comments on commit fe79df8

Please sign in to comment.